All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andy Shevchenko <andy.shevchenko@gmail.com>
To: Saravanan Sekar <sravanhome@gmail.com>
Cc: Sebastian Reichel <sre@kernel.org>,
	Lee Jones <lee.jones@linaro.org>,
	Rob Herring <robh+dt@kernel.org>,
	Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>,
	Jonathan Cameron <jic23@kernel.org>,
	Lars-Peter Clausen <lars@metafoo.de>,
	Linux PM <linux-pm@vger.kernel.org>,
	devicetree <devicetree@vger.kernel.org>,
	linux-iio <linux-iio@vger.kernel.org>
Subject: Re: [PATCH 3/6] mfd: mp2629: Add support for mps mp2733 battery charger
Date: Tue, 14 Jun 2022 18:05:52 +0200	[thread overview]
Message-ID: <CAHp75VcaU-KkCGZ0tczM6JKaVdGC6icGt0pbpC5sTf+0+ePamQ@mail.gmail.com> (raw)
In-Reply-To: <20220614151722.2194936-3-sravanhome@gmail.com>

On Tue, Jun 14, 2022 at 5:17 PM Saravanan Sekar <sravanhome@gmail.com> wrote:
>
> mp2733 is updated version of mp2629 battery charge management
> device for single-cell Li-ion or Li-polymer battery. Additionally
> supports usb fast-charge and higher range of input voltage.

...

> +#include <linux/of_device.h>

What the original code misses is the mod_devicetable.h, and also see below.

...

> +static const struct of_device_id mp2629_of_match[] = {
> +       { .compatible = "mps,mp2629", .data = (void *)CHIP_ID_MP2629 },
> +       { .compatible = "mps,mp2733", .data = (void *)CHIP_ID_MP2733 },
> +       { }
> +};
> +MODULE_DEVICE_TABLE(of, mp2629_of_match);

No need to move, see below.

...

> +static int mp2629_probe(struct i2c_client *client,
> +                       const struct i2c_device_id *id)

Why out of a sudden you moved from ->probe_new() to ->probe()?

> +       enum mp2xx_chip_id chip_id;
> +       const struct of_device_id *of_id;
>         int ret;
>
> +       if (client->dev.of_node) {
> +               of_id = of_match_device(mp2629_of_match, &client->dev);
> +               if (!of_id) {
> +                       dev_err(&client->dev, "Failed to match device\n");
> +                       return -ENODEV;
> +               }
> +               chip_id = (enum mp2xx_chip_id)of_id->data;
> +       }

This all is a single LoC only + property.h:

#include <linux/property.h>

     enum mp2xx_chip_id chip_id;

     chip_id = (uintptr_t)device_get_match_data(&client->dev);

-- 
With Best Regards,
Andy Shevchenko

  reply	other threads:[~2022-06-14 16:06 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-14 15:17 [PATCH 1/6] iio: adc: mp2629: fix wrong comparison of channel Saravanan Sekar
2022-06-14 15:17 ` [PATCH 2/6] dt-bindings: mfd: Add mp2733 compatible Saravanan Sekar
2022-06-15 22:59   ` Lee Jones
2022-06-27 13:29     ` Rob Herring
2022-06-27 14:45       ` Lee Jones
2022-06-14 15:17 ` [PATCH 3/6] mfd: mp2629: Add support for mps mp2733 battery charger Saravanan Sekar
2022-06-14 16:05   ` Andy Shevchenko [this message]
2022-06-14 18:29     ` saravanan sekar
2022-06-14 15:17 ` [PATCH 4/6] iio: adc: mp2629: restrict input voltage mask for mp2629 Saravanan Sekar
2022-06-14 16:07   ` Andy Shevchenko
2022-06-14 15:17 ` [PATCH 5/6] power: supply: Add support for mp2733 battery charger Saravanan Sekar
2022-06-14 16:12   ` Andy Shevchenko
2022-06-14 15:17 ` [PATCH 6/6] power: supply: mp2629: Add usb fast charge settings Saravanan Sekar
2022-06-14 16:13   ` Andy Shevchenko

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=CAHp75VcaU-KkCGZ0tczM6JKaVdGC6icGt0pbpC5sTf+0+ePamQ@mail.gmail.com \
    --to=andy.shevchenko@gmail.com \
    --cc=devicetree@vger.kernel.org \
    --cc=jic23@kernel.org \
    --cc=krzysztof.kozlowski+dt@linaro.org \
    --cc=lars@metafoo.de \
    --cc=lee.jones@linaro.org \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=robh+dt@kernel.org \
    --cc=sravanhome@gmail.com \
    --cc=sre@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.