[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20121017202900.GA30907@kroah.com>
Date: Wed, 17 Oct 2012 13:29:00 -0700
From: Greg Kroah-Hartman <greg@...ah.com>
To: Borislav Petkov <bp@...64.org>
Cc: Tony Luck <tony.luck@...el.com>,
"Naveen N. Rao" <naveen.n.rao@...ux.vnet.ibm.com>,
LKML <linux-kernel@...r.kernel.org>,
Borislav Petkov <borislav.petkov@....com>
Subject: Re: [PATCH 1/5] drivers/base: Add a DEVICE_BOOL_ATTR macro
On Wed, Oct 17, 2012 at 10:10:18PM +0200, Borislav Petkov wrote:
> 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'... ?
Heh, no, but that would be funny :)
Take the function already from the module code, it should be reusable,
if not, it would be a good idea to make it so.
thanks,
greg k-h
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists