[PATCH v5 1/6] nand: spi: add basic blocks for infrastructure

Boris Brezillon boris.brezillon at free-electrons.com
Tue Apr 18 00:29:40 PDT 2017


On Mon, 10 Apr 2017 15:51:48 +0800
Peter Pan <peterpandong at micron.com> wrote:

> +/*
> + * spinand_alloc - [SPI NAND Interface] allocate SPI NAND device instance
> + * @dev: pointer to device model structure
> + */
> +struct spinand_device *spinand_alloc(struct device *dev)

Since you're using devm_kzalloc() here, can we rename the function
devm_spinand_alloc()?

> +{
> +	struct spinand_device *chip;
> +	struct mtd_info *mtd;
> +
> +	chip = devm_kzalloc(dev, sizeof(*chip), GFP_KERNEL);
> +	if (!chip)
> +		return ERR_PTR(-ENOMEM);
> +
> +	spinand_set_of_node(chip, dev->of_node);
> +	mutex_init(&chip->lock);
> +	chip->dev = dev;
> +	mtd = spinand_to_mtd(chip);
> +	mtd->dev.parent = dev;
> +
> +	return chip;
> +}
> +EXPORT_SYMBOL_GPL(spinand_alloc);



More information about the linux-mtd mailing list