lkml.org 
[lkml]   [2012]   [Oct]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 1/5] drivers/base: Add a DEVICE_BOOL_ATTR macro
On Wed, Oct 17, 2012 at 12:03:00PM -0700, Greg Kroah-Hartman wrote:
> On Wed, Oct 17, 2012 at 01:13:51PM +0200, Borislav Petkov wrote:
> > +ssize_t device_store_bool(struct device *dev, struct device_attribute *attr,
> > + const char *buf, size_t size)
> > +{
> > + struct dev_ext_attribute *ea = to_ext_attr(attr);
> > + u8 bval;
> > +
> > + if (kstrtou8(buf, 10, &bval) < 0)
> > + return -EINVAL;
> > +
> > + *(bool *)ea->var = !!bval;
> > +
> > + return size;
> > +}
> > +EXPORT_SYMBOL_GPL(device_store_bool);
>
> Wouldn't it be nice to be able to accept 'y' 'Y' 'n' 'N' '0' and '1'
> like the module bool parameter code does? That would make things a bit
> more consistent, and possibly allow you to use this function for the
> module sysfs file handling as well.

That could be easily done, let me try it tomorrow. Any other letters you
prefer? Maybe, 'G' 'r' 'e' 'g'... ?

:-)

--
Regards/Gruss,
Boris.

Advanced Micro Devices GmbH
Einsteinring 24, 85609 Dornach
GM: Alberto Bozzo
Reg: Dornach, Landkreis Muenchen
HRB Nr. 43632 WEEE Registernr: 129 19551


\
 
 \ /
  Last update: 2012-10-17 23:01    [W:0.135 / U:0.036 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site