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: <20220504200726.pn7y73gt7wc2dpsg@skbuf>
Date:   Wed, 4 May 2022 23:07:26 +0300
From:   Vladimir Oltean <olteanv@...il.com>
To:     Arun Ramadoss <arun.ramadoss@...rochip.com>
Cc:     bpf@...r.kernel.org, linux-kernel@...r.kernel.org,
        devicetree@...r.kernel.org, netdev@...r.kernel.org,
        KP Singh <kpsingh@...nel.org>,
        John Fastabend <john.fastabend@...il.com>,
        Yonghong Song <yhs@...com>, Song Liu <songliubraving@...com>,
        Martin KaFai Lau <kafai@...com>,
        Andrii Nakryiko <andrii@...nel.org>,
        Daniel Borkmann <daniel@...earbox.net>,
        Alexei Starovoitov <ast@...nel.org>,
        Russell King <linux@...linux.org.uk>,
        Krzysztof Kozlowski <krzysztof.kozlowski+dt@...aro.org>,
        Woojung Huh <woojung.huh@...rochip.com>,
        UNGLinuxDriver@...rochip.com, Andrew Lunn <andrew@...n.ch>,
        Vivien Didelot <vivien.didelot@...il.com>,
        Florian Fainelli <f.fainelli@...il.com>,
        "David S. Miller" <davem@...emloft.net>,
        Eric Dumazet <edumazet@...gle.com>,
        Jakub Kicinski <kuba@...nel.org>,
        Paolo Abeni <pabeni@...hat.com>,
        Rob Herring <robh+dt@...nel.org>
Subject: Re: [Patch net-next v13 07/13] net: dsa: microchip: add LAN937x SPI
 driver

On Wed, May 04, 2022 at 08:47:49PM +0530, Arun Ramadoss wrote:
> This patch add the SPI driver for the LAN937x switches. It uses the
> lan937x_main.c and lan937x_dev.c functions.
> 
> Signed-off-by: Arun Ramadoss <arun.ramadoss@...rochip.com>
> ---
>  drivers/net/dsa/microchip/Makefile      |   1 +
>  drivers/net/dsa/microchip/ksz_common.h  |   1 +
>  drivers/net/dsa/microchip/lan937x_dev.c |   7 +
>  drivers/net/dsa/microchip/lan937x_spi.c | 236 ++++++++++++++++++++++++
>  4 files changed, 245 insertions(+)
>  create mode 100644 drivers/net/dsa/microchip/lan937x_spi.c
> 
> diff --git a/drivers/net/dsa/microchip/Makefile b/drivers/net/dsa/microchip/Makefile
> index d32ff38dc240..28d8eb62a795 100644
> --- a/drivers/net/dsa/microchip/Makefile
> +++ b/drivers/net/dsa/microchip/Makefile
> @@ -10,3 +10,4 @@ obj-$(CONFIG_NET_DSA_MICROCHIP_KSZ8863_SMI)	+= ksz8863_smi.o
>  obj-$(CONFIG_NET_DSA_MICROCHIP_LAN937X)		+= lan937x.o
>  lan937x-objs := lan937x_dev.o
>  lan937x-objs += lan937x_main.o
> +lan937x-objs += lan937x_spi.o
> diff --git a/drivers/net/dsa/microchip/ksz_common.h b/drivers/net/dsa/microchip/ksz_common.h
> index 5671f580948d..fd9e0705d2d2 100644
> --- a/drivers/net/dsa/microchip/ksz_common.h
> +++ b/drivers/net/dsa/microchip/ksz_common.h
> @@ -151,6 +151,7 @@ void ksz_switch_remove(struct ksz_device *dev);
>  int ksz8_switch_register(struct ksz_device *dev);
>  int ksz9477_switch_register(struct ksz_device *dev);
>  int lan937x_switch_register(struct ksz_device *dev);
> +int lan937x_check_device_id(struct ksz_device *dev);
>  
>  void ksz_update_port_member(struct ksz_device *dev, int port);
>  void ksz_init_mib_timer(struct ksz_device *dev);
> diff --git a/drivers/net/dsa/microchip/lan937x_dev.c b/drivers/net/dsa/microchip/lan937x_dev.c
> index 3f1797cc1d16..f430a8711775 100644
> --- a/drivers/net/dsa/microchip/lan937x_dev.c
> +++ b/drivers/net/dsa/microchip/lan937x_dev.c
> @@ -386,8 +386,15 @@ static int lan937x_mdio_register(struct ksz_device *dev)
>  
>  static int lan937x_switch_init(struct ksz_device *dev)
>  {
> +	int ret;
> +
>  	dev->ds->ops = &lan937x_switch_ops;
>  
> +	/* Check device tree */
> +	ret = lan937x_check_device_id(dev);
> +	if (ret < 0)
> +		return ret;
> +

Can't this be called from lan937x_spi_probe() directly, why do you need
to go through lan937x_switch_register() first?

>  	dev->port_mask = (1 << dev->port_cnt) - 1;
>  
>  	dev->ports = devm_kzalloc(dev->dev,

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