Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Linux: Kernel

[PATCH 2/2] als: add unique device-ids to the als device class

 

 

Linux kernel RSS feed   Index | Next | Previous | View Threaded


amit.kucheria at verdurent

Nov 26, 2009, 4:06 AM

Post #1 of 8 (174 views)
Permalink
[PATCH 2/2] als: add unique device-ids to the als device class

Other devices classes such as hwmon and input class handle assignment of
unique device-ids inside the core functions instead of pushing it out to
individual drivers. This reduces code duplication and resulting bugs.

Signed-off-by: Amit Kucheria <amit.kucheria [at] verdurent>
Cc: Zhang Rui <rui.zhang [at] intel>
Cc: Jonathan Cameron <jic23 [at] cam>

---
drivers/als/als_sys.c | 48 +++++++++++++++++++++++++++++++++++++++++++++---
1 files changed, 45 insertions(+), 3 deletions(-)

diff --git a/drivers/als/als_sys.c b/drivers/als/als_sys.c
index e1d6395..aa15ad8 100644
--- a/drivers/als/als_sys.c
+++ b/drivers/als/als_sys.c
@@ -26,22 +26,55 @@
#include <linux/device.h>
#include <linux/err.h>
#include <linux/kdev_t.h>
+#include <linux/idr.h>

MODULE_AUTHOR("Zhang Rui <rui.zhang [at] intel>");
MODULE_DESCRIPTION("Ambient Light Sensor sysfs/class support");
MODULE_LICENSE("GPL");

+#define ALS_ID_PREFIX "als"
+#define ALS_ID_FORMAT ALS_ID_PREFIX "%d"
+
static struct class *als_class;

+static DEFINE_IDR(als_idr);
+static DEFINE_SPINLOCK(idr_lock);
+
/**
* als_device_register - register a new Ambient Light Sensor class device
* @parent: the device to register.
*
* Returns the pointer to the new device
*/
-struct device *als_device_register(struct device *dev, char *name)
+struct device *als_device_register(struct device *dev)
{
- return device_create(als_class, dev, MKDEV(0, 0), NULL, name);
+ int id, err;
+ struct device *alsdev;
+
+again:
+ if (unlikely(idr_pre_get(&als_idr, GFP_KERNEL) == 0))
+ return ERR_PTR(-ENOMEM);
+
+ spin_lock(&idr_lock);
+ err = idr_get_new(&als_idr, NULL, &id);
+ spin_unlock(&idr_lock);
+
+ if (unlikely(err == -EAGAIN))
+ goto again;
+ else if (unlikely(err))
+ return ERR_PTR(err);
+
+ id = id & MAX_ID_MASK;
+ alsdev = device_create(als_class, dev, MKDEV(0, 0), NULL,
+ ALS_ID_FORMAT, id);
+
+ if (IS_ERR(alsdev)) {
+ spin_lock(&idr_lock);
+ idr_remove(&als_idr, id);
+ spin_unlock(&idr_lock);
+ }
+
+ return alsdev;
}
EXPORT_SYMBOL(als_device_register);

@@ -51,7 +84,16 @@ EXPORT_SYMBOL(als_device_register);
*/
void als_device_unregister(struct device *dev)
{
- device_unregister(dev);
+ int id;
+
+ if (likely(sscanf(dev_name(dev), ALS_ID_FORMAT, &id) == 1)) {
+ device_unregister(dev);
+ spin_lock(&idr_lock);
+ idr_remove(&als_idr, id);
+ spin_unlock(&idr_lock);
+ } else
+ dev_dbg(dev->parent,
+ "als_device_unregister() failed: bad class ID!\n");
}
EXPORT_SYMBOL(als_device_unregister);

--
1.6.3.3

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo [at] vger
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/


khali at linux-fr

Nov 26, 2009, 7:07 AM

Post #2 of 8 (151 views)
Permalink
Re: [PATCH 2/2] als: add unique device-ids to the als device class [In reply to]

Hi Amit,

