Re: [PATCH] driver core: Add the ability to unbind drivers to devices from userspace

Greg KH
2005-07-26T00:06:24Z

On Mon, Jul 25, 2005 at 12:30:43PM -0400, Jon Smirl wrote:
> On 7/25/05, Dmitry Torokhov <dmitry.torokhov@gmail.com> wrote:
> > On 7/25/05, Jon Smirl <jonsmirl@gmail.com> wrote:
> > > On 7/25/05, Dmitry Torokhov <dtor_core@ameritech.net> wrote:
> > > > On Sunday 24 July 2005 23:09, Jon Smirl wrote:
> > > > > I just pulled from GIT to test bind/unbind. I couldn't get it to work;
> > > > > it isn't taking into account the CR on the end of the input value of
> > > > > the sysfs attribute. This patch will fix it but I'm sure there is a
> > > > > cleaner solution.
> > > > >
> > > >
> > > > "echo -n" should take care of this problem I think.
> > >
> > > That will work around it but I think we should fix it. Changing to
> > > strncmp() fixes most cases.
> > >
> > > - if (strcmp(name, dev->bus_id) == 0)
> > > + if (strncmp(name, dev->bus_id, strlen(dev->bus_id)) == 0)
> > >
> >
> > This will produce "interesting results" if you have both "blah-1" and
> > "blah-10" devices on the bus.

Yes, not a good thing for USB devices specifically.

> Then the better solution is to fix the generic attribute set code to
> strip leading and trailing white space.

No, that might break other things as we have not been doing this from
day one. I'd rather just change these two places, if it's that big of a
deal. It was documented (in a lwn.net article) and the changelog entry,
that you should use "echo -n".

thanks,

greg k-h