LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Philipp Zabel <p.zabel@pengutronix.de>
To: Horatiu Vultur <horatiu.vultur@microchip.com>,
	davem@davemloft.net, kuba@kernel.org, robh+dt@kernel.org,
	UNGLinuxDriver@microchip.com, linux@armlinux.org.uk,
	andrew@lunn.ch, netdev@vger.kernel.org,
	devicetree@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH net-next v4 2/6] net: lan966x: add the basic lan966x driver
Date: Fri, 26 Nov 2021 11:19:05 +0100	[thread overview]
Message-ID: <65e4c9936f95a23ad56498ac198fd4df35eb8fd6.camel@pengutronix.de> (raw)
In-Reply-To: <20211126090540.3550913-3-horatiu.vultur@microchip.com>

Hi Horatiu,

On Fri, 2021-11-26 at 10:05 +0100, Horatiu Vultur wrote:
[...]
> +static int lan966x_reset_switch(struct lan966x *lan966x)
> +{
> +	struct reset_control *reset;
> +	int val = 0;
> +	int ret;
> +
> +	reset = devm_reset_control_get_shared(lan966x->dev, "switch");
> +	if (IS_ERR(reset))
> +		return dev_err_probe(lan966x->dev, PTR_ERR(reset),
> +				     "Could not obtain switch reset");
> +	reset_control_reset(reset);
> +
> +	reset = devm_reset_control_get_shared(lan966x->dev, "phy");
> +	if (IS_ERR(reset))
> +		return dev_err_probe(lan966x->dev, PTR_ERR(reset),
> +				     "Could not obtain phy reset\n");
> +	reset_control_reset(reset);

In general, please request all resources before activating the hardware.
Here I'd request both reset controls first and only then trigger them.
That way a failure to optain the phy reset won't cause an unnecessary
switch reset.

[...]
> +static int lan966x_remove(struct platform_device *pdev)
> +{
> +	return 0;
> +}

If there is nothing to do here, this function can be removed altogether.

regards
Philipp

  reply	other threads:[~2021-11-26 10:31 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-26  9:05 [PATCH net-next v4 0/6] net: lan966x: Add lan966x switch driver Horatiu Vultur
2021-11-26  9:05 ` [PATCH net-next v4 1/6] dt-bindings: net: lan966x: Add lan966x-switch bindings Horatiu Vultur
2021-11-28 23:40   ` Rob Herring
2021-11-29 10:55     ` Horatiu Vultur
2021-11-26  9:05 ` [PATCH net-next v4 2/6] net: lan966x: add the basic lan966x driver Horatiu Vultur
2021-11-26 10:19   ` Philipp Zabel [this message]
2021-11-26  9:05 ` [PATCH net-next v4 3/6] net: lan966x: add port module support Horatiu Vultur
2021-11-26 11:04   ` Russell King (Oracle)
2021-11-29 11:08     ` Horatiu Vultur
2021-11-26 18:12   ` Jakub Kicinski
2021-11-29 10:59     ` Horatiu Vultur
2021-11-26  9:05 ` [PATCH net-next v4 4/6] net: lan966x: add mactable support Horatiu Vultur
2021-11-26  9:05 ` [PATCH net-next v4 5/6] net: lan966x: add ethtool configuration and statistics Horatiu Vultur
2021-11-26  9:05 ` [PATCH net-next v4 6/6] net: lan966x: Update MAINTAINERS to include lan966x driver Horatiu Vultur

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=65e4c9936f95a23ad56498ac198fd4df35eb8fd6.camel@pengutronix.de \
    --to=p.zabel@pengutronix.de \
    --cc=UNGLinuxDriver@microchip.com \
    --cc=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=devicetree@vger.kernel.org \
    --cc=horatiu.vultur@microchip.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=netdev@vger.kernel.org \
    --cc=robh+dt@kernel.org \
    --subject='Re: [PATCH net-next v4 2/6] net: lan966x: add the basic lan966x driver' \
    /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

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).