Message ID | 20170724145508.7388-1-thierry.reding@gmail.com |
---|---|
State | Accepted |
Headers | show |
On 24/07/17 15:55, Thierry Reding wrote: > From: Thierry Reding <treding@nvidia.com> > > of_device_get_match_data() can never return NULL, therefore the check > for NULL values is unnecessary. > > Signed-off-by: Thierry Reding <treding@nvidia.com> > --- > drivers/gpio/gpio-tegra.c | 11 ++--------- > 1 file changed, 2 insertions(+), 9 deletions(-) > > diff --git a/drivers/gpio/gpio-tegra.c b/drivers/gpio/gpio-tegra.c > index 17725c83821f..63ee221f9be9 100644 > --- a/drivers/gpio/gpio-tegra.c > +++ b/drivers/gpio/gpio-tegra.c > @@ -566,7 +566,6 @@ static struct lock_class_key gpio_lock_class; > > static int tegra_gpio_probe(struct platform_device *pdev) > { > - const struct tegra_gpio_soc_config *config; > struct tegra_gpio_info *tgi; > struct resource *res; > struct tegra_gpio_bank *bank; > @@ -575,17 +574,11 @@ static int tegra_gpio_probe(struct platform_device *pdev) > int i; > int j; > > - config = of_device_get_match_data(&pdev->dev); > - if (!config) { > - dev_err(&pdev->dev, "Error: No device match found\n"); > - return -ENODEV; > - } > - > tgi = devm_kzalloc(&pdev->dev, sizeof(*tgi), GFP_KERNEL); > if (!tgi) > return -ENODEV; > > - tgi->soc = config; > + tgi->soc = of_device_get_match_data(&pdev->dev); > tgi->dev = &pdev->dev; > > ret = platform_irq_count(pdev); > @@ -625,7 +618,7 @@ static int tegra_gpio_probe(struct platform_device *pdev) > > platform_set_drvdata(pdev, tgi); > > - if (config->debounce_supported) > + if (tgi->soc->debounce_supported) > tgi->gc.set_config = tegra_gpio_set_config; > > tgi->bank_info = devm_kzalloc(&pdev->dev, tgi->bank_count * Acked-by: Jon Hunter <jonathanh@nvidia.com> Cheers Jon
On Mon, Jul 24, 2017 at 04:55:05PM +0200, Thierry Reding wrote: > From: Thierry Reding <treding@nvidia.com> > > of_device_get_match_data() can never return NULL, therefore the check > for NULL values is unnecessary. > > Signed-off-by: Thierry Reding <treding@nvidia.com> > --- > drivers/gpio/gpio-tegra.c | 11 ++--------- > 1 file changed, 2 insertions(+), 9 deletions(-) Hi Linus, any comments on this? I've got an updated series for the GPIO IRQ chip stuff and another set of patches for banked controller support, but I'd like to flush out all of these minor patches that are byproducts of the other work. Thierry
On Mon, Jul 24, 2017 at 4:55 PM, Thierry Reding <thierry.reding@gmail.com> wrote: > From: Thierry Reding <treding@nvidia.com> > > of_device_get_match_data() can never return NULL, therefore the check > for NULL values is unnecessary. > > Signed-off-by: Thierry Reding <treding@nvidia.com> Patch applied with Jon's ACK. Yours, Linus Walleij -- To unsubscribe from this list: send the line "unsubscribe linux-tegra" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
diff --git a/drivers/gpio/gpio-tegra.c b/drivers/gpio/gpio-tegra.c index 17725c83821f..63ee221f9be9 100644 --- a/drivers/gpio/gpio-tegra.c +++ b/drivers/gpio/gpio-tegra.c @@ -566,7 +566,6 @@ static struct lock_class_key gpio_lock_class; static int tegra_gpio_probe(struct platform_device *pdev) { - const struct tegra_gpio_soc_config *config; struct tegra_gpio_info *tgi; struct resource *res; struct tegra_gpio_bank *bank; @@ -575,17 +574,11 @@ static int tegra_gpio_probe(struct platform_device *pdev) int i; int j; - config = of_device_get_match_data(&pdev->dev); - if (!config) { - dev_err(&pdev->dev, "Error: No device match found\n"); - return -ENODEV; - } - tgi = devm_kzalloc(&pdev->dev, sizeof(*tgi), GFP_KERNEL); if (!tgi) return -ENODEV; - tgi->soc = config; + tgi->soc = of_device_get_match_data(&pdev->dev); tgi->dev = &pdev->dev; ret = platform_irq_count(pdev); @@ -625,7 +618,7 @@ static int tegra_gpio_probe(struct platform_device *pdev) platform_set_drvdata(pdev, tgi); - if (config->debounce_supported) + if (tgi->soc->debounce_supported) tgi->gc.set_config = tegra_gpio_set_config; tgi->bank_info = devm_kzalloc(&pdev->dev, tgi->bank_count *