On Thu, 26 Nov 2009 14:06:26 +0200, Amit Kucheria wrote:
> Other devices classes such as hwmon and input class handle assignment of
> unique device-ids inside the core functions instead of pushing it out to
> individual drivers. This reduces code duplication and resulting bugs.
>
> Signed-off-by: Amit Kucheria <amit.kucheria [at] verdurent>
> Cc: Zhang Rui <rui.zhang [at] intel>
> Cc: Jonathan Cameron <jic23 [at] cam>
>
> ---
> drivers/als/als_sys.c | 48 +++++++++++++++++++++++++++++++++++++++++++++---
> 1 files changed, 45 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/als/als_sys.c b/drivers/als/als_sys.c
> index e1d6395..aa15ad8 100644
> --- a/drivers/als/als_sys.c
> +++ b/drivers/als/als_sys.c
> @@ -26,22 +26,55 @@
> #include <linux/device.h>
> #include <linux/err.h>
> #include <linux/kdev_t.h>
> +#include <linux/idr.h>
>
> MODULE_AUTHOR("Zhang Rui <rui.zhang [at] intel>");
> MODULE_DESCRIPTION("Ambient Light Sensor sysfs/class support");
> MODULE_LICENSE("GPL");
>
> +#define ALS_ID_PREFIX "als"
> +#define ALS_ID_FORMAT ALS_ID_PREFIX "%d"
> +
> static struct class *als_class;
>
> +static DEFINE_IDR(als_idr);
> +static DEFINE_SPINLOCK(idr_lock);
> +
> /**
> * als_device_register - register a new Ambient Light Sensor class device
> * @parent: the device to register.
> *
> * Returns the pointer to the new device
> */
> -struct device *als_device_register(struct device *dev, char *name)
> +struct device *als_device_register(struct device *dev)

This is a public function but you forgot to update
include/linux/als_sys.h accordingly. This will let the build succeed
but crashes will happen at run time. Fix below.

> {
> - return device_create(als_class, dev, MKDEV(0, 0), NULL, name);
> + int id, err;
> + struct device *alsdev;
> +
> +again:
> + if (unlikely(idr_pre_get(&als_idr, GFP_KERNEL) == 0))
> + return ERR_PTR(-ENOMEM);
> +
> + spin_lock(&idr_lock);
> + err = idr_get_new(&als_idr, NULL, &id);
> + spin_unlock(&idr_lock);
> +
> + if (unlikely(err == -EAGAIN))
> + goto again;
> + else if (unlikely(err))
> + return ERR_PTR(err);
> +
> + id = id & MAX_ID_MASK;
> + alsdev = device_create(als_class, dev, MKDEV(0, 0), NULL,
> + ALS_ID_FORMAT, id);
> +
> + if (IS_ERR(alsdev)) {
> + spin_lock(&idr_lock);
> + idr_remove(&als_idr, id);
> + spin_unlock(&idr_lock);
> + }
> +
> + return alsdev;
> }
> EXPORT_SYMBOL(als_device_register);
>
> @@ -51,7 +84,16 @@ EXPORT_SYMBOL(als_device_register);
> */
> void als_device_unregister(struct device *dev)
> {
> - device_unregister(dev);
> + int id;
> +
> + if (likely(sscanf(dev_name(dev), ALS_ID_FORMAT, &id) == 1)) {
> + device_unregister(dev);
> + spin_lock(&idr_lock);
> + idr_remove(&als_idr, id);
> + spin_unlock(&idr_lock);
> + } else
> + dev_dbg(dev->parent,
> + "als_device_unregister() failed: bad class ID!\n");
> }
> EXPORT_SYMBOL(als_device_unregister);
>

Other than that I am very happy with this change, which kills 46 lines
of code in the tsl2550 driver (and virtually the same in every other
light sensor driver.) Please merge the following fix:

--- linux-2.6.32-rc8.orig/include/linux/als_sys.h 2009-11-26 15:32:38.000000000 +0100
+++ linux-2.6.32-rc8/include/linux/als_sys.h 2009-11-26 15:44:08.000000000 +0100
@@ -29,7 +29,7 @@
#define ALS_ILLUMINANCE_MIN 0
#define ALS_ILLUMINANCE_MAX -1

-struct device *als_device_register(struct device *dev, char *name);
+struct device *als_device_register(struct device *dev);
void als_device_unregister(struct device *dev);

