Re: [PATCH net-next v4 2/6] net: lan966x: add the basic lan966x driver

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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



[Index of Archives]     [Device Tree Compilter]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux PCI Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Yosemite Backpacking]


  Powered by Linux