mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Guenter Roeck <linux@roeck-us.net>
To: 吳梓豪 <tzuhao.wtmh@gmail.com>
Cc: Krzysztof Kozlowski <krzk@kernel.org>,
	Rob Herring <robh@kernel.org>,
	Krzysztof Kozlowski <krzk+dt@kernel.org>,
	Conor Dooley <conor+dt@kernel.org>,
	Jean Delvare <jdelvare@suse.com>,
	Jonathan Corbet <corbet@lwn.net>,
	Jonathan Cameron <Jonathan.Cameron@huawei.com>,
	Naresh Solanki <naresh.solanki@9elements.com>,
	Rodrigo Gobbi <rodrigo.gobbi.7@gmail.com>,
	Michal Simek <michal.simek@amd.com>,
	Fabio Estevam <festevam@gmail.com>,
	Henry Wu <Henry_Wu@quantatw.com>,
	Grant Peltier <grantpeltier93@gmail.com>,
	Laurent Pinchart <laurent.pinchart@ideasonboard.com>,
	Cedric Encarnacion <cedricjustine.encarnacion@analog.com>,
	Kim Seer Paller <kimseer.paller@analog.com>,
	Leo Yang <leo.yang.sy0@gmail.com>,
	Ninad Palsule <ninad@linux.ibm.com>,
	Alex Vdovydchenko <xzeol@yahoo.com>,
	John Erasmus Mari Geronimo <johnerasmusmari.geronimo@analog.com>,
	Nuno Sa <nuno.sa@analog.com>,
	Jerome Brunet <jbrunet@baylibre.com>,
	Noah Wang <noahwang.wang@outlook.com>,
	Mariel Tinaco <Mariel.Tinaco@analog.com>,
	devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-hwmon@vger.kernel.org, linux-doc@vger.kernel.org
Subject: Re: [PATCH 1/2] hwmon: (pmbus) Add support for MPS multi-phase mp2869a/mp29612a controllers
Date: Wed, 25 Jun 2025 06:11:11 -0700	[thread overview]
Message-ID: <331d77c4-fa53-4d3b-a17e-22481bf72d32@roeck-us.net> (raw)
In-Reply-To: <CAL3H=v3s6H4ZpnS=EhPrpEiu-9N-xFCkunHuwWW0xnkXbzY9Kg@mail.gmail.com>

On Wed, Jun 25, 2025 at 02:31:02PM +0800, 吳梓豪 wrote:
> Krzysztof Kozlowski <krzk@kernel.org> 於 2025年6月24日 週二 下午3:48寫道:
> >
> > On 24/06/2025 09:41, tzuhao.wtmh@gmail.com wrote:
> > > +static int
> > > +MP2869A_read_byte_data(struct i2c_client *client, int page, int reg)
> > > +{
> > > +     switch (reg) {
> > > +     case PMBUS_VOUT_MODE:
> > > +             /* Enforce VOUT direct format. */
> > > +             return PB_VOUT_MODE_DIRECT;
> > > +     default:
> > > +             return -ENODATA;
> > > +     }
> > > +}
> > > +
> > > +static int
> > > +MP2869A_identify_vout_format(struct i2c_client *client,
> >
> > Use Linux coding style, so lowercase for variables, types and functions.
> > Everywhere (except when coding style tells you different, so please read
> > it).
> >
> > > +                         struct MP2869A_data *data)
> > > +{
> > > +     int i, ret;
> > > +
> > > +     for (i = 0; i < data->info.pages; i++) {
> > > +             ret = i2c_smbus_write_byte_data(client, PMBUS_PAGE, i);
> > > +             if (ret < 0)
> > > +                     return ret;
> > > +
> > > +             ret = i2c_smbus_read_word_data(client, MP2869A_VOUT_MODE);
> > > +             if (ret < 0)
> > > +                     return ret;
> > > +
> > > +             switch (ret & MP2869A_VOUT_MODE_MASK) {
> > > +             case MP2869A_VOUT_MODE_VID:
> > > +                     data->vout_format[i] = vid;
> > > +                     break;
> > > +             default:
> > > +             return -EINVAL;
> > > +             }
> > > +             }
> >
> > Messed indentation in multiple places.
> >
> > > +     return 0;
> > > +}
> > > +
> > > +static struct pmbus_driver_info MP2869A_info = {
> >
> > This is const.
> Since info will be modified by mp2869a_read_vout at runtime, I chose
> not to make it constant

That is a no-go. There can be multiple instances of the chip in a system,
each requiring its own info data structure. If the structure is modified
at runtime it needs to be copied first.

Guenter

  parent reply	other threads:[~2025-06-25 13:11 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-24  7:41 tzuhao.wtmh
2025-06-24  7:41 ` [PATCH 2/2] dt-bindings: trivial-devices: Add mp2869a/mp29612a device entry tzuhao.wtmh
2025-06-24  7:44   ` Krzysztof Kozlowski
2025-06-24  7:48 ` [PATCH 1/2] hwmon: (pmbus) Add support for MPS multi-phase mp2869a/mp29612a controllers Krzysztof Kozlowski
2025-06-25  6:31   ` 吳梓豪
2025-06-25  8:08     ` Krzysztof Kozlowski
2025-06-25 13:11     ` Guenter Roeck [this message]
2025-06-24 20:10 ` kernel test robot

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=331d77c4-fa53-4d3b-a17e-22481bf72d32@roeck-us.net \
    --to=linux@roeck-us.net \
    --cc=Henry_Wu@quantatw.com \
    --cc=Jonathan.Cameron@huawei.com \
    --cc=Mariel.Tinaco@analog.com \
    --cc=cedricjustine.encarnacion@analog.com \
    --cc=conor+dt@kernel.org \
    --cc=corbet@lwn.net \
    --cc=devicetree@vger.kernel.org \
    --cc=festevam@gmail.com \
    --cc=grantpeltier93@gmail.com \
    --cc=jbrunet@baylibre.com \
    --cc=jdelvare@suse.com \
    --cc=johnerasmusmari.geronimo@analog.com \
    --cc=kimseer.paller@analog.com \
    --cc=krzk+dt@kernel.org \
    --cc=krzk@kernel.org \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=leo.yang.sy0@gmail.com \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-hwmon@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=michal.simek@amd.com \
    --cc=naresh.solanki@9elements.com \
    --cc=ninad@linux.ibm.com \
    --cc=noahwang.wang@outlook.com \
    --cc=nuno.sa@analog.com \
    --cc=robh@kernel.org \
    --cc=rodrigo.gobbi.7@gmail.com \
    --cc=tzuhao.wtmh@gmail.com \
    --cc=xzeol@yahoo.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®