#endif /* __ALS_SYS_H__ */


And then you can add:

Acked-by: Jean Delvare <khali [at] linux-fr>

That being said... If we want user-space to know what device is there,
we may want to still let drivers pass a name string to
als_device_register() and let the ALS core create a "name" sysfs
attribute returning the string in question. This would be much lighter
(for individual drivers) than the previous situation, as the string in
question would be a constant (e.g. "TSL2550".) Opinions?

--
Jean Delvare
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo [at] vger
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/


jic23 at cam

Nov 26, 2009, 9:19 AM

Post #3 of 8 (151 views)
Permalink
Re: [PATCH 2/2] als: add unique device-ids to the als device class [In reply to]

Jean Delvare wrote:
> Hi Amit,
>
> On Thu, 26 Nov 2009 14:06:26 +0200, Amit Kucheria wrote:
>> Other devices classes such as hwmon and input class handle assignment of
>> unique device-ids inside the core functions instead of pushing it out to
>> individual drivers. This reduces code duplication and resulting bugs.
>>
>> Signed-off-by: Amit Kucheria <amit.kucheria [at] verdurent>
>> Cc: Zhang Rui <rui.zhang [at] intel>
>> Cc: Jonathan Cameron <jic23 [at] cam>
>>
>> ---
>> drivers/als/als_sys.c | 48 +++++++++++++++++++++++++++++++++++++++++++++---
>> 1 files changed, 45 insertions(+), 3 deletions(-)
>>
>> diff --git a/drivers/als/als_sys.c b/drivers/als/als_sys.c
>> index e1d6395..aa15ad8 100644
>> --- a/drivers/als/als_sys.c
>> +++ b/drivers/als/als_sys.c
>> @@ -26,22 +26,55 @@
>> #include <linux/device.h>
>> #include <linux/err.h>
>> #include <linux/kdev_t.h>
>> +#include <linux/idr.h>
>>
>> MODULE_AUTHOR("Zhang Rui <rui.zhang [at] intel>");
>> MODULE_DESCRIPTION("Ambient Light Sensor sysfs/class support");
>> MODULE_LICENSE("GPL");
>>
>> +#define ALS_ID_PREFIX "als"
>> +#define ALS_ID_FORMAT ALS_ID_PREFIX "%d"
>> +
>> static struct class *als_class;
>>
>> +static DEFINE_IDR(als_idr);
>> +static DEFINE_SPINLOCK(idr_lock);
>> +
>> /**
>> * als_device_register - register a new Ambient Light Sensor class device
>> * @parent: the device to register.
>> *
>> * Returns the pointer to the new device
>> */
>> -struct device *als_device_register(struct device *dev, char *name)
>> +struct device *als_device_register(struct device *dev)
>
> This is a public function but you forgot to update
> include/linux/als_sys.h accordingly. This will let the build succeed
> but crashes will happen at run time. Fix below.
>
>> {
>> - return device_create(als_class, dev, MKDEV(0, 0), NULL, name);
>> + int id, err;
>> + struct device *alsdev;
>> +
>> +again:
>> + if (unlikely(idr_pre_get(&als_idr, GFP_KERNEL) == 0))
>> + return ERR_PTR(-ENOMEM);
>> +
>> + spin_lock(&idr_lock);
>> + err = idr_get_new(&als_idr, NULL, &id);
>> + spin_unlock(&idr_lock);
>> +
>> + if (unlikely(err == -EAGAIN))
>> + goto again;
>> + else if (unlikely(err))
>> + return ERR_PTR(err);
>> +
>> + id = id & MAX_ID_MASK;
>> + alsdev = device_create(als_class, dev, MKDEV(0, 0), NULL,
>> + ALS_ID_FORMAT, id);
>> +
>> + if (IS_ERR(alsdev)) {
>> + spin_lock(&idr_lock);
>> + idr_remove(&als_idr, id);
>> + spin_unlock(&idr_lock);
>> + }
>> +
>> + return alsdev;
>> }
>> EXPORT_SYMBOL(als_device_register);
>>
>> @@ -51,7 +84,16 @@ EXPORT_SYMBOL(als_device_register);
>> */
>> void als_device_unregister(struct device *dev)
>> {
>> - device_unregister(dev);
>> + int id;
>> +
>> + if (likely(sscanf(dev_name(dev), ALS_ID_FORMAT, &id) == 1)) {
>> + device_unregister(dev);
>> + spin_lock(&idr_lock);
>> + idr_remove(&als_idr, id);
>> + spin_unlock(&idr_lock);
>> + } else
>> + dev_dbg(dev->parent,
>> + "als_device_unregister() failed: bad class ID!\n");
>> }
>> EXPORT_SYMBOL(als_device_unregister);
>>
>
> Other than that I am very happy with this change, which kills 46 lines
> of code in the tsl2550 driver (and virtually the same in every other
> light sensor driver.) Please merge the following fix:
>
> --- linux-2.6.32-rc8.orig/include/linux/als_sys.h 2009-11-26 15:32:38.000000000 +0100
> +++ linux-2.6.32-rc8/include/linux/als_sys.h 2009-11-26 15:44:08.000000000 +0100
> @@ -29,7 +29,7 @@
> #define ALS_ILLUMINANCE_MIN 0
> #define ALS_ILLUMINANCE_MAX -1
>
> -struct device *als_device_register(struct device *dev, char *name);
> +struct device *als_device_register(struct device *dev);
> void als_device_unregister(struct device *dev);
>
> #endif /* __ALS_SYS_H__ */
>
>
> And then you can add:
>
> Acked-by: Jean Delvare <khali [at] linux-fr>
>
> That being said... If we want user-space to know what device is there,
> we may want to still let drivers pass a name string to
> als_device_register() and let the ALS core create a "name" sysfs
> attribute returning the string in question. This would be much lighter
> (for individual drivers) than the previous situation, as the string in
> question would be a constant (e.g. "TSL2550".) Opinions?
>
Makes sense given we want all drivers to support some form of identification.
We could do it by stating they will all have that attribute, but given it's constant
will save repetition to put it in the driver. Conversely it might complicate the handling
of subsequent attribute_groups so I'd probably favour adding relevant documentation lines
and leaving it up to the drivers to implement this attribute.

