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] [day] [month] [year] [list]
Message-ID: <70db8ad7-ba2e-ac08-492c-b2117c3235e5@linaro.org>
Date:   Sun, 24 Apr 2022 13:12:01 +0200
From:   Krzysztof Kozlowski <krzysztof.kozlowski@...aro.org>
To:     Jonathan Bakker <xc-racer2@...e.ca>,
        Miquel Raynal <miquel.raynal@...tlin.com>
Cc:     Kyungmin Park <kyungmin.park@...sung.com>,
        Richard Weinberger <richard@....at>,
        Vignesh Raghavendra <vigneshr@...com>,
        linux-mtd@...ts.infradead.org, linux-kernel@...r.kernel.org,
        linux-samsung-soc@...r.kernel.org,
        Tomasz Figa <tomasz.figa@...il.com>,
        Paweł Chmiel <pawel.mikolaj.chmiel@...il.com>
Subject: Re: [PATCH 5/5] mtd: onenand: samsung: Add device tree support

On 23/04/2022 05:46, Jonathan Bakker wrote:
> From: Tomasz Figa <tomasz.figa@...il.com>
> 
> This patch adds support for instantation using Device Tree.
> 
> Signed-off-by: Tomasz Figa <tomasz.figa@...il.com>
> Signed-off-by: Paweł Chmiel <pawel.mikolaj.chmiel@...il.com>
> Signed-off-by: Jonathan Bakker <xc-racer2@...e.ca>
> 
> ---
> Changes from previous patchset
> - Adjust to having a nand child node as per binding feedback
> ---
>  drivers/mtd/nand/onenand/onenand_samsung.c | 67 +++++++++++++++++++++-
>  1 file changed, 65 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/mtd/nand/onenand/onenand_samsung.c b/drivers/mtd/nand/onenand/onenand_samsung.c
> index 62014f8d27b6..0108c8c75d5b 100644
> --- a/drivers/mtd/nand/onenand/onenand_samsung.c
> +++ b/drivers/mtd/nand/onenand/onenand_samsung.c
> @@ -22,6 +22,7 @@
>  #include <linux/dma-mapping.h>
>  #include <linux/interrupt.h>
>  #include <linux/io.h>
> +#include <linux/of.h>
>  
>  #include "samsung.h"
>  
> @@ -832,8 +833,36 @@ static void s3c_onenand_setup(struct mtd_info *mtd)
>  	this->write_bufferram = onenand_write_bufferram;
>  }
>  
> +#ifdef CONFIG_OF
> +static const struct of_device_id s3c_onenand_of_match[] = {
> +	{ .compatible = "samsung,s3c6400-onenand",
> +		.data = (void *)TYPE_S3C6400 },
> +	{ .compatible = "samsung,s3c6410-onenand",
> +		.data = (void *)TYPE_S3C6410 },
> +	{ .compatible = "samsung,s5pv210-onenand",
> +		.data = (void *)TYPE_S5PC110 },
> +	{},
> +};
> +MODULE_DEVICE_TABLE(of, onenand_s3c_dt_match);
> +#endif
> +
> +static enum soc_type s3c_onenand_get_device_id(struct platform_device *pdev)
> +{
> +	struct device_node *np = pdev->dev.of_node;
> +
> +	if (IS_ENABLED(CONFIG_OF) && np) {
> +		const struct of_device_id *match;
> +
> +		match = of_match_node(s3c_onenand_of_match, np);
> +		return (enum soc_type)match->data;
> +	}

This can be simpler:

if (dev_of_node(&pdev->dev))
	return of_device_get_match_data(&pdev->dev);

This allows you to put the of_device_id table in usual place, so just
before the platform_driver structure.

> +
> +	return platform_get_device_id(pdev)->driver_data;
> +}
> +
>  static int s3c_onenand_probe(struct platform_device *pdev)
>  {
> +	struct device_node *np = pdev->dev.of_node;

dev_of_node()


Best regards,
Krzysztof

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