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: Jingoo Han <jg1.han@samsung.com> Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com> Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
This commit is contained in:
Родитель
1594908ac0
Коммит
5cacbfa9fe
|
@ -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;
|
||||
|
|
Загрузка…
Ссылка в новой задаче