Re: [PATCH 2/2 v2] Driver core: reduce duplicated code

From: Greg KH
Date: Mon Jun 21 2010 - 17:46:19 EST


On Mon, Jun 21, 2010 at 04:11:44PM +0200, Uwe Kleine-König wrote:
> This makes the two similar functions platform_device_register_simple
> and platform_device_register_data one line inline functions using a new
> generic function platform_device_register_resndata.
>
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@xxxxxxxxxxxxxx>
> ---
> Hello,
>
> still unsolved is the naming issue, what do you think about
> platform_device_register?

We already have a platform_device_register() function :)

> I marked the new function as __init_or_module in a separate patch to
> make reverting it a bit easier, still I think it should be possible to
> fix the caller if a problem occurs.
>
> I changed the semantic slightly to only call
> platform_device_add_resources if data != NULL instead of size != 0. The
> idea is to support wrappers like:
>
> #define add_blablub(id, pdata) \
> platform_device_register_resndata(NULL, "blablub", id, \
> NULL, 0, pdata, sizeof(struct blablub_platform_data))
>
> that don't fail if pdata=NULL. Ditto for res.

That's fine, but why would you want to have a #define for something like
this? Is it really needed?

Anyway, this version looks fine to me, I'll go apply it.

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/