Thus we'd require (within reason) all drivers to have illuminance0 and name.

Hence,
Acked-by: Jonathan Cameron <jic23 [at] cam>

Thanks for doing this!

Jonathan


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo [at] vger
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/


gregkh at suse

Nov 26, 2009, 10:06 AM

Post #4 of 8 (151 views)
Permalink
Re: [PATCH 2/2] als: add unique device-ids to the als device class [In reply to]

On Thu, Nov 26, 2009 at 05:19:13PM +0000, Jonathan Cameron wrote:
> > That being said... If we want user-space to know what device is there,
> > we may want to still let drivers pass a name string to
> > als_device_register() and let the ALS core create a "name" sysfs
> > attribute returning the string in question. This would be much lighter
> > (for individual drivers) than the previous situation, as the string in
> > question would be a constant (e.g. "TSL2550".) Opinions?
> >
> Makes sense given we want all drivers to support some form of identification.
> We could do it by stating they will all have that attribute, but given it's constant
> will save repetition to put it in the driver. Conversely it might complicate the handling
> of subsequent attribute_groups so I'd probably favour adding relevant documentation lines
> and leaving it up to the drivers to implement this attribute.
>
> Thus we'd require (within reason) all drivers to have illuminance0 and name.

Why have a name attribute when you can just use the name of the device
itself instead? Isn't that what it is there for?

confused,

greg k-h
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo [at] vger
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/


jic23 at cam

Nov 26, 2009, 10:40 AM

Post #5 of 8 (151 views)
Permalink
Re: [PATCH 2/2] als: add unique device-ids to the als device class [In reply to]

