lkml.org 
[lkml]   [2013]   [Dec]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH 5/6] GenWQE Sysfs interfaces
From
Date
Hi Greg,

thanks for taking your time to review our code once more.

Am Mittwoch, den 27.11.2013, 11:22 -0800 schrieb Greg KH:
> On Wed, Nov 06, 2013 at 01:45:42PM +0100, Frank Haverkamp wrote:
> > +/**
> > + * genwqe_init_sysfs() - Setup sysfs entries of the card device
> > + */
> > +int genwqe_init_sysfs(struct genwqe_dev *cd)
> > +{
> > + int rc;
> > +
> > + rc = sysfs_create_group(&cd->dev->kobj, &genwqe_attribute_group);
> > + if (rc)
> > + return -ENXIO;
> > +
> > + return 0;
> > +}
>
> Why isn't this group the "default" one for the device? That way you
> don't have to explicitly create/remove it, the driver core handles it
> all automatically for you, and you don't race with userspace when it is
> created/announced.

I found the ..._with_groups variant of device_create:
cd->dev = device_create_with_groups(cd->class_genwqe,
&cd->pci_dev->dev,
cd->devnum_genwqe, cd,
genwqe_attribute_groups,
GENWQE_DEVNAME "%u_card",
cd->card_idx);

This works nicely for me too. Is that what you had in mind?
It saves two functions and if it gets rid of the race, nice.

> thanks,
>
> greg k-h
>
Regards

Frank




\
 
 \ /
  Last update: 2013-12-03 14:41    [W:0.223 / U:0.172 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site