Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 5cacbfa9 authored by Jingoo Han's avatar Jingoo Han Committed by David Woodhouse
Browse files

mtd: dataflash: use spi_get_drvdata() and spi_set_drvdata()



Use the wrapper functions for getting and setting the driver data using
spi_device instead of using dev_{get|set}_drvdata with &spi->dev, so we
can directly pass a struct spi_device.

Signed-off-by: default avatarJingoo Han <jg1.han@samsung.com>
Signed-off-by: default avatarArtem Bityutskiy <artem.bityutskiy@linux.intel.com>
Signed-off-by: default avatarDavid Woodhouse <David.Woodhouse@intel.com>
parent 1594908a
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -661,7 +661,7 @@ static int add_dataflash_otp(struct spi_device *spi, char *name, int nr_pages,
	dev_info(&spi->dev, "%s (%lld KBytes) pagesize %d bytes%s\n",
			name, (long long)((device->size + 1023) >> 10),
			pagesize, otp_tag);
	dev_set_drvdata(&spi->dev, priv);
	spi_set_drvdata(spi, priv);

	ppdata.of_node = spi->dev.of_node;
	err = mtd_device_parse_register(device, NULL, &ppdata,
@@ -671,7 +671,7 @@ static int add_dataflash_otp(struct spi_device *spi, char *name, int nr_pages,
	if (!err)
		return 0;

	dev_set_drvdata(&spi->dev, NULL);
	spi_set_drvdata(spi, NULL);
	kfree(priv);
	return err;
}
@@ -895,14 +895,14 @@ static int dataflash_probe(struct spi_device *spi)

static int dataflash_remove(struct spi_device *spi)
{
	struct dataflash	*flash = dev_get_drvdata(&spi->dev);
	struct dataflash	*flash = spi_get_drvdata(spi);
	int			status;

	pr_debug("%s: remove\n", dev_name(&spi->dev));

	status = mtd_device_unregister(&flash->mtd);
	if (status == 0) {
		dev_set_drvdata(&spi->dev, NULL);
		spi_set_drvdata(spi, NULL);
		kfree(flash);
	}
	return status;