Re: [PATCH 0/3] Couple of sysfs patches

From: Greg KH
Date: Wed Jun 09 2004 - 18:23:32 EST


On Wed, Jun 09, 2004 at 05:54:23PM -0500, Dmitry Torokhov wrote:
> On Wednesday 09 June 2004 05:45 pm, Greg KH wrote:
> > On Wed, Jun 09, 2004 at 05:32:28PM -0500, Dmitry Torokhov wrote:
> > > Actually, I myself want someting else -
> > >
> > > int platform_device_register_simple(struct platform_device **ppdev,
> > > const char *name, int id)
> > >
> > > It will allocate platform device, set name and id and release function to
> > > platform_device_simple_release which in turn will be hidden from outside
> > > world. Since the function does allocation for user is should prevent the
> > > abuse you were concerned about.
> >
> > Ok, that sounds good. I'll take patches for that kind of interface.
> >
> > But have the function return the pointer, like the class_simple
> > functions work. Not the ** like you just specified.
>
> I want to do both allocation + registration in one shot and I knowing
> the error code may be important to users.

That's fine to do. Again, look at how the class_simple_create()
function works. If an error happens, convert it to ERR_PTR() and return
that. The caller can check it with IS_ERR() and friends.

> Why do you oppose having double pointers in interface?

It's messy, and with the ERR_PTR() macros, not needed :)

thanks,

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