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: <CAH6sp9OcFXcX6vgkPPJqCE-X1_fKPOBo0Ak2g=pWiWPZuCt5Yg@mail.gmail.com>
Date:	Fri, 8 May 2015 12:14:40 +0200
From:	Frans Klaver <fransklaver@...il.com>
To:	Bert Vermeulen <bert@...t.com>
Cc:	David Woodhouse <dwmw2@...radead.org>,
	Brian Norris <computersforpeace@...il.com>,
	linux-mtd@...ts.infradead.org,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v2] nand: Add NAND driver for Mikrotik RB4xx series boards

On Thu, May 7, 2015 at 2:31 PM, Bert Vermeulen <bert@...t.com> wrote:

> +static int rb4xx_nand_probe(struct platform_device *pdev)
> +{
> +       struct device *spi_dev;
> +       struct rb4xx_nand_info  *info;
> +       struct rb4xx_cpld_platform_data *pdata;
> +       int ret;
> +
> +       /*
> +        * NAND chip is behind the CPLD on SPI bus 0 CS 1. Allow this
> +        * to silently fail the second time around.
> +        */
> +       spi_register_driver(&rb4xx_cpld_driver);
> +
> +       /*
> +        * Getting a handle on the SPI device above will fail the first time,
> +        * but should succeed whenever that driver gets probed.
> +        */
> +       spi_dev = bus_find_device_by_name(&spi_bus_type, NULL, "spi0.1");
> +       if (!spi_dev)
> +               return -EPROBE_DEFER;
> +
> +       pdata = dev_get_platdata(spi_dev);
> +       if (!pdata)
> +               return -ENODATA;
> +
> +       info = devm_kzalloc(&pdev->dev, sizeof(*info), GFP_KERNEL);
> +       if (!info)
> +               return -ENOMEM;
> +
> +       info->gpio_ale = devm_gpiod_get(&pdev->dev, "NAND ALE", GPIOD_OUT_LOW);
> +       if (IS_ERR(info->gpio_ale)) {
> +               dev_err(&pdev->dev, "unable to request gpio NAND ALE: %ld\n",
> +                       PTR_ERR(info->gpio_ale));
> +               return -ENOENT;
> +       }
> +
> +       info->gpio_cle = devm_gpiod_get(&pdev->dev, "NAND CLE", GPIOD_OUT_LOW);
> +       if (IS_ERR(info->gpio_cle)) {
> +               dev_err(&pdev->dev, "unable to request gpio NAND CLE: %ld\n",
> +                       PTR_ERR(info->gpio_cle));
> +               return -ENOENT;
> +       }
> +
> +       info->gpio_nce = devm_gpiod_get(&pdev->dev, "NAND NCE", GPIOD_OUT_LOW);
> +       if (IS_ERR(info->gpio_nce)) {
> +               dev_err(&pdev->dev, "unable to request gpio NAND NCE: %ld\n",
> +                       PTR_ERR(info->gpio_nce));
> +               return -ENOENT;
> +       }
> +
> +       /* Platform GPIO, has no device to manage it. */
> +       info->gpio_rdy = gpiod_get(NULL, "NAND RDY", GPIOD_IN);
> +       if (IS_ERR(info->gpio_rdy)) {
> +               dev_err(&pdev->dev, "unable to request gpio RDY: %ld\n",
> +                       PTR_ERR(info->gpio_rdy));
> +               return -ENOENT;
> +       }
> +
> +       info->spi_dev = container_of(spi_dev, struct spi_device, dev);
> +
> +       info->chip.priv = info;
> +       info->mtd.priv  = &info->chip;
> +       info->mtd.owner = THIS_MODULE;

If you should respin, could you add

info->mtd.dev.parent = &pdev->dev;

This will have a symlink to the parent device show up in sysfs. Seems
some people feel rather strongly about that.

Thanks,
Frans
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