Re: [PATCH] usb driver for intellon based PLC like devolo dlan duo

From: Guennadi Liakhovetski
Date: Fri Apr 17 2009 - 15:10:58 EST


On Fri, 17 Apr 2009, Florian Fainelli wrote:

> > diff --git a/drivers/net/usb/intellon.c b/drivers/net/usb/intellon.c
> > new file mode 100644
> > index 0000000..c9fcc38
> > --- /dev/null
> > +++ b/drivers/net/usb/intellon.c
> > @@ -0,0 +1,273 @@
> > +/*
> > + * Copyright (c) 2009 Peter Holik
> > + *
> > + * Intellon PLC (Powerline Communications) usb net driver
>
> Intellon INT51x1 PLC ...
> [snip]
>
> > +
> > +static u8 nibble(unsigned char c)
> > +{
> > + if (likely(isdigit(c)))
> > + return c - '0';
> > + c = toupper(c);
> > + if (likely(isxdigit(c)))
> > + return 10 + c - 'A';
> > + return 0;
> > +}
>
> Please prefix this with intellon_ (or int51x1_) for instance to avoid any
> possible namespace clash.
>
> > +
> > +static inline int get_ethernet_addr(struct usbnet *dev)
> > +{
> > + int tmp, i;
> > + unsigned char buf [13];
> > +
> > + tmp = usb_string(dev->udev, 3, buf, sizeof buf);
> > + if (tmp != 12) {
> > + devdbg(dev, "bad MAC string fetch, %d\n", tmp);
> > + if (tmp >= 0)
> > + tmp = -EINVAL;
> > + return tmp;
> > + }
> > + for (i = tmp = 0; i < 6; i++, tmp += 2)
> > + dev->net->dev_addr [i] =
> > + (nibble(buf [tmp]) << 4) + nibble(buf [tmp + 1]);
> > + return 0;
> > +}
>
> Same here.

FWIW, I think it's pretty common to name static functions in a .c file,
which perform auxiliary function, not really specific to the context
without the respective context-prefix. Of course, it might indeed happen
that a global symbol "nibble" or "get_ethernet_addr" gets introduced at
some point thus leading to a conflict, but this seems to be unlikely. And
in any case the one who introduces such a symbol will have to grep the
entire kernel anyway.

Thanks
Guennadi
---
Guennadi Liakhovetski, Ph.D.
Freelance Open-Source Software Developer
http://www.open-technology.de/
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/