From: Kurt Kanzenbach <kurt@linutronix.de>
To: Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: Andrew Lunn <andrew@lunn.ch>,
Vivien Didelot <vivien.didelot@gmail.com>,
Florian Fainelli <f.fainelli@gmail.com>,
Vladimir Oltean <olteanv@gmail.com>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>
Subject: Re: [PATCH net-next v1 1/1] net: dsa: hellcreek: Get rid of custom led_init_default_state_get()
Date: Wed, 03 Aug 2022 07:35:25 +0200 [thread overview]
Message-ID: <87h72tga8y.fsf@kurt> (raw)
In-Reply-To: <20220802212144.6743-1-andriy.shevchenko@linux.intel.com>
[-- Attachment #1: Type: text/plain, Size: 2820 bytes --]
On Wed Aug 03 2022, Andy Shevchenko wrote:
> LED core provides a helper to parse default state from firmware node.
> Use it instead of custom implementation.
>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> ---
> drivers/net/dsa/hirschmann/hellcreek_ptp.c | 45 ++++++++++++----------
> 1 file changed, 24 insertions(+), 21 deletions(-)
>
> diff --git a/drivers/net/dsa/hirschmann/hellcreek_ptp.c b/drivers/net/dsa/hirschmann/hellcreek_ptp.c
> index b28baab6d56a..793b2c296314 100644
> --- a/drivers/net/dsa/hirschmann/hellcreek_ptp.c
> +++ b/drivers/net/dsa/hirschmann/hellcreek_ptp.c
> @@ -297,7 +297,8 @@ static enum led_brightness hellcreek_led_is_gm_get(struct led_classdev *ldev)
> static int hellcreek_led_setup(struct hellcreek *hellcreek)
> {
> struct device_node *leds, *led = NULL;
> - const char *label, *state;
> + enum led_default_state state;
> + const char *label;
> int ret = -EINVAL;
>
> of_node_get(hellcreek->dev->of_node);
> @@ -318,16 +319,17 @@ static int hellcreek_led_setup(struct hellcreek *hellcreek)
> ret = of_property_read_string(led, "label", &label);
> hellcreek->led_sync_good.name = ret ? "sync_good" : label;
>
> - ret = of_property_read_string(led, "default-state", &state);
> - if (!ret) {
> - if (!strcmp(state, "on"))
> - hellcreek->led_sync_good.brightness = 1;
> - else if (!strcmp(state, "off"))
> - hellcreek->led_sync_good.brightness = 0;
> - else if (!strcmp(state, "keep"))
> - hellcreek->led_sync_good.brightness =
> - hellcreek_get_brightness(hellcreek,
> - STATUS_OUT_SYNC_GOOD);
> + state = led_init_default_state_get(of_fwnode_handle(led));
Applied your patch to net-next/master and this yields:
|drivers/net/dsa/hirschmann/hellcreek_ptp.c: In function ‘hellcreek_led_setup’:
|drivers/net/dsa/hirschmann/hellcreek_ptp.c:430:10: error: implicit declaration of function ‘led_init_default_state_get’; did you mean ‘led_get_default_pattern’? [-Werror=implicit-function-declaration]
| 430 | state = led_init_default_state_get(of_fwnode_handle(led));
| | ^~~~~~~~~~~~~~~~~~~~~~~~~~
| | led_get_default_pattern
The header is missing:
|diff --git a/drivers/net/dsa/hirschmann/hellcreek_ptp.c b/drivers/net/dsa/hirschmann/hellcreek_ptp.c
|index df339f3e1803..430f39172d58 100644
|--- a/drivers/net/dsa/hirschmann/hellcreek_ptp.c
|+++ b/drivers/net/dsa/hirschmann/hellcreek_ptp.c
|@@ -14,6 +14,8 @@
| #include "hellcreek_ptp.h"
| #include "hellcreek_hwtstamp.h"
|
|+#include "../../../leds/leds.h"
|+
| u16 hellcreek_ptp_read(struct hellcreek *hellcreek, unsigned int offset)
| {
| return readw(hellcreek->ptp_base + offset);
Maybe move led_init_default_state_get() to linux/leds.h?
Thanks,
Kurt
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 861 bytes --]
next prev parent reply other threads:[~2022-08-03 5:35 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-08-02 21:21 [PATCH net-next v1 1/1] net: dsa: hellcreek: Get rid of custom led_init_default_state_get() Andy Shevchenko
2022-08-03 5:35 ` Kurt Kanzenbach [this message]
2022-08-03 11:24 ` 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=87h72tga8y.fsf@kurt \
--to=kurt@linutronix.de \
--cc=andrew@lunn.ch \
--cc=andriy.shevchenko@linux.intel.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=f.fainelli@gmail.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=olteanv@gmail.com \
--cc=pabeni@redhat.com \
--cc=vivien.didelot@gmail.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).