lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1dc56a84-771a-478c-b302-769186d6497e@lunn.ch>
Date: Tue, 30 Apr 2024 22:51:52 +0200
From: Andrew Lunn <andrew@...n.ch>
To: FUJITA Tomonori <fujita.tomonori@...il.com>
Cc: netdev@...r.kernel.org, jiri@...nulli.us, horms@...nel.org
Subject: Re: [PATCH net-next v3 5/6] net: tn40xx: add mdio bus support

> diff --git a/drivers/net/ethernet/tehuti/tn40.h b/drivers/net/ethernet/tehuti/tn40.h
> index a93b83e343d3..2719a31fe86c 100644
> --- a/drivers/net/ethernet/tehuti/tn40.h
> +++ b/drivers/net/ethernet/tehuti/tn40.h
> @@ -11,6 +11,7 @@
>  #include <linux/if_vlan.h>
>  #include <linux/in.h>
>  #include <linux/interrupt.h>
> +#include <linux/iopoll.h>
>  #include <linux/ip.h>
>  #include <linux/module.h>
>  #include <linux/netdevice.h>

> +++ b/drivers/net/ethernet/tehuti/tn40_mdio.c
> @@ -0,0 +1,132 @@
> +// SPDX-License-Identifier: GPL-2.0+
> +/* Copyright (c) Tehuti Networks Ltd. */
> +
> +#include "tn40.h"
> +

Part of the reason we want to see includes here, and not in a .h file
is that you are including lots of things which an MDIO driver does not
need. That slows down the build.

> +static void tn40_mdio_set_speed(struct tn40_priv *priv, u32 speed)
> +{
> +	void __iomem *regs = priv->regs;
> +	int mdio_cfg;
> +
> +	mdio_cfg = readl(regs + TN40_REG_MDIO_CMD_STAT);
> +	if (speed == 1)
> +		mdio_cfg = (0x7d << 7) | 0x08;	/* 1MHz */
> +	else
> +		mdio_cfg = 0xA08;	/* 6MHz */
> +	mdio_cfg |= (1 << 6);

Is there any documentation about these bits? 

> +static int tn40_mdio_get(struct tn40_priv *priv, u32 *val)
> +{
> +	u32 stat;
> +	int ret;
> +
> +	ret = readx_poll_timeout_atomic(tn40_mdio_stat, priv, stat,
> +					TN40_GET_MDIO_BUSY(stat) == 0, 10,
> +					10000);
> +	return ret;

You don't need the ret variable. Just:

	return readx_poll_timeout_atomic(...);

	Andrew

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