2

I'm going through the probe function of the following driver

/drivers/net/ethernet/smsc/smsc911x.c

Inside the probe function it has been commented that

/* Ensure interrupts are globally disabled before connecting ISR */

    smsc911x_disable_irq_chip(dev);

    retval = request_irq(dev->irq, smsc911x_irqhandler,
                         irq_flags | IRQF_SHARED, dev->name, dev);

But I don't see it is TRUE in case of every other device driver ,so why it is in case of this particular Network driver?

Why interrupts are globally disabled before connecting ISR?

Amit Singh Tomar
  • 8,380
  • 27
  • 120
  • 199
  • I don't know what @Miline is talking about, but if you read the code you easily get that `smsc911x_disable_irq_chip()` disables interrupts on **device side** which is good solution if you not quite sure in which state device is before you call the `->probe()`. – 0andriy Mar 13 '15 at 17:12
  • 1
    Yes Andy is right, its disabling the interrupt on device and not `disable_irq()` the irq line as whole. As the irq line is shared you cant really `disable_irq()`. And as its a shared irq, the driver ought to be prepared for it to happen immediately. So even if you are in the middle of assigning ISR to an IRQ, the interrupt can actually occur and after looking at the dev_id `dev` which is yours, you will somehow have to do something for that interrupt, atleast ignore the interrupt. – Milind Dumbare Mar 19 '15 at 13:03

1 Answers1

0

The comment says that the interrupts are disabled globally; but as in the function call below, the interrupts are disabled only for the device smsc driver attaches to. This is normally done to avoid getting interrupts well before driver preparing itself for processing interrupts. Since this is for an Ethernet driver, interrupts are enabled most likely during interface up. The code snip in question gets executed during module load which is well before the interface up.

Gireesh
  • 54
  • 2