Re: [PATCH v7 2/6] gpio: Add Delta TN48M CPLD GPIO driver

From: Andy Shevchenko
Date: Tue Nov 02 2021 - 15:28:18 EST


On Tue, Nov 2, 2021 at 6:57 PM Robert Marko <robert.marko@xxxxxxxxxx> wrote:
>
> Delta TN48M switch has an onboard Lattice CPLD that is used as a GPIO
> expander.
>
> The CPLD provides 12 pins in total on the TN48M, but on more advanced
> switch models it provides up to 192 pins, so the driver is extendable
> to support more switches.

...

> +static int tn48m_gpio_probe(struct platform_device *pdev)
> +{

> + const struct tn48m_gpio_config *gpio_config = NULL;
> + struct gpio_regmap_config config = {0};

I don't see a point in assigning these variables.

> + struct regmap *regmap;
> + u32 base;
> + int ret;
> +
> + if (!pdev->dev.parent)
> + return -ENODEV;
> +
> + gpio_config = device_get_match_data(&pdev->dev);
> + if (!gpio_config)
> + return -ENODEV;
> +
> + ret = device_property_read_u32(&pdev->dev, "reg", &base);
> + if (ret)
> + return ret;
> +
> + regmap = dev_get_regmap(pdev->dev.parent, NULL);
> + if (!regmap)
> + return -ENODEV;

> +}

--
With Best Regards,
Andy Shevchenko