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

Jon Smirl
2005-07-26T00:56:51Z

On 7/25/05, Greg KH <greg@kroah.com> wrote:
> On Mon, Jul 25, 2005 at 08:28:10PM -0400, Jon Smirl wrote:
> > I didn't realize that echo was adding the CR, I thought that it always
> > appeared on the end of a sysfs attribute set. So now I have to go add
> > white space stripping to a dozen fbdev/drm sysfs attribute
> > implementations. Given that the param is const I may have to allocate
> > new buffers and copy. I also wonder how many other people have made
> > the same mistake.
>
> Nah, just zero out that \n character :)

The input buffer is "const char * buf". I will have to override the
const to zero it out.

>
> > Are you sure it would break other things? These are supposed to be
> > text attributes, not binary ones.
>
> I agree, I don't know what would break. Care to make a patch so we
> could find out?

I'll put one together to trim leading/trailing white space from the
buffer before it is passed into the attribute functions. Now that I
think about this I believe the attributes should have always had the
leading/trailing white space removed. If we don't do it in the sysfs
code then every driver has to do it.

--
Jon Smirl
jonsmirl@gmail.com