From: Oleksij Rempel <o.rempel@pengutronix.de>
To: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Cc: "David S. Miller" <davem@davemloft.net>,
Andrew Lunn <andrew@lunn.ch>, Eric Dumazet <edumazet@google.com>,
Florian Fainelli <f.fainelli@gmail.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Vladimir Oltean <olteanv@gmail.com>,
Woojung Huh <woojung.huh@microchip.com>,
Arun Ramadoss <arun.ramadoss@microchip.com>,
Conor Dooley <conor+dt@kernel.org>,
Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>,
Rob Herring <robh+dt@kernel.org>,
devicetree@vger.kernel.org, netdev@vger.kernel.org,
"Russell King (Oracle)" <linux@armlinux.org.uk>,
linux-kernel@vger.kernel.org, kernel@pengutronix.de,
UNGLinuxDriver@microchip.com
Subject: Re: [PATCH net-next v4 2/2] net: dsa: microchip: Add drive strength configuration
Date: Tue, 12 Sep 2023 08:47:11 +0200 [thread overview]
Message-ID: <20230912064711.GE780075@pengutronix.de> (raw)
In-Reply-To: <ea39dded-7017-b6ba-8814-4722d65ba050@wanadoo.fr>
On Tue, Sep 12, 2023 at 07:22:21AM +0200, Christophe JAILLET wrote:
...
> > +static void ksz_drive_strength_error(struct ksz_device *dev,
> > + const struct ksz_drive_strength *array,
> > + size_t array_size, int milliamp)
> > +{
> > + char supported_values[100];
> > + size_t remaining_size;
> > + int added_len;
> > + char *ptr;
> > + int i;
> > +
> > + remaining_size = sizeof(supported_values);
> > + ptr = supported_values;
> > +
> > + for (i = 0; i < array_size; i++) {
> > + added_len = snprintf(ptr, remaining_size,
> > + i == 0 ? "%d" : ", %d", array[i].milliamp);
> > +
> > + if (added_len < 0 || added_len >= remaining_size)
>
> Nit: snprintf() does not return negatives value.
thx! will fix it
...
> > +static int ksz_parse_drive_strength(struct ksz_device *dev)
> > +{
> > + struct ksz_driver_strength_prop of_props[] = {
> > + [KSZ_DRIVER_STRENGTH_HI] = {
> > + .name = "microchip,hi-drive-strength-microamp",
> > + .offset = SW_HI_SPEED_DRIVE_STRENGTH_S,
> > + .value = -1
> > + },
> > + [KSZ_DRIVER_STRENGTH_LO] = {
> > + .name = "microchip,lo-drive-strength-microamp",
> > + .offset = SW_LO_SPEED_DRIVE_STRENGTH_S,
> > + .value = -1
> > + },
> > + [KSZ_DRIVER_STRENGTH_IO] = {
> > + .name = "microchip,io-drive-strength-microamp",
> > + .offset = 0, /* don't care */
> > + .value = -1
> > + },
> > + };
> > + struct device_node *np = dev->dev->of_node;
> > + bool found = false;
> > + int i, ret;
> > +
> > + for (i = 0; i < ARRAY_SIZE(of_props); i++) {
> > + ret = of_property_read_u32(np, of_props[i].name,
> > + &of_props[i].value);
> > + if (ret && ret != -EINVAL)
> > + dev_warn(dev->dev, "Failed to read %s\n",
> > + of_props[i].name);
> > + if (ret)
> > + continue;
> > +
> > + found = true;
>
> Nit: break?
No, we may have more then one property.
Regards,
Oleksij
--
Pengutronix e.K. | |
Steuerwalder Str. 21 | http://www.pengutronix.de/ |
31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
next prev parent reply other threads:[~2023-09-12 6:47 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-09-12 4:54 [PATCH net-next v4 0/2] net: dsa: microchip: add drive strength support Oleksij Rempel
2023-09-12 4:54 ` [PATCH net-next v4 1/2] dt-bindings: net: dsa: microchip: Update ksz device tree bindings for drive strength Oleksij Rempel
2023-09-13 21:46 ` Andrew Lunn
2023-09-12 4:54 ` [PATCH net-next v4 2/2] net: dsa: microchip: Add drive strength configuration Oleksij Rempel
2023-09-12 5:22 ` Christophe JAILLET
2023-09-12 6:47 ` Oleksij Rempel [this message]
2023-09-12 11:35 ` Vladimir Oltean
2023-09-12 18:38 ` Christophe JAILLET
2023-09-12 22:32 ` Vladimir Oltean
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=20230912064711.GE780075@pengutronix.de \
--to=o.rempel@pengutronix.de \
--cc=UNGLinuxDriver@microchip.com \
--cc=andrew@lunn.ch \
--cc=arun.ramadoss@microchip.com \
--cc=christophe.jaillet@wanadoo.fr \
--cc=conor+dt@kernel.org \
--cc=davem@davemloft.net \
--cc=devicetree@vger.kernel.org \
--cc=edumazet@google.com \
--cc=f.fainelli@gmail.com \
--cc=kernel@pengutronix.de \
--cc=krzysztof.kozlowski+dt@linaro.org \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@armlinux.org.uk \
--cc=netdev@vger.kernel.org \
--cc=olteanv@gmail.com \
--cc=pabeni@redhat.com \
--cc=robh+dt@kernel.org \
--cc=woojung.huh@microchip.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;
as well as URLs for NNTP newsgroup(s).