lkml.org 
[lkml]   [2005]   [Apr]   [28]   [last100]   RSS Feed
Views: [more markup]  [less markup]  [headers]  [forward] 
 
Messages in this thread
/
DateThu, 28 Apr 2005 00:00:22 -0700
FromGreg KH <>
SubjectRe: [PATCH 0/5] Misc driver core changes (constness)
On Tue, Apr 26, 2005 at 02:29:03AM -0500, Dmitry Torokhov wrote:
> Hi,> > It all started when code like this:> > static const char driver_name = "blah";> static struct device_driver {> 	.name = driver_name,
> };
> 
> would give me compiler warning about removing constness because driver
> core has "name" fields drclared simply as "char *". I think it is a good
> idea to have them as "const char *" since whoever accesses them should
> not try to change them.
> 
> 01-hotplug-use-kobject-name.patch
>   - kobject_hotplug should use kobject_name() instead of
>     accessing kobj->name directly since for objects with
>     long names it can contain garbage.
> 
> 02-sysfs-link-constness.patch
>   - make sysfs_{create|remove}_link to take const char * name.
> 
> 03-kobject-const-name.patch
>   - make kobject's name const char * since users should not
>     attempt to change it (except by calling kobject_rename).
> 
> 04-kset-name-const.patch
>   - change name() method in kset_hiotplug_ops return const char *
>     since users shoudl not try to modify returned data.
> 
> 05-driver-const-name.patch
>   - change driver's, bus's, class's and platform device's names
>     to be const char * so one can use const char *drv_name = "asdfg";
>     when initializing structures.
>     Also kill couple of whitespaces.
> 
> Please consider for inclusion.

Very nice, I've added all 5 patches to my tree, and are queued up for
after 2.6.12 is out.

thanks,

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

\
 
 \ /
  Last update: 2005-04-28 09:10    [W:1.034 / U:0.430 seconds]
©2003-2008 Jasper Spaans