Message ID | 001a01cf2729$dc23cd70$946b6850$%han@samsung.com |
---|---|
State | Changes Requested |
Headers | show |
On Tue, Feb 11, 2014 at 10:04:55PM +0900, Jingoo Han wrote: > Use devm_ioremap_resource() in order to make the code simpler, > and remove redundant return value check of platform_get_resource() > because the value is checked by devm_ioremap_resource(). > > Signed-off-by: Jingoo Han <jg1.han@samsung.com> Acked-by: Shawn Guo <shawn.guo@linaro.org> -- To unsubscribe from this list: send the line "unsubscribe linux-i2c" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On Tuesday, February 11, 2014 at 02:04:55 PM, Jingoo Han wrote: > Use devm_ioremap_resource() in order to make the code simpler, > and remove redundant return value check of platform_get_resource() > because the value is checked by devm_ioremap_resource(). > > Signed-off-by: Jingoo Han <jg1.han@samsung.com> > --- Acked-by: Marek Vasut <marex@denx.de> Best regards, Marek Vasut -- To unsubscribe from this list: send the line "unsubscribe linux-i2c" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
> - if (!res || irq < 0) > + irq = platform_get_irq(pdev, 0); > + if (irq < 0) > return -ENOENT; Please return irq here.
diff --git a/drivers/i2c/busses/i2c-mxs.c b/drivers/i2c/busses/i2c-mxs.c index 0cde4e6..9585b90 100644 --- a/drivers/i2c/busses/i2c-mxs.c +++ b/drivers/i2c/busses/i2c-mxs.c @@ -806,7 +806,6 @@ static int mxs_i2c_probe(struct platform_device *pdev) struct mxs_i2c_dev *i2c; struct i2c_adapter *adap; struct resource *res; - resource_size_t res_size; int err, irq; i2c = devm_kzalloc(dev, sizeof(struct mxs_i2c_dev), GFP_KERNEL); @@ -819,19 +818,14 @@ static int mxs_i2c_probe(struct platform_device *pdev) } res = platform_get_resource(pdev, IORESOURCE_MEM, 0); - irq = platform_get_irq(pdev, 0); + i2c->regs = devm_ioremap_resource(&pdev->dev, res); + if (IS_ERR(i2c->regs)) + return PTR_ERR(i2c->regs); - if (!res || irq < 0) + irq = platform_get_irq(pdev, 0); + if (irq < 0) return -ENOENT; - res_size = resource_size(res); - if (!devm_request_mem_region(dev, res->start, res_size, res->name)) - return -EBUSY; - - i2c->regs = devm_ioremap_nocache(dev, res->start, res_size); - if (!i2c->regs) - return -EBUSY; - err = devm_request_irq(dev, irq, mxs_i2c_isr, 0, dev_name(dev), i2c); if (err) return err;
Use devm_ioremap_resource() in order to make the code simpler, and remove redundant return value check of platform_get_resource() because the value is checked by devm_ioremap_resource(). Signed-off-by: Jingoo Han <jg1.han@samsung.com> --- drivers/i2c/busses/i2c-mxs.c | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-)