Re: [PATCH 3/3] mfd: mc13xxx: Simplify "probe" & "remove"

From: Lee Jones
Date: Mon Dec 16 2013 - 03:43:22 EST


> This patch simplifies "probe" and "remove" functions by moving
> some initialization code in the driver core.
>
> Signed-off-by: Alexander Shiyan <shc_work@xxxxxxx>
> ---
> drivers/mfd/mc13xxx-core.c | 36 +++++++++++++++++-------------------
> drivers/mfd/mc13xxx-i2c.c | 18 ++++--------------
> drivers/mfd/mc13xxx-spi.c | 19 ++++++-------------
> drivers/mfd/mc13xxx.h | 6 ++----
> 4 files changed, 29 insertions(+), 50 deletions(-)
>
> diff --git a/drivers/mfd/mc13xxx-core.c b/drivers/mfd/mc13xxx-core.c
> index b0c7cb0..06e64b6 100644
> --- a/drivers/mfd/mc13xxx-core.c
> +++ b/drivers/mfd/mc13xxx-core.c

<snip>

> - ret = request_threaded_irq(irq, NULL, mc13xxx_irq_thread,
> + ret = request_threaded_irq(mc13xxx->irq, NULL, mc13xxx_irq_thread,
> IRQF_ONESHOT | IRQF_TRIGGER_HIGH, "mc13xxx", mc13xxx);

Please use devm_* managed resources, then you can remove the free_irq().

<snip>

> -void mc13xxx_common_cleanup(struct mc13xxx *mc13xxx)
> +int mc13xxx_common_exit(struct device *dev)
> {
> + struct mc13xxx *mc13xxx = dev_get_drvdata(dev);
> +
> free_irq(mc13xxx->irq, mc13xxx);

Here.


> - spi_set_drvdata(spi, mc13xxx);
> + dev_set_drvdata(&spi->dev, mc13xxx);
> +

What's the point of this? It does the same thing?

--
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org â Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
--
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/