Greg KH wrote:
> On Thu, Nov 26, 2009 at 05:19:13PM +0000, Jonathan Cameron wrote:
>>> That being said... If we want user-space to know what device is there,
>>> we may want to still let drivers pass a name string to
>>> als_device_register() and let the ALS core create a "name" sysfs
>>> attribute returning the string in question. This would be much lighter
>>> (for individual drivers) than the previous situation, as the string in
>>> question would be a constant (e.g. "TSL2550".) Opinions?
>>>
>> Makes sense given we want all drivers to support some form of identification.
>> We could do it by stating they will all have that attribute, but given it's constant
>> will save repetition to put it in the driver. Conversely it might complicate the handling
>> of subsequent attribute_groups so I'd probably favour adding relevant documentation lines
>> and leaving it up to the drivers to implement this attribute.
>>
>> Thus we'd require (within reason) all drivers to have illuminance0 and name.
>
> Why have a name attribute when you can just use the name of the device
> itself instead? Isn't that what it is there for?
Could do, though I'm not entirely sure all bus types are implementing a name
attribute (I may be wrong, but I don't think spi does for example though it might
have gone in with the recent device table stuff). We could just specify that it
should be present for the device.

Jonathan

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo [at] vger
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/


khali at linux-fr

Nov 26, 2009, 10:54 AM

Post #6 of 8 (151 views)
Permalink
Re: [PATCH 2/2] als: add unique device-ids to the als device class [In reply to]

On Thu, 26 Nov 2009 10:06:46 -0800, Greg KH wrote:
> On Thu, Nov 26, 2009 at 05:19:13PM +0000, Jonathan Cameron wrote:
> > > That being said... If we want user-space to know what device is there,
> > > we may want to still let drivers pass a name string to
> > > als_device_register() and let the ALS core create a "name" sysfs
> > > attribute returning the string in question. This would be much lighter
> > > (for individual drivers) than the previous situation, as the string in
> > > question would be a constant (e.g. "TSL2550".) Opinions?
> > >
> > Makes sense given we want all drivers to support some form of identification.
> > We could do it by stating they will all have that attribute, but given it's constant
> > will save repetition to put it in the driver. Conversely it might complicate the handling
> > of subsequent attribute_groups so I'd probably favour adding relevant documentation lines
> > and leaving it up to the drivers to implement this attribute.
> >
> > Thus we'd require (within reason) all drivers to have illuminance0 and name.
>
> Why have a name attribute when you can just use the name of the device
> itself instead? Isn't that what it is there for?

Can you please clarify what you call "the name of the device"?

Can you also please explain what problem you think we are trying to
solve?

> confused,

Me even more ;)

--
Jean Delvare
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo [at] vger
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/


amit.kucheria at verdurent

Nov 30, 2009, 3:46 AM

Post #7 of 8 (130 views)
Permalink
[PATCH 2/2] als: add unique device-ids to the als device class [In reply to]

Other devices classes such as hwmon and input class handle assignment of
unique device-ids inside the core functions instead of pushing it out to
individual drivers. This reduces code duplication and resulting bugs.

V2 - Updated the header to reflect the change is signature of
als_device_register(). Thanks to Jean for the review.

V1 - Add capability to als core to create unique ids

Signed-off-by: Amit Kucheria <amit.kucheria [at] verdurent>
Acked-by: Jean Delvare <khali [at] linux-fr>
Acked-by: Jonathan Cameron <jic23 [at] cam>
---
drivers/als/als_sys.c | 48 ++++++++++++++++++++++++++++++++++++++++++++--
include/linux/als_sys.h | 2 +-
2 files changed, 46 insertions(+), 4 deletions(-)

diff --git a/drivers/als/als_sys.c b/drivers/als/als_sys.c
index e1d6395..aa15ad8 100644
--- a/drivers/als/als_sys.c
+++ b/drivers/als/als_sys.c
@@ -26,22 +26,55 @@
#include <linux/device.h>
#include <linux/err.h>
#include <linux/kdev_t.h>
+#include <linux/idr.h>

MODULE_AUTHOR("Zhang Rui <rui.zhang [at] intel>");
MODULE_DESCRIPTION("Ambient Light Sensor sysfs/class support");
MODULE_LICENSE("GPL");

+#define ALS_ID_PREFIX "als"
+#define ALS_ID_FORMAT ALS_ID_PREFIX "%d"
+
static struct class *als_class;

