To force driver developers to use a standard convention for naming network device IRQ's, provide a standardized method for creating the name. Signed-off-by: Stephen Hemminger --- a/include/linux/netdevice.h 2011-06-21 08:58:32.207953328 -0700 +++ b/include/linux/netdevice.h 2011-06-21 09:12:12.155952869 -0700 @@ -2631,6 +2631,46 @@ static inline const char *netdev_name(co return dev->name; } +/* function bits for netdev_irqname */ +#define NETIF_IRQ_TX 1 +#define NETIF_IRQ_RX 2 +#define NETIF_IRQ_TXRX 3 +#define NETIF_IRQ_OTHER 0 /* none of the above */ + +/** + * netdev_irqname - generate name for irq + * @buf: space to store result + * @buflen: sizeof buf + * @dev: network device + * @queue: assoctiated network queue + * @function: function of irq + * + * Format a IRQ name according to standard convention to be passed + * to request_irq(). + */ +static inline const char *netdev_irqname(char *buf, size_t buflen, + const struct net_device *dev, + unsigned queue, + unsigned function) +{ + switch (function) { + case NETIF_IRQ_TX: + snprintf(buf, buflen, "%s-tx-%u", dev->name, queue); + break; + case NETIF_IRQ_RX: + snprintf(buf, buflen, "%s-rx-%u", dev->name, queue); + break; + case NETIF_IRQ_TXRX: + snprintf(buf, buflen, "%s-%u", dev->name, queue); + break; + default: + snprintf(buf, buflen, "%s", dev->name); + } + + return buf; +} + + extern int netdev_printk(const char *level, const struct net_device *dev, const char *format, ...) __attribute__ ((format (printf, 3, 4))); -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html