All of lore.kernel.org
 help / color / mirror / Atom feed
From: andy.shevchenko@gmail.com
To: Okan Sahin <okan.sahin@analog.com>
Cc: Linus Walleij <linus.walleij@linaro.org>,
	Bartosz Golaszewski <brgl@bgdev.pl>,
	Rob Herring <robh+dt@kernel.org>,
	Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>,
	linux-gpio@vger.kernel.org, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 2/2] gpio: ds4520: Add ADI DS4520 GPIO Expander Support
Date: Tue, 2 May 2023 18:55:04 +0300	[thread overview]
Message-ID: <ZFEyWH9PmtJIyeCK@surfacebook> (raw)
In-Reply-To: <20230501230517.4491-3-okan.sahin@analog.com>

Tue, May 02, 2023 at 02:05:16AM +0300, Okan Sahin kirjoitti:
> The DS4520 is a 9-bit nonvolatile (NV) I/O expander.
> It offers users a digitally programmable alternative
> to hardware jumpers and mechanical switches that are
> being used to control digital logic node.

...

> +#include <linux/device.h>
> +#include <linux/gpio/driver.h>
> +#include <linux/gpio/regmap.h>
> +#include <linux/i2c.h>

Missing property.h.

> +#include <linux/regmap.h>

...

> +#define NUMBER_OF_GPIO	9
> +
> +#define PULLUP0		0xF0
> +#define IO_CONTROL0	0xF2
> +#define IO_STATUS0	0xF8

No namespace for the above?

...

> +	struct gpio_regmap_config config = {0};

0 is not needed.

> +	ngpio = NUMBER_OF_GPIO;

Do you really need this? Can Device Tree be sufficient here? (We have a
GPIO-wide property for that).

...

> +	ret = device_property_read_u32(dev, "reg", &base);
> +	if (ret)
> +		return -EINVAL;

Why shadowing error?

...

> +	regmap = devm_regmap_init_i2c(client, &ds4520_regmap_config);
> +	if (IS_ERR(regmap)) {

> +		ret = PTR_ERR(regmap);
> +		dev_err_probe(dev, ret,
> +			      "Failed to allocate register map\n");
> +		return ret;

	return dev_err_probe();

> +	}

...

> +	config.ngpio = ngpio;

Why do you use temporary variable ngpio and not assign directly here?

-- 
With Best Regards,
Andy Shevchenko



      parent reply	other threads:[~2023-05-02 15:55 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-01 23:05 [PATCH v2 0/2] Add DS4520 GPIO Expander Support Okan Sahin
2023-05-01 23:05 ` [PATCH v2 1/2] dt-bindings: gpio: ds4520: Add ADI DS4520 Okan Sahin
2023-05-02  6:53   ` Krzysztof Kozlowski
2023-05-02 13:32   ` Linus Walleij
2023-05-01 23:05 ` [PATCH v2 2/2] gpio: ds4520: Add ADI DS4520 GPIO Expander Support Okan Sahin
2023-05-02  8:44   ` Michael Walle
2023-05-02 13:50     ` Linus Walleij
2023-05-02 15:55   ` andy.shevchenko [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ZFEyWH9PmtJIyeCK@surfacebook \
    --to=andy.shevchenko@gmail.com \
    --cc=brgl@bgdev.pl \
    --cc=devicetree@vger.kernel.org \
    --cc=krzysztof.kozlowski+dt@linaro.org \
    --cc=linus.walleij@linaro.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=okan.sahin@analog.com \
    --cc=robh+dt@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.