From: Andrew Lunn <andrew@lunn.ch>
To: "Marek Behún" <kabel@kernel.org>
Cc: netdev@vger.kernel.org, "David S . Miller" <davem@davemloft.net>,
Russell King <rmk+kernel@armlinux.org.uk>,
kuba@kernel.org
Subject: Re: [PATCH net-next 1/5] net: phy: marvell: refactor HWMON OOP style
Date: Tue, 13 Apr 2021 16:36:35 +0200 [thread overview]
Message-ID: <YHWsc3H8RzmdfvuR@lunn.ch> (raw)
In-Reply-To: <20210413075538.30175-2-kabel@kernel.org>
> +static int marvell_hwmon_read(struct device *dev, enum hwmon_sensor_types type,
> + u32 attr, int channel, long *temp)
> {
> struct phy_device *phydev = dev_get_drvdata(dev);
> - int err;
> + const struct marvell_hwmon_ops *ops = to_marvell_hwmon_ops(phydev);
> + int err = -EOPNOTSUPP;
>
> switch (attr) {
> case hwmon_temp_input:
> - err = m88e6390_get_temp(phydev, temp);
> + if (ops->get_temp)
> + err = ops->get_temp(phydev, temp);
> + break;
> + case hwmon_temp_crit:
> + if (ops->get_temp_critical)
> + err = ops->get_temp_critical(phydev, temp);
> + break;
> + case hwmon_temp_max_alarm:
> + if (ops->get_temp_alarm)
> + err = ops->get_temp_alarm(phydev, temp);
> break;
> default:
> - return -EOPNOTSUPP;
> + fallthrough;
> + }
Does the default clause actually service any purpose?
And it is not falling through, it is falling out :-)
Andrew
next prev parent reply other threads:[~2021-04-13 14:36 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-04-13 7:55 [PATCH net-next 0/5] net: phy: marvell: some HWMON updates Marek Behún
2021-04-13 7:55 ` [PATCH net-next 1/5] net: phy: marvell: refactor HWMON OOP style Marek Behún
2021-04-13 14:26 ` kernel test robot
2021-04-13 14:36 ` Andrew Lunn [this message]
2021-04-13 15:11 ` Marek Behún
2021-04-13 7:55 ` [PATCH net-next 2/5] net: phy: marvell: fix HWMON enable register for 6390 Marek Behún
2021-04-13 14:25 ` Andrew Lunn
2021-04-13 15:12 ` Marek Behún
2021-04-13 7:55 ` [PATCH net-next 3/5] net: phy: marvell: use assignment by bitwise AND operator Marek Behún
2021-04-13 14:25 ` Andrew Lunn
2021-04-13 7:55 ` [PATCH net-next 4/5] net: dsa: mv88e6xxx: simulate Amethyst PHY model number Marek Behún
2021-04-13 14:26 ` Andrew Lunn
2021-04-13 7:55 ` [PATCH net-next 5/5] net: phy: marvell: add support for Amethyst internal PHY Marek Behún
2021-04-13 14:33 ` Andrew Lunn
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=YHWsc3H8RzmdfvuR@lunn.ch \
--to=andrew@lunn.ch \
--cc=davem@davemloft.net \
--cc=kabel@kernel.org \
--cc=kuba@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=rmk+kernel@armlinux.org.uk \
/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).