+static DEFINE_IDR(als_idr);
+static DEFINE_SPINLOCK(idr_lock);
+
/**
* als_device_register - register a new Ambient Light Sensor class device
* @parent: the device to register.
*
* Returns the pointer to the new device
*/
-struct device *als_device_register(struct device *dev, char *name)
+struct device *als_device_register(struct device *dev)
{
- return device_create(als_class, dev, MKDEV(0, 0), NULL, name);
+ int id, err;
+ struct device *alsdev;
+
+again:
+ if (unlikely(idr_pre_get(&als_idr, GFP_KERNEL) == 0))
+ return ERR_PTR(-ENOMEM);
+
+ spin_lock(&idr_lock);
+ err = idr_get_new(&als_idr, NULL, &id);
+ spin_unlock(&idr_lock);
+
+ if (unlikely(err == -EAGAIN))
+ goto again;
+ else if (unlikely(err))
+ return ERR_PTR(err);
+
+ id = id & MAX_ID_MASK;
+ alsdev = device_create(als_class, dev, MKDEV(0, 0), NULL,
+ ALS_ID_FORMAT, id);
+
+ if (IS_ERR(alsdev)) {
+ spin_lock(&idr_lock);
+ idr_remove(&als_idr, id);
+ spin_unlock(&idr_lock);
+ }
+
+ return alsdev;
}
EXPORT_SYMBOL(als_device_register);

@@ -51,7 +84,16 @@ EXPORT_SYMBOL(als_device_register);
*/
void als_device_unregister(struct device *dev)
{
- device_unregister(dev);
+ int id;
+
+ if (likely(sscanf(dev_name(dev), ALS_ID_FORMAT, &id) == 1)) {
+ device_unregister(dev);
+ spin_lock(&idr_lock);
+ idr_remove(&als_idr, id);
+ spin_unlock(&idr_lock);
+ } else
+ dev_dbg(dev->parent,
+ "als_device_unregister() failed: bad class ID!\n");
}
EXPORT_SYMBOL(als_device_unregister);

diff --git a/include/linux/als_sys.h b/include/linux/als_sys.h
index 500f300..41793f7 100644
--- a/include/linux/als_sys.h
+++ b/include/linux/als_sys.h
@@ -29,7 +29,7 @@
#define ALS_ILLUMINANCE_MIN 0
#define ALS_ILLUMINANCE_MAX -1

-struct device *als_device_register(struct device *dev, char *name);
+struct device *als_device_register(struct device *dev);
void als_device_unregister(struct device *dev);

#endif /* __ALS_SYS_H__ */
--
1.6.3.3

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo [at] vger
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/


gregkh at suse

Dec 3, 2009, 9:20 PM

Post #8 of 8 (125 views)
Permalink
Re: [PATCH 2/2] als: add unique device-ids to the als device class [In reply to]

On Thu, Nov 26, 2009 at 06:40:04PM +0000, Jonathan Cameron wrote:
> Greg KH wrote:
> > On Thu, Nov 26, 2009 at 05:19:13PM +0000, Jonathan Cameron wrote:
> >>> That being said... If we want user-space to know what device is there,
> >>> we may want to still let drivers pass a name string to
> >>> als_device_register() and let the ALS core create a "name" sysfs
> >>> attribute returning the string in question. This would be much lighter
> >>> (for individual drivers) than the previous situation, as the string in
> >>> question would be a constant (e.g. "TSL2550".) Opinions?
> >>>
> >> Makes sense given we want all drivers to support some form of identification.
> >> We could do it by stating they will all have that attribute, but given it's constant
> >> will save repetition to put it in the driver. Conversely it might complicate the handling
> >> of subsequent attribute_groups so I'd probably favour adding relevant documentation lines
> >> and leaving it up to the drivers to implement this attribute.
> >>
> >> Thus we'd require (within reason) all drivers to have illuminance0 and name.
> >
> > Why have a name attribute when you can just use the name of the device
> > itself instead? Isn't that what it is there for?
> Could do, though I'm not entirely sure all bus types are implementing a name
> attribute (I may be wrong, but I don't think spi does for example though it might
> have gone in with the recent device table stuff). We could just specify that it
> should be present for the device.

ah, sorry, I was thinking of the name of the actual device, which is the
bus id here.

Nevermind, I'll go back to feeling stupid...

greg k-h
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo [at] vger
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

Linux kernel RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.