From: Pavel Machek <pavel@ucw.cz>
To: Marek Beh??n <marek.behun@nic.cz>
Cc: netdev@vger.kernel.org, linux-leds@vger.kernel.org,
Dan Murphy <dmurphy@ti.com>, Ond??ej Jirman <megous@megous.com>,
Russell King <linux@armlinux.org.uk>,
Andrew Lunn <andrew@lunn.ch>,
linux-kernel@vger.kernel.org,
Matthias Schiffer <matthias.schiffer@ew.tq-group.com>
Subject: Re: [PATCH net-next v1 2/3] net: phy: add API for LEDs controlled by ethernet PHY chips
Date: Sun, 4 Oct 2020 11:58:53 +0200 [thread overview]
Message-ID: <20201004095852.GB1104@bug> (raw)
In-Reply-To: <20200908000300.6982-3-marek.behun@nic.cz>
Hi!
> Many an ethernet PHY supports various HW control modes for LEDs
> connected directly to the PHY chip.
>
> This patch adds code for registering such LEDs when described in device
> tree and also adds a new private LED trigger called phydev-hw-mode.
> When this trigger is enabled for a LED, the various HW control modes
> which are supported by the PHY for given LED cat be get/set via hw_mode
> sysfs file.
>
> A PHY driver wishing to utilize this API needs to implement all the
> methods in the phy_device_led_ops structure.
>
> Signed-off-by: Marek Beh??n <marek.behun@nic.cz>
> select MDIO_I2C
>
> +config PHY_LEDS
> + bool
> + default y if LEDS_TRIGGERS
> +
> comment "MII PHY device drivers"
>
> config AMD_PHY
> +/* drivers/net/phy/phy_hw_led_mode.c
> + *
Stale comment.
> + init_data.fwnode = &np->fwnode;
> + init_data.devname_mandatory = true;
> + snprintf(devicename, sizeof(devicename), "phy%d", phydev->phyindex);
> + init_data.devicename = devicename;
> +
> + ret = phydev->led_ops->led_init(phydev, led, &pdata);
> + if (ret < 0)
> + goto err_free;
> +
> + ret = devm_led_classdev_register_ext(&phydev->mdio.dev, &led->cdev, &init_data);
> + if (ret < 0)
> + goto err_free;
> +
> + led->flags |= PHY_DEVICE_LED_REGISTERED;
> +
> + return 0;
> +err_free:
> + devm_kfree(&phydev->mdio.dev, led);
> + return ret;
devm should take care of freeing, right?
Plus, format comments to 80 colums. checkpatch no longer warns, but rule still exists.
Best regards,
Pavel
--
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
next prev parent reply other threads:[~2020-10-04 9:58 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-08 0:02 [PATCH net-next v1 0/3] Add support for LEDs on Marvell PHYs Marek Behún
2020-09-08 0:02 ` [PATCH net-next v1 1/3] dt-bindings: net: ethernet-phy: add description for PHY LEDs Marek Behún
2020-09-08 22:02 ` Marek Behun
2020-09-08 22:03 ` Marek Behun
2020-09-08 0:02 ` [PATCH net-next v1 2/3] net: phy: add API for LEDs controlled by ethernet PHY chips Marek Behún
2020-09-10 2:27 ` kernel test robot
2020-10-04 9:58 ` Pavel Machek [this message]
2020-09-08 0:03 ` [PATCH net-next v1 3/3] net: phy: marvell: add support for LEDs controlled by Marvell PHYs Marek Behún
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=20201004095852.GB1104@bug \
--to=pavel@ucw.cz \
--cc=andrew@lunn.ch \
--cc=dmurphy@ti.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-leds@vger.kernel.org \
--cc=linux@armlinux.org.uk \
--cc=marek.behun@nic.cz \
--cc=matthias.schiffer@ew.tq-group.com \
--cc=megous@megous.com \
--cc=netdev@vger.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 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).