RE: [PATCH v3] rtc: add devm_rtc_device_{register,unregister}()

From: Venu Byravarasu
Date: Wed Mar 06 2013 - 01:04:36 EST


> -----Original Message-----
> From: linux-kernel-owner@xxxxxxxxxxxxxxx [mailto:linux-kernel-
> owner@xxxxxxxxxxxxxxx] On Behalf Of Jingoo Han
> Sent: Tuesday, February 26, 2013 7:20 AM
> To: 'Andrew Morton'
> Cc: linux-kernel@xxxxxxxxxxxxxxx; 'Tejun Heo'; 'Greg KH'; 'Alessandro
> Zummo'; rtc-linux@xxxxxxxxxxxxxxxx; 'Jingoo Han'
> Subject: [PATCH v3] rtc: add devm_rtc_device_{register,unregister}()
>
> These functios allows the driver core to automatically clean up
> any allocation made by rtc drivers. Thus, it simplifies the error
> paths.
>
> Signed-off-by: Jingoo Han <jg1.han@xxxxxxxxxxx>
> ---
> Changes since v2:
> - Removed unnecessary WARN_ON() of devm_rtc_device_match()
>
> Changes since v1:
> - Simplified 'if' statements using WARN_ON()
> - Added a description of the return value of devm_rtc_device_register()
>
> drivers/rtc/class.c | 70
> +++++++++++++++++++++++++++++++++++++++++++++++++++
> include/linux/rtc.h | 6 ++++
> 2 files changed, 76 insertions(+), 0 deletions(-)
>
> diff --git a/drivers/rtc/class.c b/drivers/rtc/class.c
> index 9b742d3..b72b40b 100644
> --- a/drivers/rtc/class.c
> +++ b/drivers/rtc/class.c

> +/**
> + * devm_rtc_device_register - resource managed rtc_device_register()
> + * @name: the name of the device
> + * @dev: the device to register
> + * @ops: the rtc operations structure
> + * @owner: the module owner
> + *
> + * @return a struct rtc on success, or an ERR_PTR on error
> + *
> + * Managed rtc_device_register(). The rtc_device returned from this
> function
> + * are automatically freed on driver detach. See rtc_device_register()
> + * for more information.
> + */
> +
> +struct rtc_device *devm_rtc_device_register(const char *name,
> + struct device *dev,

As most of devm_* functions use " struct device *dev" as their first param,
why not this function also modified to be in sync with them?

> + const struct rtc_class_ops *ops,
> + struct module *owner)
> +{
> + struct rtc_device **ptr, *rtc;
--
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/