Skip to contentSkip to conversation

misc: at25: use spi_get_drvdata() and spi_set_drvdata()

PATCH New Jingoo Han 1 participant 3 messages Apr 5, 2013 Char and misc drivers

lore
Share & tools
lore

Jingoo Han

author
#0 lore raw

PATCH 1/3 misc: at25: 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.

---
 drivers/misc/eeprom/at25.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
drivers/misc/eeprom/at25.c +2 -2
index b08cf8a..ad8fd8e 100644
@@ -412,7 +412,7 @@ static int at25_probe(struct spi_device *spi)
 	mutex_init(&at25->lock);
 	at25->chip = chip;
 	at25->spi = spi_dev_get(spi);
-	dev_set_drvdata(&spi->dev, at25);
+	spi_set_drvdata(spi, at25);
 	at25->addrlen = addrlen;
 
 	/* Export the EEPROM bytes through sysfs, since that's convenient.
@@ -463,7 +463,7 @@ static int at25_remove(struct spi_device *spi)
 {
 	struct at25_data	*at25;
 
-	at25 = dev_get_drvdata(&spi->dev);
+	at25 = spi_get_drvdata(spi);
 	sysfs_remove_bin_file(&spi->dev.kobj, &at25->bin);
 	kfree(at25);
 	return 0;
Signature · 1 line
1.7.2.5
author
#1 lore raw

PATCH 2/3 misc: eeprom_93xx46: 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.

---
 drivers/misc/eeprom/eeprom_93xx46.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
drivers/misc/eeprom/eeprom_93xx46.c +3 -3
index a6b5d5e..94cfc12 100644
@@ -363,7 +363,7 @@ static int eeprom_93xx46_probe(struct spi_device *spi)
 			dev_err(&spi->dev, "can't create erase interface\n");
 	}
 
-	dev_set_drvdata(&spi->dev, edev);
+	spi_set_drvdata(spi, edev);
 	return 0;
 fail:
 	kfree(edev);
@@ -372,13 +372,13 @@ fail:
 
 static int eeprom_93xx46_remove(struct spi_device *spi)
 {
-	struct eeprom_93xx46_dev *edev = dev_get_drvdata(&spi->dev);
+	struct eeprom_93xx46_dev *edev = spi_get_drvdata(spi);
 
 	if (!(edev->pdata->flags & EE_READONLY))
 		device_remove_file(&spi->dev, &dev_attr_erase);
 
 	sysfs_remove_bin_file(&spi->dev.kobj, &edev->bin);
-	dev_set_drvdata(&spi->dev, NULL);
+	spi_set_drvdata(spi, NULL);
 	kfree(edev);
 	return 0;
 }
Signature · 1 line
1.7.2.5
author
#2 lore raw

PATCH 3/3 misc: lattice-ecp3-config: use spi_get_drvdata()

In reply to Jingoo Han

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.

---
 drivers/misc/lattice-ecp3-config.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/misc/lattice-ecp3-config.c +1 -1
index 155700b..bb26f08 100644
@@ -69,7 +69,7 @@ static const struct ecp3_dev ecp3_dev[] = {
 static void firmware_load(const struct firmware *fw, void *context)
 {
 	struct spi_device *spi = (struct spi_device *)context;
-	struct fpga_data *data = dev_get_drvdata(&spi->dev);
+	struct fpga_data *data = spi_get_drvdata(spi);
 	u8 *buffer;
 	int ret;
 	u8 txbuf[8];
Signature · 1 line
1.7.2.5