[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <2f36d3db-d222-1e0b-a759-d2a83355efb7@suse.de>
Date: Tue, 7 Aug 2018 23:25:15 +0200
From: Andreas Färber <afaerber@...e.de>
To: Ben Whitten <ben.whitten@...il.com>
Cc: starnight@...cu.edu.tw, hasnain.virk@....com,
netdev@...r.kernel.org, Ben Whitten <ben.whitten@...rdtech.com>
Subject: Re: [PATCH lora-next 02/10] net: lora: add methods for devm
registration
Am 07.08.2018 um 19:32 schrieb Ben Whitten:
> From: Ben Whitten <ben.whitten@...rdtech.com>
>
> Follow the devm model so that we can avoid lengthy unwind code.
>
> Signed-off-by: Ben Whitten <ben.whitten@...rdtech.com>
> ---
> drivers/net/lora/dev.c | 20 ++++++++++++++++++++
> include/linux/lora/dev.h | 1 +
> 2 files changed, 21 insertions(+)
>
> diff --git a/drivers/net/lora/dev.c b/drivers/net/lora/dev.c
> index 8c01106..69a8b52 100644
> --- a/drivers/net/lora/dev.c
> +++ b/drivers/net/lora/dev.c
> @@ -84,6 +84,26 @@ void free_loradev(struct net_device *dev)
> }
> EXPORT_SYMBOL_GPL(free_loradev);
>
> +static void devm_lora_unregister(struct device *dev, void *res)
> +{
> + free_loradev(*(struct net_device **)res);
Suggest to use a variable.
> +}
> +
> +int devm_lora_register_netdev(struct device *dev, struct net_device *net)
Nice idea, but why a separate registration function? Suggest to instead
introduce devm_alloc_loradev(). If you then reorder those two patches to
the front of the series, I'll queue them immediately.
Thanks,
Andreas
--
SUSE Linux GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Felix Imendörffer, Jane Smithard, Graham Norton
HRB 21284 (AG Nürnberg)
Powered by blists - more mailing lists