All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/7] Device table matching for SPI subsystem
@ 2009-07-29 17:03 ` Anton Vorontsov
  0 siblings, 0 replies; 68+ messages in thread
From: Anton Vorontsov @ 2009-07-29 17:03 UTC (permalink / raw)
  To: Andrew Morton
  Cc: David Brownell, David Woodhouse, Grant Likely, Jean Delvare,
	linux-mtd, linux-kernel, lm-sensors, linuxppc-dev

Hi all,

This patch set implements standard device table matching mechanism
for SPI subsystem, the same device id tables as we use in I2C drivers.

I started this work because m25p80 driver misdetects non-JEDEC
chips when it is used on OpenFirmware platforms (cause we don't pass
platform_data). platform_data is overkill for m25p80 chips, the
driver only needs to know exact chip model, and that's what device
tables are for.

So the patches:

  [1/7] spi: Add support for device table matching
  [2/7] mtd: m25p80: Convert to device table matching
  [3/7] of: Remove "stm,m25p40" alias

The three patches above do real work. I tried to keep the 1/7 patch as
small as possible, and factor out the subsystem cleanups into other,
"cleanup" patches:

  [PATCH 4/7] spi: Prefix modalias with "spi:"
  [PATCH 5/7] spi: Merge probe and probe_id callbacks

These two patches I consider as cleanups, they should not introduce
any behavioural change, but they touch quite a lot of files.

  [PATCH 6/7] hwmon: adxx: Convert to device table matching
  [PATCH 7/7] hwmon: lm70: Convert to device table matching

These two are here because I couldn't stop. :-) Also cleanups.

-- 
Anton Vorontsov
email: cbouatmailru@gmail.com
irc://irc.freenode.net/bd2

^ permalink raw reply	[flat|nested] 68+ messages in thread

* [PATCH 0/7] Device table matching for SPI subsystem
@ 2009-07-29 17:03 ` Anton Vorontsov
  0 siblings, 0 replies; 68+ messages in thread
From: Anton Vorontsov @ 2009-07-29 17:03 UTC (permalink / raw)
  To: Andrew Morton
  Cc: David Brownell, linux-kernel, lm-sensors, linuxppc-dev,
	linux-mtd, Jean Delvare, David Woodhouse

Hi all,

This patch set implements standard device table matching mechanism
for SPI subsystem, the same device id tables as we use in I2C drivers.

I started this work because m25p80 driver misdetects non-JEDEC
chips when it is used on OpenFirmware platforms (cause we don't pass
platform_data). platform_data is overkill for m25p80 chips, the
driver only needs to know exact chip model, and that's what device
tables are for.

So the patches:

  [1/7] spi: Add support for device table matching
  [2/7] mtd: m25p80: Convert to device table matching
  [3/7] of: Remove "stm,m25p40" alias

The three patches above do real work. I tried to keep the 1/7 patch as
small as possible, and factor out the subsystem cleanups into other,
"cleanup" patches:

  [PATCH 4/7] spi: Prefix modalias with "spi:"
  [PATCH 5/7] spi: Merge probe and probe_id callbacks

These two patches I consider as cleanups, they should not introduce
any behavioural change, but they touch quite a lot of files.

  [PATCH 6/7] hwmon: adxx: Convert to device table matching
  [PATCH 7/7] hwmon: lm70: Convert to device table matching

These two are here because I couldn't stop. :-) Also cleanups.

-- 
Anton Vorontsov
email: cbouatmailru@gmail.com
irc://irc.freenode.net/bd2

^ permalink raw reply	[flat|nested] 68+ messages in thread

* [PATCH 0/7] Device table matching for SPI subsystem
@ 2009-07-29 17:03 ` Anton Vorontsov
  0 siblings, 0 replies; 68+ messages in thread
From: Anton Vorontsov @ 2009-07-29 17:03 UTC (permalink / raw)
  To: Andrew Morton
  Cc: David Brownell, linux-kernel, lm-sensors, Grant Likely,
	linuxppc-dev, linux-mtd, Jean Delvare, David Woodhouse

Hi all,

This patch set implements standard device table matching mechanism
for SPI subsystem, the same device id tables as we use in I2C drivers.

I started this work because m25p80 driver misdetects non-JEDEC
chips when it is used on OpenFirmware platforms (cause we don't pass
platform_data). platform_data is overkill for m25p80 chips, the
driver only needs to know exact chip model, and that's what device
tables are for.

So the patches:

  [1/7] spi: Add support for device table matching
  [2/7] mtd: m25p80: Convert to device table matching
  [3/7] of: Remove "stm,m25p40" alias

The three patches above do real work. I tried to keep the 1/7 patch as
small as possible, and factor out the subsystem cleanups into other,
"cleanup" patches:

  [PATCH 4/7] spi: Prefix modalias with "spi:"
  [PATCH 5/7] spi: Merge probe and probe_id callbacks

These two patches I consider as cleanups, they should not introduce
any behavioural change, but they touch quite a lot of files.

  [PATCH 6/7] hwmon: adxx: Convert to device table matching
  [PATCH 7/7] hwmon: lm70: Convert to device table matching

These two are here because I couldn't stop. :-) Also cleanups.

-- 
Anton Vorontsov
email: cbouatmailru@gmail.com
irc://irc.freenode.net/bd2

^ permalink raw reply	[flat|nested] 68+ messages in thread

* [lm-sensors] [PATCH 0/7] Device table matching for SPI subsystem
@ 2009-07-29 17:03 ` Anton Vorontsov
  0 siblings, 0 replies; 68+ messages in thread
From: Anton Vorontsov @ 2009-07-29 17:03 UTC (permalink / raw)
  To: Andrew Morton
  Cc: David Brownell, David Woodhouse, Grant Likely, Jean Delvare,
	linux-mtd, linux-kernel, lm-sensors, linuxppc-dev

Hi all,

This patch set implements standard device table matching mechanism
for SPI subsystem, the same device id tables as we use in I2C drivers.

I started this work because m25p80 driver misdetects non-JEDEC
chips when it is used on OpenFirmware platforms (cause we don't pass
platform_data). platform_data is overkill for m25p80 chips, the
driver only needs to know exact chip model, and that's what device
tables are for.

So the patches:

  [1/7] spi: Add support for device table matching
  [2/7] mtd: m25p80: Convert to device table matching
  [3/7] of: Remove "stm,m25p40" alias

The three patches above do real work. I tried to keep the 1/7 patch as
small as possible, and factor out the subsystem cleanups into other,
"cleanup" patches:

  [PATCH 4/7] spi: Prefix modalias with "spi:"
  [PATCH 5/7] spi: Merge probe and probe_id callbacks

These two patches I consider as cleanups, they should not introduce
any behavioural change, but they touch quite a lot of files.

  [PATCH 6/7] hwmon: adxx: Convert to device table matching
  [PATCH 7/7] hwmon: lm70: Convert to device table matching

These two are here because I couldn't stop. :-) Also cleanups.

-- 
Anton Vorontsov
email: cbouatmailru@gmail.com
irc://irc.freenode.net/bd2

_______________________________________________
lm-sensors mailing list
lm-sensors@lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

^ permalink raw reply	[flat|nested] 68+ messages in thread

* [PATCH 1/7] spi: Add support for device table matching
  2009-07-29 17:03 ` Anton Vorontsov
  (?)
  (?)
@ 2009-07-29 17:04   ` Anton Vorontsov
  -1 siblings, 0 replies; 68+ messages in thread
From: Anton Vorontsov @ 2009-07-29 17:04 UTC (permalink / raw)
  To: Andrew Morton
  Cc: David Brownell, David Woodhouse, Grant Likely, Jean Delvare,
	linux-mtd, linux-kernel, lm-sensors, linuxppc-dev

With this patch spi drivers can use standard spi_driver.id_table and
MODULE_DEVICE_TABLE() mechanisms to bind against the devices. Just
like we do with I2C drivers.

This is useful when a single driver supports several variants of
devices but it is not possible to detect them in run-time (like
non-JEDEC chips probing in drivers/mtd/devices/m25p80.c), and
when platform_data usage is overkill.

This patch also makes life a lot easier on OpenFirmware platforms,
since with OF we extensively use proper device IDs in modaliases.

Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com>
---
 drivers/spi/spi.c               |   26 +++++++++++++++++++++++++-
 include/linux/mod_devicetable.h |   13 +++++++++++++
 include/linux/spi/spi.h         |   10 ++++++++--
 scripts/mod/file2alias.c        |   13 +++++++++++++
 4 files changed, 59 insertions(+), 3 deletions(-)

diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c
index 70845cc..1431bf2 100644
--- a/drivers/spi/spi.c
+++ b/drivers/spi/spi.c
@@ -59,9 +59,24 @@ static struct device_attribute spi_dev_attrs[] = {
  * and the sysfs version makes coldplug work too.
  */
 
+static const struct spi_device_id *spi_match_id(const struct spi_device_id *id,
+						const struct spi_device *sdev)
+{
+	while (id->name[0]) {
+		if (!strcmp(sdev->modalias, id->name))
+			return id;
+		id++;
+	}
+	return NULL;
+}
+
 static int spi_match_device(struct device *dev, struct device_driver *drv)
 {
 	const struct spi_device	*spi = to_spi_device(dev);
+	const struct spi_driver	*sdrv = to_spi_driver(drv);
+
+	if (sdrv->id_table)
+		return !!spi_match_id(sdrv->id_table, spi);
 
 	return strcmp(spi->modalias, drv->name) == 0;
 }
@@ -121,6 +136,13 @@ struct bus_type spi_bus_type = {
 };
 EXPORT_SYMBOL_GPL(spi_bus_type);
 
+static int spi_drv_probe_id(struct device *dev)
+{
+	const struct spi_driver		*sdrv = to_spi_driver(dev->driver);
+	struct spi_device		*sdev = to_spi_device(dev);
+
+	return sdrv->probe_id(sdev, spi_match_id(sdrv->id_table, sdev));
+}
 
 static int spi_drv_probe(struct device *dev)
 {
@@ -151,7 +173,9 @@ static void spi_drv_shutdown(struct device *dev)
 int spi_register_driver(struct spi_driver *sdrv)
 {
 	sdrv->driver.bus = &spi_bus_type;
-	if (sdrv->probe)
+	if (sdrv->probe_id)
+		sdrv->driver.probe = spi_drv_probe_id;
+	else if (sdrv->probe)
 		sdrv->driver.probe = spi_drv_probe;
 	if (sdrv->remove)
 		sdrv->driver.remove = spi_drv_remove;
diff --git a/include/linux/mod_devicetable.h b/include/linux/mod_devicetable.h
index 1bf5900..9660dca 100644
--- a/include/linux/mod_devicetable.h
+++ b/include/linux/mod_devicetable.h
@@ -399,6 +399,19 @@ struct i2c_device_id {
 			__attribute__((aligned(sizeof(kernel_ulong_t))));
 };
 
+/* spi */
+
+#define SPI_NAME_SIZE	20
+
+struct spi_device_id {
+	char name[SPI_NAME_SIZE];
+#ifdef __KERNEL__
+	void *data;
+#else
+	kernel_ulong_t data;
+#endif
+};
+
 /* dmi */
 enum dmi_field {
 	DMI_NONE,
diff --git a/include/linux/spi/spi.h b/include/linux/spi/spi.h
index c47c4b4..c8d92a1 100644
--- a/include/linux/spi/spi.h
+++ b/include/linux/spi/spi.h
@@ -20,6 +20,7 @@
 #define __LINUX_SPI_H
 
 #include <linux/device.h>
+#include <linux/mod_devicetable.h>
 
 /*
  * INTERFACES between SPI master-side drivers and SPI infrastructure.
@@ -86,7 +87,7 @@ struct spi_device {
 	int			irq;
 	void			*controller_state;
 	void			*controller_data;
-	char			modalias[32];
+	char			modalias[SPI_NAME_SIZE];
 
 	/*
 	 * likely need more hooks for more protocol options affecting how
@@ -145,6 +146,8 @@ struct spi_message;
 
 /**
  * struct spi_driver - Host side "protocol" driver
+ * @id_table: List of SPI devices supported by this driver
+ * @probe_id: Binds this driver to the spi device via id_table matching.
  * @probe: Binds this driver to the spi device.  Drivers can verify
  *	that the device is actually present, and may need to configure
  *	characteristics (such as bits_per_word) which weren't needed for
@@ -170,6 +173,9 @@ struct spi_message;
  * MMC, RTC, filesystem character device nodes, and hardware monitoring.
  */
 struct spi_driver {
+	const struct spi_device_id *id_table;
+	int			(*probe_id)(struct spi_device *spi,
+					    const struct spi_device_id *id);
 	int			(*probe)(struct spi_device *spi);
 	int			(*remove)(struct spi_device *spi);
 	void			(*shutdown)(struct spi_device *spi);
@@ -732,7 +738,7 @@ struct spi_board_info {
 	 * controller_data goes to spi_device.controller_data,
 	 * irq is copied too
 	 */
-	char		modalias[32];
+	char		modalias[SPI_NAME_SIZE];
 	const void	*platform_data;
 	void		*controller_data;
 	int		irq;
diff --git a/scripts/mod/file2alias.c b/scripts/mod/file2alias.c
index 40e0045..9d446e3 100644
--- a/scripts/mod/file2alias.c
+++ b/scripts/mod/file2alias.c
@@ -657,6 +657,15 @@ static int do_i2c_entry(const char *filename, struct i2c_device_id *id,
 	return 1;
 }
 
+/* Looks like: S */
+static int do_spi_entry(const char *filename, struct spi_device_id *id,
+			char *alias)
+{
+	sprintf(alias, "%s", id->name);
+
+	return 1;
+}
+
 static const struct dmifield {
 	const char *prefix;
 	int field;
@@ -853,6 +862,10 @@ void handle_moddevtable(struct module *mod, struct elf_info *info,
 		do_table(symval, sym->st_size,
 			 sizeof(struct i2c_device_id), "i2c",
 			 do_i2c_entry, mod);
+	else if (sym_is(symname, "__mod_spi_device_table"))
+		do_table(symval, sym->st_size,
+			 sizeof(struct spi_device_id), "spi",
+			 do_spi_entry, mod);
 	else if (sym_is(symname, "__mod_dmi_device_table"))
 		do_table(symval, sym->st_size,
 			 sizeof(struct dmi_system_id), "dmi",
-- 
1.6.3.3


^ permalink raw reply related	[flat|nested] 68+ messages in thread

* [PATCH 1/7] spi: Add support for device table matching
@ 2009-07-29 17:04   ` Anton Vorontsov
  0 siblings, 0 replies; 68+ messages in thread
From: Anton Vorontsov @ 2009-07-29 17:04 UTC (permalink / raw)
  To: Andrew Morton
  Cc: David Brownell, linux-kernel, lm-sensors, linuxppc-dev,
	linux-mtd, Jean Delvare, David Woodhouse

With this patch spi drivers can use standard spi_driver.id_table and
MODULE_DEVICE_TABLE() mechanisms to bind against the devices. Just
like we do with I2C drivers.

This is useful when a single driver supports several variants of
devices but it is not possible to detect them in run-time (like
non-JEDEC chips probing in drivers/mtd/devices/m25p80.c), and
when platform_data usage is overkill.

This patch also makes life a lot easier on OpenFirmware platforms,
since with OF we extensively use proper device IDs in modaliases.

Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com>
---
 drivers/spi/spi.c               |   26 +++++++++++++++++++++++++-
 include/linux/mod_devicetable.h |   13 +++++++++++++
 include/linux/spi/spi.h         |   10 ++++++++--
 scripts/mod/file2alias.c        |   13 +++++++++++++
 4 files changed, 59 insertions(+), 3 deletions(-)

diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c
index 70845cc..1431bf2 100644
--- a/drivers/spi/spi.c
+++ b/drivers/spi/spi.c
@@ -59,9 +59,24 @@ static struct device_attribute spi_dev_attrs[] = {
  * and the sysfs version makes coldplug work too.
  */
 
+static const struct spi_device_id *spi_match_id(const struct spi_device_id *id,
+						const struct spi_device *sdev)
+{
+	while (id->name[0]) {
+		if (!strcmp(sdev->modalias, id->name))
+			return id;
+		id++;
+	}
+	return NULL;
+}
+
 static int spi_match_device(struct device *dev, struct device_driver *drv)
 {
 	const struct spi_device	*spi = to_spi_device(dev);
+	const struct spi_driver	*sdrv = to_spi_driver(drv);
+
+	if (sdrv->id_table)
+		return !!spi_match_id(sdrv->id_table, spi);
 
 	return strcmp(spi->modalias, drv->name) == 0;
 }
@@ -121,6 +136,13 @@ struct bus_type spi_bus_type = {
 };
 EXPORT_SYMBOL_GPL(spi_bus_type);
 
+static int spi_drv_probe_id(struct device *dev)
+{
+	const struct spi_driver		*sdrv = to_spi_driver(dev->driver);
+	struct spi_device		*sdev = to_spi_device(dev);
+
+	return sdrv->probe_id(sdev, spi_match_id(sdrv->id_table, sdev));
+}
 
 static int spi_drv_probe(struct device *dev)
 {
@@ -151,7 +173,9 @@ static void spi_drv_shutdown(struct device *dev)
 int spi_register_driver(struct spi_driver *sdrv)
 {
 	sdrv->driver.bus = &spi_bus_type;
-	if (sdrv->probe)
+	if (sdrv->probe_id)
+		sdrv->driver.probe = spi_drv_probe_id;
+	else if (sdrv->probe)
 		sdrv->driver.probe = spi_drv_probe;
 	if (sdrv->remove)
 		sdrv->driver.remove = spi_drv_remove;
diff --git a/include/linux/mod_devicetable.h b/include/linux/mod_devicetable.h
index 1bf5900..9660dca 100644
--- a/include/linux/mod_devicetable.h
+++ b/include/linux/mod_devicetable.h
@@ -399,6 +399,19 @@ struct i2c_device_id {
 			__attribute__((aligned(sizeof(kernel_ulong_t))));
 };
 
+/* spi */
+
+#define SPI_NAME_SIZE	20
+
+struct spi_device_id {
+	char name[SPI_NAME_SIZE];
+#ifdef __KERNEL__
+	void *data;
+#else
+	kernel_ulong_t data;
+#endif
+};
+
 /* dmi */
 enum dmi_field {
 	DMI_NONE,
diff --git a/include/linux/spi/spi.h b/include/linux/spi/spi.h
index c47c4b4..c8d92a1 100644
--- a/include/linux/spi/spi.h
+++ b/include/linux/spi/spi.h
@@ -20,6 +20,7 @@
 #define __LINUX_SPI_H
 
 #include <linux/device.h>
+#include <linux/mod_devicetable.h>
 
 /*
  * INTERFACES between SPI master-side drivers and SPI infrastructure.
@@ -86,7 +87,7 @@ struct spi_device {
 	int			irq;
 	void			*controller_state;
 	void			*controller_data;
-	char			modalias[32];
+	char			modalias[SPI_NAME_SIZE];
 
 	/*
 	 * likely need more hooks for more protocol options affecting how
@@ -145,6 +146,8 @@ struct spi_message;
 
 /**
  * struct spi_driver - Host side "protocol" driver
+ * @id_table: List of SPI devices supported by this driver
+ * @probe_id: Binds this driver to the spi device via id_table matching.
  * @probe: Binds this driver to the spi device.  Drivers can verify
  *	that the device is actually present, and may need to configure
  *	characteristics (such as bits_per_word) which weren't needed for
@@ -170,6 +173,9 @@ struct spi_message;
  * MMC, RTC, filesystem character device nodes, and hardware monitoring.
  */
 struct spi_driver {
+	const struct spi_device_id *id_table;
+	int			(*probe_id)(struct spi_device *spi,
+					    const struct spi_device_id *id);
 	int			(*probe)(struct spi_device *spi);
 	int			(*remove)(struct spi_device *spi);
 	void			(*shutdown)(struct spi_device *spi);
@@ -732,7 +738,7 @@ struct spi_board_info {
 	 * controller_data goes to spi_device.controller_data,
 	 * irq is copied too
 	 */
-	char		modalias[32];
+	char		modalias[SPI_NAME_SIZE];
 	const void	*platform_data;
 	void		*controller_data;
 	int		irq;
diff --git a/scripts/mod/file2alias.c b/scripts/mod/file2alias.c
index 40e0045..9d446e3 100644
--- a/scripts/mod/file2alias.c
+++ b/scripts/mod/file2alias.c
@@ -657,6 +657,15 @@ static int do_i2c_entry(const char *filename, struct i2c_device_id *id,
 	return 1;
 }
 
+/* Looks like: S */
+static int do_spi_entry(const char *filename, struct spi_device_id *id,
+			char *alias)
+{
+	sprintf(alias, "%s", id->name);
+
+	return 1;
+}
+
 static const struct dmifield {
 	const char *prefix;
 	int field;
@@ -853,6 +862,10 @@ void handle_moddevtable(struct module *mod, struct elf_info *info,
 		do_table(symval, sym->st_size,
 			 sizeof(struct i2c_device_id), "i2c",
 			 do_i2c_entry, mod);
+	else if (sym_is(symname, "__mod_spi_device_table"))
+		do_table(symval, sym->st_size,
+			 sizeof(struct spi_device_id), "spi",
+			 do_spi_entry, mod);
 	else if (sym_is(symname, "__mod_dmi_device_table"))
 		do_table(symval, sym->st_size,
 			 sizeof(struct dmi_system_id), "dmi",
-- 
1.6.3.3

^ permalink raw reply related	[flat|nested] 68+ messages in thread

* [PATCH 1/7] spi: Add support for device table matching
@ 2009-07-29 17:04   ` Anton Vorontsov
  0 siblings, 0 replies; 68+ messages in thread
From: Anton Vorontsov @ 2009-07-29 17:04 UTC (permalink / raw)
  To: Andrew Morton
  Cc: David Brownell, linux-kernel, lm-sensors, Grant Likely,
	linuxppc-dev, linux-mtd, Jean Delvare, David Woodhouse

With this patch spi drivers can use standard spi_driver.id_table and
MODULE_DEVICE_TABLE() mechanisms to bind against the devices. Just
like we do with I2C drivers.

This is useful when a single driver supports several variants of
devices but it is not possible to detect them in run-time (like
non-JEDEC chips probing in drivers/mtd/devices/m25p80.c), and
when platform_data usage is overkill.

This patch also makes life a lot easier on OpenFirmware platforms,
since with OF we extensively use proper device IDs in modaliases.

Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com>
---
 drivers/spi/spi.c               |   26 +++++++++++++++++++++++++-
 include/linux/mod_devicetable.h |   13 +++++++++++++
 include/linux/spi/spi.h         |   10 ++++++++--
 scripts/mod/file2alias.c        |   13 +++++++++++++
 4 files changed, 59 insertions(+), 3 deletions(-)

diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c
index 70845cc..1431bf2 100644
--- a/drivers/spi/spi.c
+++ b/drivers/spi/spi.c
@@ -59,9 +59,24 @@ static struct device_attribute spi_dev_attrs[] = {
  * and the sysfs version makes coldplug work too.
  */
 
+static const struct spi_device_id *spi_match_id(const struct spi_device_id *id,
+						const struct spi_device *sdev)
+{
+	while (id->name[0]) {
+		if (!strcmp(sdev->modalias, id->name))
+			return id;
+		id++;
+	}
+	return NULL;
+}
+
 static int spi_match_device(struct device *dev, struct device_driver *drv)
 {
 	const struct spi_device	*spi = to_spi_device(dev);
+	const struct spi_driver	*sdrv = to_spi_driver(drv);
+
+	if (sdrv->id_table)
+		return !!spi_match_id(sdrv->id_table, spi);
 
 	return strcmp(spi->modalias, drv->name) == 0;
 }
@@ -121,6 +136,13 @@ struct bus_type spi_bus_type = {
 };
 EXPORT_SYMBOL_GPL(spi_bus_type);
 
+static int spi_drv_probe_id(struct device *dev)
+{
+	const struct spi_driver		*sdrv = to_spi_driver(dev->driver);
+	struct spi_device		*sdev = to_spi_device(dev);
+
+	return sdrv->probe_id(sdev, spi_match_id(sdrv->id_table, sdev));
+}
 
 static int spi_drv_probe(struct device *dev)
 {
@@ -151,7 +173,9 @@ static void spi_drv_shutdown(struct device *dev)
 int spi_register_driver(struct spi_driver *sdrv)
 {
 	sdrv->driver.bus = &spi_bus_type;
-	if (sdrv->probe)
+	if (sdrv->probe_id)
+		sdrv->driver.probe = spi_drv_probe_id;
+	else if (sdrv->probe)
 		sdrv->driver.probe = spi_drv_probe;
 	if (sdrv->remove)
 		sdrv->driver.remove = spi_drv_remove;
diff --git a/include/linux/mod_devicetable.h b/include/linux/mod_devicetable.h
index 1bf5900..9660dca 100644
--- a/include/linux/mod_devicetable.h
+++ b/include/linux/mod_devicetable.h
@@ -399,6 +399,19 @@ struct i2c_device_id {
 			__attribute__((aligned(sizeof(kernel_ulong_t))));
 };
 
+/* spi */
+
+#define SPI_NAME_SIZE	20
+
+struct spi_device_id {
+	char name[SPI_NAME_SIZE];
+#ifdef __KERNEL__
+	void *data;
+#else
+	kernel_ulong_t data;
+#endif
+};
+
 /* dmi */
 enum dmi_field {
 	DMI_NONE,
diff --git a/include/linux/spi/spi.h b/include/linux/spi/spi.h
index c47c4b4..c8d92a1 100644
--- a/include/linux/spi/spi.h
+++ b/include/linux/spi/spi.h
@@ -20,6 +20,7 @@
 #define __LINUX_SPI_H
 
 #include <linux/device.h>
+#include <linux/mod_devicetable.h>
 
 /*
  * INTERFACES between SPI master-side drivers and SPI infrastructure.
@@ -86,7 +87,7 @@ struct spi_device {
 	int			irq;
 	void			*controller_state;
 	void			*controller_data;
-	char			modalias[32];
+	char			modalias[SPI_NAME_SIZE];
 
 	/*
 	 * likely need more hooks for more protocol options affecting how
@@ -145,6 +146,8 @@ struct spi_message;
 
 /**
  * struct spi_driver - Host side "protocol" driver
+ * @id_table: List of SPI devices supported by this driver
+ * @probe_id: Binds this driver to the spi device via id_table matching.
  * @probe: Binds this driver to the spi device.  Drivers can verify
  *	that the device is actually present, and may need to configure
  *	characteristics (such as bits_per_word) which weren't needed for
@@ -170,6 +173,9 @@ struct spi_message;
  * MMC, RTC, filesystem character device nodes, and hardware monitoring.
  */
 struct spi_driver {
+	const struct spi_device_id *id_table;
+	int			(*probe_id)(struct spi_device *spi,
+					    const struct spi_device_id *id);
 	int			(*probe)(struct spi_device *spi);
 	int			(*remove)(struct spi_device *spi);
 	void			(*shutdown)(struct spi_device *spi);
@@ -732,7 +738,7 @@ struct spi_board_info {
 	 * controller_data goes to spi_device.controller_data,
 	 * irq is copied too
 	 */
-	char		modalias[32];
+	char		modalias[SPI_NAME_SIZE];
 	const void	*platform_data;
 	void		*controller_data;
 	int		irq;
diff --git a/scripts/mod/file2alias.c b/scripts/mod/file2alias.c
index 40e0045..9d446e3 100644
--- a/scripts/mod/file2alias.c
+++ b/scripts/mod/file2alias.c
@@ -657,6 +657,15 @@ static int do_i2c_entry(const char *filename, struct i2c_device_id *id,
 	return 1;
 }
 
+/* Looks like: S */
+static int do_spi_entry(const char *filename, struct spi_device_id *id,
+			char *alias)
+{
+	sprintf(alias, "%s", id->name);
+
+	return 1;
+}
+
 static const struct dmifield {
 	const char *prefix;
 	int field;
@@ -853,6 +862,10 @@ void handle_moddevtable(struct module *mod, struct elf_info *info,
 		do_table(symval, sym->st_size,
 			 sizeof(struct i2c_device_id), "i2c",
 			 do_i2c_entry, mod);
+	else if (sym_is(symname, "__mod_spi_device_table"))
+		do_table(symval, sym->st_size,
+			 sizeof(struct spi_device_id), "spi",
+			 do_spi_entry, mod);
 	else if (sym_is(symname, "__mod_dmi_device_table"))
 		do_table(symval, sym->st_size,
 			 sizeof(struct dmi_system_id), "dmi",
-- 
1.6.3.3

^ permalink raw reply related	[flat|nested] 68+ messages in thread

* [lm-sensors] [PATCH 1/7] spi: Add support for device table matching
@ 2009-07-29 17:04   ` Anton Vorontsov
  0 siblings, 0 replies; 68+ messages in thread
From: Anton Vorontsov @ 2009-07-29 17:04 UTC (permalink / raw)
  To: Andrew Morton
  Cc: David Brownell, David Woodhouse, Grant Likely, Jean Delvare,
	linux-mtd, linux-kernel, lm-sensors, linuxppc-dev

With this patch spi drivers can use standard spi_driver.id_table and
MODULE_DEVICE_TABLE() mechanisms to bind against the devices. Just
like we do with I2C drivers.

This is useful when a single driver supports several variants of
devices but it is not possible to detect them in run-time (like
non-JEDEC chips probing in drivers/mtd/devices/m25p80.c), and
when platform_data usage is overkill.

This patch also makes life a lot easier on OpenFirmware platforms,
since with OF we extensively use proper device IDs in modaliases.

Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com>
---
 drivers/spi/spi.c               |   26 +++++++++++++++++++++++++-
 include/linux/mod_devicetable.h |   13 +++++++++++++
 include/linux/spi/spi.h         |   10 ++++++++--
 scripts/mod/file2alias.c        |   13 +++++++++++++
 4 files changed, 59 insertions(+), 3 deletions(-)

diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c
index 70845cc..1431bf2 100644
--- a/drivers/spi/spi.c
+++ b/drivers/spi/spi.c
@@ -59,9 +59,24 @@ static struct device_attribute spi_dev_attrs[] = {
  * and the sysfs version makes coldplug work too.
  */
 
+static const struct spi_device_id *spi_match_id(const struct spi_device_id *id,
+						const struct spi_device *sdev)
+{
+	while (id->name[0]) {
+		if (!strcmp(sdev->modalias, id->name))
+			return id;
+		id++;
+	}
+	return NULL;
+}
+
 static int spi_match_device(struct device *dev, struct device_driver *drv)
 {
 	const struct spi_device	*spi = to_spi_device(dev);
+	const struct spi_driver	*sdrv = to_spi_driver(drv);
+
+	if (sdrv->id_table)
+		return !!spi_match_id(sdrv->id_table, spi);
 
 	return strcmp(spi->modalias, drv->name) = 0;
 }
@@ -121,6 +136,13 @@ struct bus_type spi_bus_type = {
 };
 EXPORT_SYMBOL_GPL(spi_bus_type);
 
+static int spi_drv_probe_id(struct device *dev)
+{
+	const struct spi_driver		*sdrv = to_spi_driver(dev->driver);
+	struct spi_device		*sdev = to_spi_device(dev);
+
+	return sdrv->probe_id(sdev, spi_match_id(sdrv->id_table, sdev));
+}
 
 static int spi_drv_probe(struct device *dev)
 {
@@ -151,7 +173,9 @@ static void spi_drv_shutdown(struct device *dev)
 int spi_register_driver(struct spi_driver *sdrv)
 {
 	sdrv->driver.bus = &spi_bus_type;
-	if (sdrv->probe)
+	if (sdrv->probe_id)
+		sdrv->driver.probe = spi_drv_probe_id;
+	else if (sdrv->probe)
 		sdrv->driver.probe = spi_drv_probe;
 	if (sdrv->remove)
 		sdrv->driver.remove = spi_drv_remove;
diff --git a/include/linux/mod_devicetable.h b/include/linux/mod_devicetable.h
index 1bf5900..9660dca 100644
--- a/include/linux/mod_devicetable.h
+++ b/include/linux/mod_devicetable.h
@@ -399,6 +399,19 @@ struct i2c_device_id {
 			__attribute__((aligned(sizeof(kernel_ulong_t))));
 };
 
+/* spi */
+
+#define SPI_NAME_SIZE	20
+
+struct spi_device_id {
+	char name[SPI_NAME_SIZE];
+#ifdef __KERNEL__
+	void *data;
+#else
+	kernel_ulong_t data;
+#endif
+};
+
 /* dmi */
 enum dmi_field {
 	DMI_NONE,
diff --git a/include/linux/spi/spi.h b/include/linux/spi/spi.h
index c47c4b4..c8d92a1 100644
--- a/include/linux/spi/spi.h
+++ b/include/linux/spi/spi.h
@@ -20,6 +20,7 @@
 #define __LINUX_SPI_H
 
 #include <linux/device.h>
+#include <linux/mod_devicetable.h>
 
 /*
  * INTERFACES between SPI master-side drivers and SPI infrastructure.
@@ -86,7 +87,7 @@ struct spi_device {
 	int			irq;
 	void			*controller_state;
 	void			*controller_data;
-	char			modalias[32];
+	char			modalias[SPI_NAME_SIZE];
 
 	/*
 	 * likely need more hooks for more protocol options affecting how
@@ -145,6 +146,8 @@ struct spi_message;
 
 /**
  * struct spi_driver - Host side "protocol" driver
+ * @id_table: List of SPI devices supported by this driver
+ * @probe_id: Binds this driver to the spi device via id_table matching.
  * @probe: Binds this driver to the spi device.  Drivers can verify
  *	that the device is actually present, and may need to configure
  *	characteristics (such as bits_per_word) which weren't needed for
@@ -170,6 +173,9 @@ struct spi_message;
  * MMC, RTC, filesystem character device nodes, and hardware monitoring.
  */
 struct spi_driver {
+	const struct spi_device_id *id_table;
+	int			(*probe_id)(struct spi_device *spi,
+					    const struct spi_device_id *id);
 	int			(*probe)(struct spi_device *spi);
 	int			(*remove)(struct spi_device *spi);
 	void			(*shutdown)(struct spi_device *spi);
@@ -732,7 +738,7 @@ struct spi_board_info {
 	 * controller_data goes to spi_device.controller_data,
 	 * irq is copied too
 	 */
-	char		modalias[32];
+	char		modalias[SPI_NAME_SIZE];
 	const void	*platform_data;
 	void		*controller_data;
 	int		irq;
diff --git a/scripts/mod/file2alias.c b/scripts/mod/file2alias.c
index 40e0045..9d446e3 100644
--- a/scripts/mod/file2alias.c
+++ b/scripts/mod/file2alias.c
@@ -657,6 +657,15 @@ static int do_i2c_entry(const char *filename, struct i2c_device_id *id,
 	return 1;
 }
 
+/* Looks like: S */
+static int do_spi_entry(const char *filename, struct spi_device_id *id,
+			char *alias)
+{
+	sprintf(alias, "%s", id->name);
+
+	return 1;
+}
+
 static const struct dmifield {
 	const char *prefix;
 	int field;
@@ -853,6 +862,10 @@ void handle_moddevtable(struct module *mod, struct elf_info *info,
 		do_table(symval, sym->st_size,
 			 sizeof(struct i2c_device_id), "i2c",
 			 do_i2c_entry, mod);
+	else if (sym_is(symname, "__mod_spi_device_table"))
+		do_table(symval, sym->st_size,
+			 sizeof(struct spi_device_id), "spi",
+			 do_spi_entry, mod);
 	else if (sym_is(symname, "__mod_dmi_device_table"))
 		do_table(symval, sym->st_size,
 			 sizeof(struct dmi_system_id), "dmi",
-- 
1.6.3.3


_______________________________________________
lm-sensors mailing list
lm-sensors@lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

^ permalink raw reply related	[flat|nested] 68+ messages in thread

* [PATCH 2/7] mtd: m25p80: Convert to device table matching
  2009-07-29 17:03 ` Anton Vorontsov
  (?)
  (?)
@ 2009-07-29 17:05   ` Anton Vorontsov
  -1 siblings, 0 replies; 68+ messages in thread
From: Anton Vorontsov @ 2009-07-29 17:05 UTC (permalink / raw)
  To: Andrew Morton
  Cc: David Brownell, David Woodhouse, Grant Likely, Jean Delvare,
	linux-mtd, linux-kernel, lm-sensors, linuxppc-dev

This patch converts the m25p80 driver so that now it uses .id_table
for device matching, making it properly detect devices on OpenFirmware
platforms (prior to this patch the driver misdetected non-JEDEC chips,
seeing all chips as "m25p80").

Also, now jedec_probe() only does jedec probing, nothing else. If it
is not able to detect a chip, NULL is returned and the driver fall
backs to the information specified by the platform (platform_data, or
exact ID).

Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com>
---
 drivers/mtd/devices/m25p80.c |  152 +++++++++++++++++++++++-------------------
 1 files changed, 84 insertions(+), 68 deletions(-)

diff --git a/drivers/mtd/devices/m25p80.c b/drivers/mtd/devices/m25p80.c
index 10ed195..7c3efff 100644
--- a/drivers/mtd/devices/m25p80.c
+++ b/drivers/mtd/devices/m25p80.c
@@ -21,6 +21,7 @@
 #include <linux/interrupt.h>
 #include <linux/mutex.h>
 #include <linux/math64.h>
+#include <linux/mod_devicetable.h>
 
 #include <linux/mtd/mtd.h>
 #include <linux/mtd/partitions.h>
@@ -462,8 +463,6 @@ static int m25p80_write(struct mtd_info *mtd, loff_t to, size_t len,
  */
 
 struct flash_info {
-	char		*name;
-
 	/* JEDEC id zero means "no ID" (most older chips); otherwise it has
 	 * a high byte of zero plus three data bytes: the manufacturer id,
 	 * then a two byte device id.
@@ -481,74 +480,83 @@ struct flash_info {
 #define	SECT_4K		0x01		/* OPCODE_BE_4K works uniformly */
 };
 
+#define INFO(_jedec_id, _ext_id, _sector_size, _n_sectors, _flags)	\
+	(&(struct flash_info) {						\
+		.jedec_id = (_jedec_id),				\
+		.ext_id = (_ext_id),					\
+		.sector_size = (_sector_size),				\
+		.n_sectors = (_n_sectors),				\
+		.flags = (_flags),					\
+	})
 
 /* NOTE: double check command sets and memory organization when you add
  * more flash chips.  This current list focusses on newer chips, which
  * have been converging on command sets which including JEDEC ID.
  */
-static struct flash_info __devinitdata m25p_data [] = {
-
+static const struct spi_device_id m25p_ids[] = {
 	/* Atmel -- some are (confusingly) marketed as "DataFlash" */
-	{ "at25fs010",  0x1f6601, 0, 32 * 1024, 4, SECT_4K, },
-	{ "at25fs040",  0x1f6604, 0, 64 * 1024, 8, SECT_4K, },
+	{ "at25fs010",  INFO(0x1f6601, 0, 32 * 1024, 4, SECT_4K) },
+	{ "at25fs040",  INFO(0x1f6604, 0, 64 * 1024, 8, SECT_4K) },
 
-	{ "at25df041a", 0x1f4401, 0, 64 * 1024, 8, SECT_4K, },
-	{ "at25df641",  0x1f4800, 0, 64 * 1024, 128, SECT_4K, },
+	{ "at25df041a", INFO(0x1f4401, 0, 64 * 1024, 8, SECT_4K) },
+	{ "at25df641",  INFO(0x1f4800, 0, 64 * 1024, 128, SECT_4K) },
 
-	{ "at26f004",   0x1f0400, 0, 64 * 1024, 8, SECT_4K, },
-	{ "at26df081a", 0x1f4501, 0, 64 * 1024, 16, SECT_4K, },
-	{ "at26df161a", 0x1f4601, 0, 64 * 1024, 32, SECT_4K, },
-	{ "at26df321",  0x1f4701, 0, 64 * 1024, 64, SECT_4K, },
+	{ "at26f004",   INFO(0x1f0400, 0, 64 * 1024, 8, SECT_4K) },
+	{ "at26df081a", INFO(0x1f4501, 0, 64 * 1024, 16, SECT_4K) },
+	{ "at26df161a", INFO(0x1f4601, 0, 64 * 1024, 32, SECT_4K) },
+	{ "at26df321",  INFO(0x1f4701, 0, 64 * 1024, 64, SECT_4K) },
 
 	/* Macronix */
-	{ "mx25l12805d", 0xc22018, 0, 64 * 1024, 256, },
+	{ "mx25l12805d", INFO(0xc22018, 0, 64 * 1024, 256, 0) },
 
 	/* Spansion -- single (large) sector size only, at least
 	 * for the chips listed here (without boot sectors).
 	 */
-	{ "s25sl004a", 0x010212, 0, 64 * 1024, 8, },
-	{ "s25sl008a", 0x010213, 0, 64 * 1024, 16, },
-	{ "s25sl016a", 0x010214, 0, 64 * 1024, 32, },
-	{ "s25sl032a", 0x010215, 0, 64 * 1024, 64, },
-	{ "s25sl064a", 0x010216, 0, 64 * 1024, 128, },
-        { "s25sl12800", 0x012018, 0x0300, 256 * 1024, 64, },
-	{ "s25sl12801", 0x012018, 0x0301, 64 * 1024, 256, },
+	{ "s25sl004a",  INFO(0x010212, 0, 64 * 1024, 8, 0) },
+	{ "s25sl008a",  INFO(0x010213, 0, 64 * 1024, 16, 0) },
+	{ "s25sl016a",  INFO(0x010214, 0, 64 * 1024, 32, 0) },
+	{ "s25sl032a",  INFO(0x010215, 0, 64 * 1024, 64, 0) },
+	{ "s25sl064a",  INFO(0x010216, 0, 64 * 1024, 128, 0) },
+	{ "s25sl12800", INFO(0x012018, 0x0300, 256 * 1024, 64, 0) },
+	{ "s25sl12801", INFO(0x012018, 0x0301, 64 * 1024, 256, 0) },
 
 	/* SST -- large erase sizes are "overlays", "sectors" are 4K */
-	{ "sst25vf040b", 0xbf258d, 0, 64 * 1024, 8, SECT_4K, },
-	{ "sst25vf080b", 0xbf258e, 0, 64 * 1024, 16, SECT_4K, },
-	{ "sst25vf016b", 0xbf2541, 0, 64 * 1024, 32, SECT_4K, },
-	{ "sst25vf032b", 0xbf254a, 0, 64 * 1024, 64, SECT_4K, },
+	{ "sst25vf040b", INFO(0xbf258d, 0, 64 * 1024, 8, SECT_4K) },
+	{ "sst25vf080b", INFO(0xbf258e, 0, 64 * 1024, 16, SECT_4K) },
+	{ "sst25vf016b", INFO(0xbf2541, 0, 64 * 1024, 32, SECT_4K) },
+	{ "sst25vf032b", INFO(0xbf254a, 0, 64 * 1024, 64, SECT_4K) },
 
 	/* ST Microelectronics -- newer production may have feature updates */
-	{ "m25p05",  0x202010,  0, 32 * 1024, 2, },
-	{ "m25p10",  0x202011,  0, 32 * 1024, 4, },
-	{ "m25p20",  0x202012,  0, 64 * 1024, 4, },
-	{ "m25p40",  0x202013,  0, 64 * 1024, 8, },
-	{ "m25p80",         0,  0, 64 * 1024, 16, },
-	{ "m25p16",  0x202015,  0, 64 * 1024, 32, },
-	{ "m25p32",  0x202016,  0, 64 * 1024, 64, },
-	{ "m25p64",  0x202017,  0, 64 * 1024, 128, },
-	{ "m25p128", 0x202018, 0, 256 * 1024, 64, },
-
-	{ "m45pe10", 0x204011,  0, 64 * 1024, 2, },
-	{ "m45pe80", 0x204014,  0, 64 * 1024, 16, },
-	{ "m45pe16", 0x204015,  0, 64 * 1024, 32, },
-
-	{ "m25pe80", 0x208014,  0, 64 * 1024, 16, },
-	{ "m25pe16", 0x208015,  0, 64 * 1024, 32, SECT_4K, },
+	{ "m25p05",  INFO(0x202010,  0, 32 * 1024, 2, 0) },
+	{ "m25p10",  INFO(0x202011,  0, 32 * 1024, 4, 0) },
+	{ "m25p20",  INFO(0x202012,  0, 64 * 1024, 4, 0) },
+	{ "m25p40",  INFO(0x202013,  0, 64 * 1024, 8, 0) },
+	{ "m25p80",  INFO(0x202014,  0, 64 * 1024, 16, 0) },
+	{ "m25p16",  INFO(0x202015,  0, 64 * 1024, 32, 0) },
+	{ "m25p32",  INFO(0x202016,  0, 64 * 1024, 64, 0) },
+	{ "m25p64",  INFO(0x202017,  0, 64 * 1024, 128, 0) },
+	{ "m25p128", INFO(0x202018, 0, 256 * 1024, 64, 0) },
+
+	{ "m45pe10", INFO(0x204011,  0, 64 * 1024, 2, 0) },
+	{ "m45pe80", INFO(0x204014,  0, 64 * 1024, 16, 0) },
+	{ "m45pe16", INFO(0x204015,  0, 64 * 1024, 32, 0) },
+
+	{ "m25pe80", INFO(0x208014,  0, 64 * 1024, 16, 0) },
+	{ "m25pe16", INFO(0x208015,  0, 64 * 1024, 32, SECT_4K) },
 
 	/* Winbond -- w25x "blocks" are 64K, "sectors" are 4KiB */
-	{ "w25x10", 0xef3011, 0, 64 * 1024, 2, SECT_4K, },
-	{ "w25x20", 0xef3012, 0, 64 * 1024, 4, SECT_4K, },
-	{ "w25x40", 0xef3013, 0, 64 * 1024, 8, SECT_4K, },
-	{ "w25x80", 0xef3014, 0, 64 * 1024, 16, SECT_4K, },
-	{ "w25x16", 0xef3015, 0, 64 * 1024, 32, SECT_4K, },
-	{ "w25x32", 0xef3016, 0, 64 * 1024, 64, SECT_4K, },
-	{ "w25x64", 0xef3017, 0, 64 * 1024, 128, SECT_4K, },
+	{ "w25x10", INFO(0xef3011, 0, 64 * 1024, 2, SECT_4K) },
+	{ "w25x20", INFO(0xef3012, 0, 64 * 1024, 4, SECT_4K) },
+	{ "w25x40", INFO(0xef3013, 0, 64 * 1024, 8, SECT_4K) },
+	{ "w25x80", INFO(0xef3014, 0, 64 * 1024, 16, SECT_4K) },
+	{ "w25x16", INFO(0xef3015, 0, 64 * 1024, 32, SECT_4K) },
+	{ "w25x32", INFO(0xef3016, 0, 64 * 1024, 64, SECT_4K) },
+	{ "w25x64", INFO(0xef3017, 0, 64 * 1024, 128, SECT_4K) },
+	{ },
 };
+MODULE_DEVICE_TABLE(spi, m25p_ids);
 
-static struct flash_info *__devinit jedec_probe(struct spi_device *spi)
+static const struct spi_device_id *__devinit jedec_probe(struct spi_device *spi)
 {
 	int			tmp;
 	u8			code = OPCODE_RDID;
@@ -575,16 +583,14 @@ static struct flash_info *__devinit jedec_probe(struct spi_device *spi)
 
 	ext_jedec = id[3] << 8 | id[4];
 
-	for (tmp = 0, info = m25p_data;
-			tmp < ARRAY_SIZE(m25p_data);
-			tmp++, info++) {
+	for (tmp = 0; tmp < ARRAY_SIZE(m25p_ids) - 1; tmp++) {
+		info = m25p_ids[tmp].data;
 		if (info->jedec_id == jedec) {
 			if (info->ext_id != 0 && info->ext_id != ext_jedec)
 				continue;
-			return info;
+			return &m25p_ids[tmp];
 		}
 	}
-	dev_err(&spi->dev, "unrecognized JEDEC id %06x\n", jedec);
 	return NULL;
 }
 
@@ -594,7 +600,8 @@ static struct flash_info *__devinit jedec_probe(struct spi_device *spi)
  * matches what the READ command supports, at least until this driver
  * understands FAST_READ (for clocks over 25 MHz).
  */
-static int __devinit m25p_probe(struct spi_device *spi)
+static int __devinit m25p_probe(struct spi_device *spi,
+				const struct spi_device_id *id)
 {
 	struct flash_platform_data	*data;
 	struct m25p			*flash;
@@ -608,32 +615,40 @@ static int __devinit m25p_probe(struct spi_device *spi)
 	 */
 	data = spi->dev.platform_data;
 	if (data && data->type) {
-		for (i = 0, info = m25p_data;
-				i < ARRAY_SIZE(m25p_data);
-				i++, info++) {
-			if (strcmp(data->type, info->name) == 0)
-				break;
+		for (i = 0; i < ARRAY_SIZE(m25p_ids) - 1; i++) {
+			id = &m25p_ids[i];
+			info = m25p_ids[i].data;
+			if (strcmp(data->type, id->name))
+				continue;
+			break;
 		}
 
 		/* unrecognized chip? */
-		if (i == ARRAY_SIZE(m25p_data)) {
+		if (i == ARRAY_SIZE(m25p_ids) - 1) {
 			DEBUG(MTD_DEBUG_LEVEL0, "%s: unrecognized id %s\n",
 					dev_name(&spi->dev), data->type);
 			info = NULL;
 
 		/* recognized; is that chip really what's there? */
 		} else if (info->jedec_id) {
-			struct flash_info	*chip = jedec_probe(spi);
+			id = jedec_probe(spi);
 
-			if (!chip || chip != info) {
+			if (id != &m25p_ids[i]) {
 				dev_warn(&spi->dev, "found %s, expected %s\n",
-						chip ? chip->name : "UNKNOWN",
-						info->name);
+						id ? id->name : "UNKNOWN",
+						m25p_ids[i].name);
 				info = NULL;
 			}
 		}
-	} else
-		info = jedec_probe(spi);
+	} else {
+		const struct spi_device_id *jid;
+
+		jid = jedec_probe(spi);
+		if (jid)
+			id = jid;
+
+		info = id ? id->data : NULL;
+	}
 
 	if (!info)
 		return -ENODEV;
@@ -680,7 +695,7 @@ static int __devinit m25p_probe(struct spi_device *spi)
 
 	flash->mtd.dev.parent = &spi->dev;
 
-	dev_info(&spi->dev, "%s (%lld Kbytes)\n", info->name,
+	dev_info(&spi->dev, "%s (%lld Kbytes)\n", id->name,
 			(long long)flash->mtd.size >> 10);
 
 	DEBUG(MTD_DEBUG_LEVEL2,
@@ -766,7 +781,8 @@ static struct spi_driver m25p80_driver = {
 		.bus	= &spi_bus_type,
 		.owner	= THIS_MODULE,
 	},
-	.probe	= m25p_probe,
+	.id_table	= m25p_ids,
+	.probe_id	= m25p_probe,
 	.remove	= __devexit_p(m25p_remove),
 
 	/* REVISIT: many of these chips have deep power-down modes, which
-- 
1.6.3.3


^ permalink raw reply related	[flat|nested] 68+ messages in thread

* [PATCH 2/7] mtd: m25p80: Convert to device table matching
@ 2009-07-29 17:05   ` Anton Vorontsov
  0 siblings, 0 replies; 68+ messages in thread
From: Anton Vorontsov @ 2009-07-29 17:05 UTC (permalink / raw)
  To: Andrew Morton
  Cc: David Brownell, linux-kernel, lm-sensors, linuxppc-dev,
	linux-mtd, Jean Delvare, David Woodhouse

This patch converts the m25p80 driver so that now it uses .id_table
for device matching, making it properly detect devices on OpenFirmware
platforms (prior to this patch the driver misdetected non-JEDEC chips,
seeing all chips as "m25p80").

Also, now jedec_probe() only does jedec probing, nothing else. If it
is not able to detect a chip, NULL is returned and the driver fall
backs to the information specified by the platform (platform_data, or
exact ID).

Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com>
---
 drivers/mtd/devices/m25p80.c |  152 +++++++++++++++++++++++-------------------
 1 files changed, 84 insertions(+), 68 deletions(-)

diff --git a/drivers/mtd/devices/m25p80.c b/drivers/mtd/devices/m25p80.c
index 10ed195..7c3efff 100644
--- a/drivers/mtd/devices/m25p80.c
+++ b/drivers/mtd/devices/m25p80.c
@@ -21,6 +21,7 @@
 #include <linux/interrupt.h>
 #include <linux/mutex.h>
 #include <linux/math64.h>
+#include <linux/mod_devicetable.h>
 
 #include <linux/mtd/mtd.h>
 #include <linux/mtd/partitions.h>
@@ -462,8 +463,6 @@ static int m25p80_write(struct mtd_info *mtd, loff_t to, size_t len,
  */
 
 struct flash_info {
-	char		*name;
-
 	/* JEDEC id zero means "no ID" (most older chips); otherwise it has
 	 * a high byte of zero plus three data bytes: the manufacturer id,
 	 * then a two byte device id.
@@ -481,74 +480,83 @@ struct flash_info {
 #define	SECT_4K		0x01		/* OPCODE_BE_4K works uniformly */
 };
 
+#define INFO(_jedec_id, _ext_id, _sector_size, _n_sectors, _flags)	\
+	(&(struct flash_info) {						\
+		.jedec_id = (_jedec_id),				\
+		.ext_id = (_ext_id),					\
+		.sector_size = (_sector_size),				\
+		.n_sectors = (_n_sectors),				\
+		.flags = (_flags),					\
+	})
 
 /* NOTE: double check command sets and memory organization when you add
  * more flash chips.  This current list focusses on newer chips, which
  * have been converging on command sets which including JEDEC ID.
  */
-static struct flash_info __devinitdata m25p_data [] = {
-
+static const struct spi_device_id m25p_ids[] = {
 	/* Atmel -- some are (confusingly) marketed as "DataFlash" */
-	{ "at25fs010",  0x1f6601, 0, 32 * 1024, 4, SECT_4K, },
-	{ "at25fs040",  0x1f6604, 0, 64 * 1024, 8, SECT_4K, },
+	{ "at25fs010",  INFO(0x1f6601, 0, 32 * 1024, 4, SECT_4K) },
+	{ "at25fs040",  INFO(0x1f6604, 0, 64 * 1024, 8, SECT_4K) },
 
-	{ "at25df041a", 0x1f4401, 0, 64 * 1024, 8, SECT_4K, },
-	{ "at25df641",  0x1f4800, 0, 64 * 1024, 128, SECT_4K, },
+	{ "at25df041a", INFO(0x1f4401, 0, 64 * 1024, 8, SECT_4K) },
+	{ "at25df641",  INFO(0x1f4800, 0, 64 * 1024, 128, SECT_4K) },
 
-	{ "at26f004",   0x1f0400, 0, 64 * 1024, 8, SECT_4K, },
-	{ "at26df081a", 0x1f4501, 0, 64 * 1024, 16, SECT_4K, },
-	{ "at26df161a", 0x1f4601, 0, 64 * 1024, 32, SECT_4K, },
-	{ "at26df321",  0x1f4701, 0, 64 * 1024, 64, SECT_4K, },
+	{ "at26f004",   INFO(0x1f0400, 0, 64 * 1024, 8, SECT_4K) },
+	{ "at26df081a", INFO(0x1f4501, 0, 64 * 1024, 16, SECT_4K) },
+	{ "at26df161a", INFO(0x1f4601, 0, 64 * 1024, 32, SECT_4K) },
+	{ "at26df321",  INFO(0x1f4701, 0, 64 * 1024, 64, SECT_4K) },
 
 	/* Macronix */
-	{ "mx25l12805d", 0xc22018, 0, 64 * 1024, 256, },
+	{ "mx25l12805d", INFO(0xc22018, 0, 64 * 1024, 256, 0) },
 
 	/* Spansion -- single (large) sector size only, at least
 	 * for the chips listed here (without boot sectors).
 	 */
-	{ "s25sl004a", 0x010212, 0, 64 * 1024, 8, },
-	{ "s25sl008a", 0x010213, 0, 64 * 1024, 16, },
-	{ "s25sl016a", 0x010214, 0, 64 * 1024, 32, },
-	{ "s25sl032a", 0x010215, 0, 64 * 1024, 64, },
-	{ "s25sl064a", 0x010216, 0, 64 * 1024, 128, },
-        { "s25sl12800", 0x012018, 0x0300, 256 * 1024, 64, },
-	{ "s25sl12801", 0x012018, 0x0301, 64 * 1024, 256, },
+	{ "s25sl004a",  INFO(0x010212, 0, 64 * 1024, 8, 0) },
+	{ "s25sl008a",  INFO(0x010213, 0, 64 * 1024, 16, 0) },
+	{ "s25sl016a",  INFO(0x010214, 0, 64 * 1024, 32, 0) },
+	{ "s25sl032a",  INFO(0x010215, 0, 64 * 1024, 64, 0) },
+	{ "s25sl064a",  INFO(0x010216, 0, 64 * 1024, 128, 0) },
+	{ "s25sl12800", INFO(0x012018, 0x0300, 256 * 1024, 64, 0) },
+	{ "s25sl12801", INFO(0x012018, 0x0301, 64 * 1024, 256, 0) },
 
 	/* SST -- large erase sizes are "overlays", "sectors" are 4K */
-	{ "sst25vf040b", 0xbf258d, 0, 64 * 1024, 8, SECT_4K, },
-	{ "sst25vf080b", 0xbf258e, 0, 64 * 1024, 16, SECT_4K, },
-	{ "sst25vf016b", 0xbf2541, 0, 64 * 1024, 32, SECT_4K, },
-	{ "sst25vf032b", 0xbf254a, 0, 64 * 1024, 64, SECT_4K, },
+	{ "sst25vf040b", INFO(0xbf258d, 0, 64 * 1024, 8, SECT_4K) },
+	{ "sst25vf080b", INFO(0xbf258e, 0, 64 * 1024, 16, SECT_4K) },
+	{ "sst25vf016b", INFO(0xbf2541, 0, 64 * 1024, 32, SECT_4K) },
+	{ "sst25vf032b", INFO(0xbf254a, 0, 64 * 1024, 64, SECT_4K) },
 
 	/* ST Microelectronics -- newer production may have feature updates */
-	{ "m25p05",  0x202010,  0, 32 * 1024, 2, },
-	{ "m25p10",  0x202011,  0, 32 * 1024, 4, },
-	{ "m25p20",  0x202012,  0, 64 * 1024, 4, },
-	{ "m25p40",  0x202013,  0, 64 * 1024, 8, },
-	{ "m25p80",         0,  0, 64 * 1024, 16, },
-	{ "m25p16",  0x202015,  0, 64 * 1024, 32, },
-	{ "m25p32",  0x202016,  0, 64 * 1024, 64, },
-	{ "m25p64",  0x202017,  0, 64 * 1024, 128, },
-	{ "m25p128", 0x202018, 0, 256 * 1024, 64, },
-
-	{ "m45pe10", 0x204011,  0, 64 * 1024, 2, },
-	{ "m45pe80", 0x204014,  0, 64 * 1024, 16, },
-	{ "m45pe16", 0x204015,  0, 64 * 1024, 32, },
-
-	{ "m25pe80", 0x208014,  0, 64 * 1024, 16, },
-	{ "m25pe16", 0x208015,  0, 64 * 1024, 32, SECT_4K, },
+	{ "m25p05",  INFO(0x202010,  0, 32 * 1024, 2, 0) },
+	{ "m25p10",  INFO(0x202011,  0, 32 * 1024, 4, 0) },
+	{ "m25p20",  INFO(0x202012,  0, 64 * 1024, 4, 0) },
+	{ "m25p40",  INFO(0x202013,  0, 64 * 1024, 8, 0) },
+	{ "m25p80",  INFO(0x202014,  0, 64 * 1024, 16, 0) },
+	{ "m25p16",  INFO(0x202015,  0, 64 * 1024, 32, 0) },
+	{ "m25p32",  INFO(0x202016,  0, 64 * 1024, 64, 0) },
+	{ "m25p64",  INFO(0x202017,  0, 64 * 1024, 128, 0) },
+	{ "m25p128", INFO(0x202018, 0, 256 * 1024, 64, 0) },
+
+	{ "m45pe10", INFO(0x204011,  0, 64 * 1024, 2, 0) },
+	{ "m45pe80", INFO(0x204014,  0, 64 * 1024, 16, 0) },
+	{ "m45pe16", INFO(0x204015,  0, 64 * 1024, 32, 0) },
+
+	{ "m25pe80", INFO(0x208014,  0, 64 * 1024, 16, 0) },
+	{ "m25pe16", INFO(0x208015,  0, 64 * 1024, 32, SECT_4K) },
 
 	/* Winbond -- w25x "blocks" are 64K, "sectors" are 4KiB */
-	{ "w25x10", 0xef3011, 0, 64 * 1024, 2, SECT_4K, },
-	{ "w25x20", 0xef3012, 0, 64 * 1024, 4, SECT_4K, },
-	{ "w25x40", 0xef3013, 0, 64 * 1024, 8, SECT_4K, },
-	{ "w25x80", 0xef3014, 0, 64 * 1024, 16, SECT_4K, },
-	{ "w25x16", 0xef3015, 0, 64 * 1024, 32, SECT_4K, },
-	{ "w25x32", 0xef3016, 0, 64 * 1024, 64, SECT_4K, },
-	{ "w25x64", 0xef3017, 0, 64 * 1024, 128, SECT_4K, },
+	{ "w25x10", INFO(0xef3011, 0, 64 * 1024, 2, SECT_4K) },
+	{ "w25x20", INFO(0xef3012, 0, 64 * 1024, 4, SECT_4K) },
+	{ "w25x40", INFO(0xef3013, 0, 64 * 1024, 8, SECT_4K) },
+	{ "w25x80", INFO(0xef3014, 0, 64 * 1024, 16, SECT_4K) },
+	{ "w25x16", INFO(0xef3015, 0, 64 * 1024, 32, SECT_4K) },
+	{ "w25x32", INFO(0xef3016, 0, 64 * 1024, 64, SECT_4K) },
+	{ "w25x64", INFO(0xef3017, 0, 64 * 1024, 128, SECT_4K) },
+	{ },
 };
+MODULE_DEVICE_TABLE(spi, m25p_ids);
 
-static struct flash_info *__devinit jedec_probe(struct spi_device *spi)
+static const struct spi_device_id *__devinit jedec_probe(struct spi_device *spi)
 {
 	int			tmp;
 	u8			code = OPCODE_RDID;
@@ -575,16 +583,14 @@ static struct flash_info *__devinit jedec_probe(struct spi_device *spi)
 
 	ext_jedec = id[3] << 8 | id[4];
 
-	for (tmp = 0, info = m25p_data;
-			tmp < ARRAY_SIZE(m25p_data);
-			tmp++, info++) {
+	for (tmp = 0; tmp < ARRAY_SIZE(m25p_ids) - 1; tmp++) {
+		info = m25p_ids[tmp].data;
 		if (info->jedec_id == jedec) {
 			if (info->ext_id != 0 && info->ext_id != ext_jedec)
 				continue;
-			return info;
+			return &m25p_ids[tmp];
 		}
 	}
-	dev_err(&spi->dev, "unrecognized JEDEC id %06x\n", jedec);
 	return NULL;
 }
 
@@ -594,7 +600,8 @@ static struct flash_info *__devinit jedec_probe(struct spi_device *spi)
  * matches what the READ command supports, at least until this driver
  * understands FAST_READ (for clocks over 25 MHz).
  */
-static int __devinit m25p_probe(struct spi_device *spi)
+static int __devinit m25p_probe(struct spi_device *spi,
+				const struct spi_device_id *id)
 {
 	struct flash_platform_data	*data;
 	struct m25p			*flash;
@@ -608,32 +615,40 @@ static int __devinit m25p_probe(struct spi_device *spi)
 	 */
 	data = spi->dev.platform_data;
 	if (data && data->type) {
-		for (i = 0, info = m25p_data;
-				i < ARRAY_SIZE(m25p_data);
-				i++, info++) {
-			if (strcmp(data->type, info->name) == 0)
-				break;
+		for (i = 0; i < ARRAY_SIZE(m25p_ids) - 1; i++) {
+			id = &m25p_ids[i];
+			info = m25p_ids[i].data;
+			if (strcmp(data->type, id->name))
+				continue;
+			break;
 		}
 
 		/* unrecognized chip? */
-		if (i == ARRAY_SIZE(m25p_data)) {
+		if (i == ARRAY_SIZE(m25p_ids) - 1) {
 			DEBUG(MTD_DEBUG_LEVEL0, "%s: unrecognized id %s\n",
 					dev_name(&spi->dev), data->type);
 			info = NULL;
 
 		/* recognized; is that chip really what's there? */
 		} else if (info->jedec_id) {
-			struct flash_info	*chip = jedec_probe(spi);
+			id = jedec_probe(spi);
 
-			if (!chip || chip != info) {
+			if (id != &m25p_ids[i]) {
 				dev_warn(&spi->dev, "found %s, expected %s\n",
-						chip ? chip->name : "UNKNOWN",
-						info->name);
+						id ? id->name : "UNKNOWN",
+						m25p_ids[i].name);
 				info = NULL;
 			}
 		}
-	} else
-		info = jedec_probe(spi);
+	} else {
+		const struct spi_device_id *jid;
+
+		jid = jedec_probe(spi);
+		if (jid)
+			id = jid;
+
+		info = id ? id->data : NULL;
+	}
 
 	if (!info)
 		return -ENODEV;
@@ -680,7 +695,7 @@ static int __devinit m25p_probe(struct spi_device *spi)
 
 	flash->mtd.dev.parent = &spi->dev;
 
-	dev_info(&spi->dev, "%s (%lld Kbytes)\n", info->name,
+	dev_info(&spi->dev, "%s (%lld Kbytes)\n", id->name,
 			(long long)flash->mtd.size >> 10);
 
 	DEBUG(MTD_DEBUG_LEVEL2,
@@ -766,7 +781,8 @@ static struct spi_driver m25p80_driver = {
 		.bus	= &spi_bus_type,
 		.owner	= THIS_MODULE,
 	},
-	.probe	= m25p_probe,
+	.id_table	= m25p_ids,
+	.probe_id	= m25p_probe,
 	.remove	= __devexit_p(m25p_remove),
 
 	/* REVISIT: many of these chips have deep power-down modes, which
-- 
1.6.3.3

^ permalink raw reply related	[flat|nested] 68+ messages in thread

* [PATCH 2/7] mtd: m25p80: Convert to device table matching
@ 2009-07-29 17:05   ` Anton Vorontsov
  0 siblings, 0 replies; 68+ messages in thread
From: Anton Vorontsov @ 2009-07-29 17:05 UTC (permalink / raw)
  To: Andrew Morton
  Cc: David Brownell, linux-kernel, lm-sensors, Grant Likely,
	linuxppc-dev, linux-mtd, Jean Delvare, David Woodhouse

This patch converts the m25p80 driver so that now it uses .id_table
for device matching, making it properly detect devices on OpenFirmware
platforms (prior to this patch the driver misdetected non-JEDEC chips,
seeing all chips as "m25p80").

Also, now jedec_probe() only does jedec probing, nothing else. If it
is not able to detect a chip, NULL is returned and the driver fall
backs to the information specified by the platform (platform_data, or
exact ID).

Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com>
---
 drivers/mtd/devices/m25p80.c |  152 +++++++++++++++++++++++-------------------
 1 files changed, 84 insertions(+), 68 deletions(-)

diff --git a/drivers/mtd/devices/m25p80.c b/drivers/mtd/devices/m25p80.c
index 10ed195..7c3efff 100644
--- a/drivers/mtd/devices/m25p80.c
+++ b/drivers/mtd/devices/m25p80.c
@@ -21,6 +21,7 @@
 #include <linux/interrupt.h>
 #include <linux/mutex.h>
 #include <linux/math64.h>
+#include <linux/mod_devicetable.h>
 
 #include <linux/mtd/mtd.h>
 #include <linux/mtd/partitions.h>
@@ -462,8 +463,6 @@ static int m25p80_write(struct mtd_info *mtd, loff_t to, size_t len,
  */
 
 struct flash_info {
-	char		*name;
-
 	/* JEDEC id zero means "no ID" (most older chips); otherwise it has
 	 * a high byte of zero plus three data bytes: the manufacturer id,
 	 * then a two byte device id.
@@ -481,74 +480,83 @@ struct flash_info {
 #define	SECT_4K		0x01		/* OPCODE_BE_4K works uniformly */
 };
 
+#define INFO(_jedec_id, _ext_id, _sector_size, _n_sectors, _flags)	\
+	(&(struct flash_info) {						\
+		.jedec_id = (_jedec_id),				\
+		.ext_id = (_ext_id),					\
+		.sector_size = (_sector_size),				\
+		.n_sectors = (_n_sectors),				\
+		.flags = (_flags),					\
+	})
 
 /* NOTE: double check command sets and memory organization when you add
  * more flash chips.  This current list focusses on newer chips, which
  * have been converging on command sets which including JEDEC ID.
  */
-static struct flash_info __devinitdata m25p_data [] = {
-
+static const struct spi_device_id m25p_ids[] = {
 	/* Atmel -- some are (confusingly) marketed as "DataFlash" */
-	{ "at25fs010",  0x1f6601, 0, 32 * 1024, 4, SECT_4K, },
-	{ "at25fs040",  0x1f6604, 0, 64 * 1024, 8, SECT_4K, },
+	{ "at25fs010",  INFO(0x1f6601, 0, 32 * 1024, 4, SECT_4K) },
+	{ "at25fs040",  INFO(0x1f6604, 0, 64 * 1024, 8, SECT_4K) },
 
-	{ "at25df041a", 0x1f4401, 0, 64 * 1024, 8, SECT_4K, },
-	{ "at25df641",  0x1f4800, 0, 64 * 1024, 128, SECT_4K, },
+	{ "at25df041a", INFO(0x1f4401, 0, 64 * 1024, 8, SECT_4K) },
+	{ "at25df641",  INFO(0x1f4800, 0, 64 * 1024, 128, SECT_4K) },
 
-	{ "at26f004",   0x1f0400, 0, 64 * 1024, 8, SECT_4K, },
-	{ "at26df081a", 0x1f4501, 0, 64 * 1024, 16, SECT_4K, },
-	{ "at26df161a", 0x1f4601, 0, 64 * 1024, 32, SECT_4K, },
-	{ "at26df321",  0x1f4701, 0, 64 * 1024, 64, SECT_4K, },
+	{ "at26f004",   INFO(0x1f0400, 0, 64 * 1024, 8, SECT_4K) },
+	{ "at26df081a", INFO(0x1f4501, 0, 64 * 1024, 16, SECT_4K) },
+	{ "at26df161a", INFO(0x1f4601, 0, 64 * 1024, 32, SECT_4K) },
+	{ "at26df321",  INFO(0x1f4701, 0, 64 * 1024, 64, SECT_4K) },
 
 	/* Macronix */
-	{ "mx25l12805d", 0xc22018, 0, 64 * 1024, 256, },
+	{ "mx25l12805d", INFO(0xc22018, 0, 64 * 1024, 256, 0) },
 
 	/* Spansion -- single (large) sector size only, at least
 	 * for the chips listed here (without boot sectors).
 	 */
-	{ "s25sl004a", 0x010212, 0, 64 * 1024, 8, },
-	{ "s25sl008a", 0x010213, 0, 64 * 1024, 16, },
-	{ "s25sl016a", 0x010214, 0, 64 * 1024, 32, },
-	{ "s25sl032a", 0x010215, 0, 64 * 1024, 64, },
-	{ "s25sl064a", 0x010216, 0, 64 * 1024, 128, },
-        { "s25sl12800", 0x012018, 0x0300, 256 * 1024, 64, },
-	{ "s25sl12801", 0x012018, 0x0301, 64 * 1024, 256, },
+	{ "s25sl004a",  INFO(0x010212, 0, 64 * 1024, 8, 0) },
+	{ "s25sl008a",  INFO(0x010213, 0, 64 * 1024, 16, 0) },
+	{ "s25sl016a",  INFO(0x010214, 0, 64 * 1024, 32, 0) },
+	{ "s25sl032a",  INFO(0x010215, 0, 64 * 1024, 64, 0) },
+	{ "s25sl064a",  INFO(0x010216, 0, 64 * 1024, 128, 0) },
+	{ "s25sl12800", INFO(0x012018, 0x0300, 256 * 1024, 64, 0) },
+	{ "s25sl12801", INFO(0x012018, 0x0301, 64 * 1024, 256, 0) },
 
 	/* SST -- large erase sizes are "overlays", "sectors" are 4K */
-	{ "sst25vf040b", 0xbf258d, 0, 64 * 1024, 8, SECT_4K, },
-	{ "sst25vf080b", 0xbf258e, 0, 64 * 1024, 16, SECT_4K, },
-	{ "sst25vf016b", 0xbf2541, 0, 64 * 1024, 32, SECT_4K, },
-	{ "sst25vf032b", 0xbf254a, 0, 64 * 1024, 64, SECT_4K, },
+	{ "sst25vf040b", INFO(0xbf258d, 0, 64 * 1024, 8, SECT_4K) },
+	{ "sst25vf080b", INFO(0xbf258e, 0, 64 * 1024, 16, SECT_4K) },
+	{ "sst25vf016b", INFO(0xbf2541, 0, 64 * 1024, 32, SECT_4K) },
+	{ "sst25vf032b", INFO(0xbf254a, 0, 64 * 1024, 64, SECT_4K) },
 
 	/* ST Microelectronics -- newer production may have feature updates */
-	{ "m25p05",  0x202010,  0, 32 * 1024, 2, },
-	{ "m25p10",  0x202011,  0, 32 * 1024, 4, },
-	{ "m25p20",  0x202012,  0, 64 * 1024, 4, },
-	{ "m25p40",  0x202013,  0, 64 * 1024, 8, },
-	{ "m25p80",         0,  0, 64 * 1024, 16, },
-	{ "m25p16",  0x202015,  0, 64 * 1024, 32, },
-	{ "m25p32",  0x202016,  0, 64 * 1024, 64, },
-	{ "m25p64",  0x202017,  0, 64 * 1024, 128, },
-	{ "m25p128", 0x202018, 0, 256 * 1024, 64, },
-
-	{ "m45pe10", 0x204011,  0, 64 * 1024, 2, },
-	{ "m45pe80", 0x204014,  0, 64 * 1024, 16, },
-	{ "m45pe16", 0x204015,  0, 64 * 1024, 32, },
-
-	{ "m25pe80", 0x208014,  0, 64 * 1024, 16, },
-	{ "m25pe16", 0x208015,  0, 64 * 1024, 32, SECT_4K, },
+	{ "m25p05",  INFO(0x202010,  0, 32 * 1024, 2, 0) },
+	{ "m25p10",  INFO(0x202011,  0, 32 * 1024, 4, 0) },
+	{ "m25p20",  INFO(0x202012,  0, 64 * 1024, 4, 0) },
+	{ "m25p40",  INFO(0x202013,  0, 64 * 1024, 8, 0) },
+	{ "m25p80",  INFO(0x202014,  0, 64 * 1024, 16, 0) },
+	{ "m25p16",  INFO(0x202015,  0, 64 * 1024, 32, 0) },
+	{ "m25p32",  INFO(0x202016,  0, 64 * 1024, 64, 0) },
+	{ "m25p64",  INFO(0x202017,  0, 64 * 1024, 128, 0) },
+	{ "m25p128", INFO(0x202018, 0, 256 * 1024, 64, 0) },
+
+	{ "m45pe10", INFO(0x204011,  0, 64 * 1024, 2, 0) },
+	{ "m45pe80", INFO(0x204014,  0, 64 * 1024, 16, 0) },
+	{ "m45pe16", INFO(0x204015,  0, 64 * 1024, 32, 0) },
+
+	{ "m25pe80", INFO(0x208014,  0, 64 * 1024, 16, 0) },
+	{ "m25pe16", INFO(0x208015,  0, 64 * 1024, 32, SECT_4K) },
 
 	/* Winbond -- w25x "blocks" are 64K, "sectors" are 4KiB */
-	{ "w25x10", 0xef3011, 0, 64 * 1024, 2, SECT_4K, },
-	{ "w25x20", 0xef3012, 0, 64 * 1024, 4, SECT_4K, },
-	{ "w25x40", 0xef3013, 0, 64 * 1024, 8, SECT_4K, },
-	{ "w25x80", 0xef3014, 0, 64 * 1024, 16, SECT_4K, },
-	{ "w25x16", 0xef3015, 0, 64 * 1024, 32, SECT_4K, },
-	{ "w25x32", 0xef3016, 0, 64 * 1024, 64, SECT_4K, },
-	{ "w25x64", 0xef3017, 0, 64 * 1024, 128, SECT_4K, },
+	{ "w25x10", INFO(0xef3011, 0, 64 * 1024, 2, SECT_4K) },
+	{ "w25x20", INFO(0xef3012, 0, 64 * 1024, 4, SECT_4K) },
+	{ "w25x40", INFO(0xef3013, 0, 64 * 1024, 8, SECT_4K) },
+	{ "w25x80", INFO(0xef3014, 0, 64 * 1024, 16, SECT_4K) },
+	{ "w25x16", INFO(0xef3015, 0, 64 * 1024, 32, SECT_4K) },
+	{ "w25x32", INFO(0xef3016, 0, 64 * 1024, 64, SECT_4K) },
+	{ "w25x64", INFO(0xef3017, 0, 64 * 1024, 128, SECT_4K) },
+	{ },
 };
+MODULE_DEVICE_TABLE(spi, m25p_ids);
 
-static struct flash_info *__devinit jedec_probe(struct spi_device *spi)
+static const struct spi_device_id *__devinit jedec_probe(struct spi_device *spi)
 {
 	int			tmp;
 	u8			code = OPCODE_RDID;
@@ -575,16 +583,14 @@ static struct flash_info *__devinit jedec_probe(struct spi_device *spi)
 
 	ext_jedec = id[3] << 8 | id[4];
 
-	for (tmp = 0, info = m25p_data;
-			tmp < ARRAY_SIZE(m25p_data);
-			tmp++, info++) {
+	for (tmp = 0; tmp < ARRAY_SIZE(m25p_ids) - 1; tmp++) {
+		info = m25p_ids[tmp].data;
 		if (info->jedec_id == jedec) {
 			if (info->ext_id != 0 && info->ext_id != ext_jedec)
 				continue;
-			return info;
+			return &m25p_ids[tmp];
 		}
 	}
-	dev_err(&spi->dev, "unrecognized JEDEC id %06x\n", jedec);
 	return NULL;
 }
 
@@ -594,7 +600,8 @@ static struct flash_info *__devinit jedec_probe(struct spi_device *spi)
  * matches what the READ command supports, at least until this driver
  * understands FAST_READ (for clocks over 25 MHz).
  */
-static int __devinit m25p_probe(struct spi_device *spi)
+static int __devinit m25p_probe(struct spi_device *spi,
+				const struct spi_device_id *id)
 {
 	struct flash_platform_data	*data;
 	struct m25p			*flash;
@@ -608,32 +615,40 @@ static int __devinit m25p_probe(struct spi_device *spi)
 	 */
 	data = spi->dev.platform_data;
 	if (data && data->type) {
-		for (i = 0, info = m25p_data;
-				i < ARRAY_SIZE(m25p_data);
-				i++, info++) {
-			if (strcmp(data->type, info->name) == 0)
-				break;
+		for (i = 0; i < ARRAY_SIZE(m25p_ids) - 1; i++) {
+			id = &m25p_ids[i];
+			info = m25p_ids[i].data;
+			if (strcmp(data->type, id->name))
+				continue;
+			break;
 		}
 
 		/* unrecognized chip? */
-		if (i == ARRAY_SIZE(m25p_data)) {
+		if (i == ARRAY_SIZE(m25p_ids) - 1) {
 			DEBUG(MTD_DEBUG_LEVEL0, "%s: unrecognized id %s\n",
 					dev_name(&spi->dev), data->type);
 			info = NULL;
 
 		/* recognized; is that chip really what's there? */
 		} else if (info->jedec_id) {
-			struct flash_info	*chip = jedec_probe(spi);
+			id = jedec_probe(spi);
 
-			if (!chip || chip != info) {
+			if (id != &m25p_ids[i]) {
 				dev_warn(&spi->dev, "found %s, expected %s\n",
-						chip ? chip->name : "UNKNOWN",
-						info->name);
+						id ? id->name : "UNKNOWN",
+						m25p_ids[i].name);
 				info = NULL;
 			}
 		}
-	} else
-		info = jedec_probe(spi);
+	} else {
+		const struct spi_device_id *jid;
+
+		jid = jedec_probe(spi);
+		if (jid)
+			id = jid;
+
+		info = id ? id->data : NULL;
+	}
 
 	if (!info)
 		return -ENODEV;
@@ -680,7 +695,7 @@ static int __devinit m25p_probe(struct spi_device *spi)
 
 	flash->mtd.dev.parent = &spi->dev;
 
-	dev_info(&spi->dev, "%s (%lld Kbytes)\n", info->name,
+	dev_info(&spi->dev, "%s (%lld Kbytes)\n", id->name,
 			(long long)flash->mtd.size >> 10);
 
 	DEBUG(MTD_DEBUG_LEVEL2,
@@ -766,7 +781,8 @@ static struct spi_driver m25p80_driver = {
 		.bus	= &spi_bus_type,
 		.owner	= THIS_MODULE,
 	},
-	.probe	= m25p_probe,
+	.id_table	= m25p_ids,
+	.probe_id	= m25p_probe,
 	.remove	= __devexit_p(m25p_remove),
 
 	/* REVISIT: many of these chips have deep power-down modes, which
-- 
1.6.3.3

^ permalink raw reply related	[flat|nested] 68+ messages in thread

* [lm-sensors] [PATCH 2/7] mtd: m25p80: Convert to device table
@ 2009-07-29 17:05   ` Anton Vorontsov
  0 siblings, 0 replies; 68+ messages in thread
From: Anton Vorontsov @ 2009-07-29 17:05 UTC (permalink / raw)
  To: Andrew Morton
  Cc: David Brownell, David Woodhouse, Grant Likely, Jean Delvare,
	linux-mtd, linux-kernel, lm-sensors, linuxppc-dev

This patch converts the m25p80 driver so that now it uses .id_table
for device matching, making it properly detect devices on OpenFirmware
platforms (prior to this patch the driver misdetected non-JEDEC chips,
seeing all chips as "m25p80").

Also, now jedec_probe() only does jedec probing, nothing else. If it
is not able to detect a chip, NULL is returned and the driver fall
backs to the information specified by the platform (platform_data, or
exact ID).

Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com>
---
 drivers/mtd/devices/m25p80.c |  152 +++++++++++++++++++++++-------------------
 1 files changed, 84 insertions(+), 68 deletions(-)

diff --git a/drivers/mtd/devices/m25p80.c b/drivers/mtd/devices/m25p80.c
index 10ed195..7c3efff 100644
--- a/drivers/mtd/devices/m25p80.c
+++ b/drivers/mtd/devices/m25p80.c
@@ -21,6 +21,7 @@
 #include <linux/interrupt.h>
 #include <linux/mutex.h>
 #include <linux/math64.h>
+#include <linux/mod_devicetable.h>
 
 #include <linux/mtd/mtd.h>
 #include <linux/mtd/partitions.h>
@@ -462,8 +463,6 @@ static int m25p80_write(struct mtd_info *mtd, loff_t to, size_t len,
  */
 
 struct flash_info {
-	char		*name;
-
 	/* JEDEC id zero means "no ID" (most older chips); otherwise it has
 	 * a high byte of zero plus three data bytes: the manufacturer id,
 	 * then a two byte device id.
@@ -481,74 +480,83 @@ struct flash_info {
 #define	SECT_4K		0x01		/* OPCODE_BE_4K works uniformly */
 };
 
+#define INFO(_jedec_id, _ext_id, _sector_size, _n_sectors, _flags)	\
+	(&(struct flash_info) {						\
+		.jedec_id = (_jedec_id),				\
+		.ext_id = (_ext_id),					\
+		.sector_size = (_sector_size),				\
+		.n_sectors = (_n_sectors),				\
+		.flags = (_flags),					\
+	})
 
 /* NOTE: double check command sets and memory organization when you add
  * more flash chips.  This current list focusses on newer chips, which
  * have been converging on command sets which including JEDEC ID.
  */
-static struct flash_info __devinitdata m25p_data [] = {
-
+static const struct spi_device_id m25p_ids[] = {
 	/* Atmel -- some are (confusingly) marketed as "DataFlash" */
-	{ "at25fs010",  0x1f6601, 0, 32 * 1024, 4, SECT_4K, },
-	{ "at25fs040",  0x1f6604, 0, 64 * 1024, 8, SECT_4K, },
+	{ "at25fs010",  INFO(0x1f6601, 0, 32 * 1024, 4, SECT_4K) },
+	{ "at25fs040",  INFO(0x1f6604, 0, 64 * 1024, 8, SECT_4K) },
 
-	{ "at25df041a", 0x1f4401, 0, 64 * 1024, 8, SECT_4K, },
-	{ "at25df641",  0x1f4800, 0, 64 * 1024, 128, SECT_4K, },
+	{ "at25df041a", INFO(0x1f4401, 0, 64 * 1024, 8, SECT_4K) },
+	{ "at25df641",  INFO(0x1f4800, 0, 64 * 1024, 128, SECT_4K) },
 
-	{ "at26f004",   0x1f0400, 0, 64 * 1024, 8, SECT_4K, },
-	{ "at26df081a", 0x1f4501, 0, 64 * 1024, 16, SECT_4K, },
-	{ "at26df161a", 0x1f4601, 0, 64 * 1024, 32, SECT_4K, },
-	{ "at26df321",  0x1f4701, 0, 64 * 1024, 64, SECT_4K, },
+	{ "at26f004",   INFO(0x1f0400, 0, 64 * 1024, 8, SECT_4K) },
+	{ "at26df081a", INFO(0x1f4501, 0, 64 * 1024, 16, SECT_4K) },
+	{ "at26df161a", INFO(0x1f4601, 0, 64 * 1024, 32, SECT_4K) },
+	{ "at26df321",  INFO(0x1f4701, 0, 64 * 1024, 64, SECT_4K) },
 
 	/* Macronix */
-	{ "mx25l12805d", 0xc22018, 0, 64 * 1024, 256, },
+	{ "mx25l12805d", INFO(0xc22018, 0, 64 * 1024, 256, 0) },
 
 	/* Spansion -- single (large) sector size only, at least
 	 * for the chips listed here (without boot sectors).
 	 */
-	{ "s25sl004a", 0x010212, 0, 64 * 1024, 8, },
-	{ "s25sl008a", 0x010213, 0, 64 * 1024, 16, },
-	{ "s25sl016a", 0x010214, 0, 64 * 1024, 32, },
-	{ "s25sl032a", 0x010215, 0, 64 * 1024, 64, },
-	{ "s25sl064a", 0x010216, 0, 64 * 1024, 128, },
-        { "s25sl12800", 0x012018, 0x0300, 256 * 1024, 64, },
-	{ "s25sl12801", 0x012018, 0x0301, 64 * 1024, 256, },
+	{ "s25sl004a",  INFO(0x010212, 0, 64 * 1024, 8, 0) },
+	{ "s25sl008a",  INFO(0x010213, 0, 64 * 1024, 16, 0) },
+	{ "s25sl016a",  INFO(0x010214, 0, 64 * 1024, 32, 0) },
+	{ "s25sl032a",  INFO(0x010215, 0, 64 * 1024, 64, 0) },
+	{ "s25sl064a",  INFO(0x010216, 0, 64 * 1024, 128, 0) },
+	{ "s25sl12800", INFO(0x012018, 0x0300, 256 * 1024, 64, 0) },
+	{ "s25sl12801", INFO(0x012018, 0x0301, 64 * 1024, 256, 0) },
 
 	/* SST -- large erase sizes are "overlays", "sectors" are 4K */
-	{ "sst25vf040b", 0xbf258d, 0, 64 * 1024, 8, SECT_4K, },
-	{ "sst25vf080b", 0xbf258e, 0, 64 * 1024, 16, SECT_4K, },
-	{ "sst25vf016b", 0xbf2541, 0, 64 * 1024, 32, SECT_4K, },
-	{ "sst25vf032b", 0xbf254a, 0, 64 * 1024, 64, SECT_4K, },
+	{ "sst25vf040b", INFO(0xbf258d, 0, 64 * 1024, 8, SECT_4K) },
+	{ "sst25vf080b", INFO(0xbf258e, 0, 64 * 1024, 16, SECT_4K) },
+	{ "sst25vf016b", INFO(0xbf2541, 0, 64 * 1024, 32, SECT_4K) },
+	{ "sst25vf032b", INFO(0xbf254a, 0, 64 * 1024, 64, SECT_4K) },
 
 	/* ST Microelectronics -- newer production may have feature updates */
-	{ "m25p05",  0x202010,  0, 32 * 1024, 2, },
-	{ "m25p10",  0x202011,  0, 32 * 1024, 4, },
-	{ "m25p20",  0x202012,  0, 64 * 1024, 4, },
-	{ "m25p40",  0x202013,  0, 64 * 1024, 8, },
-	{ "m25p80",         0,  0, 64 * 1024, 16, },
-	{ "m25p16",  0x202015,  0, 64 * 1024, 32, },
-	{ "m25p32",  0x202016,  0, 64 * 1024, 64, },
-	{ "m25p64",  0x202017,  0, 64 * 1024, 128, },
-	{ "m25p128", 0x202018, 0, 256 * 1024, 64, },
-
-	{ "m45pe10", 0x204011,  0, 64 * 1024, 2, },
-	{ "m45pe80", 0x204014,  0, 64 * 1024, 16, },
-	{ "m45pe16", 0x204015,  0, 64 * 1024, 32, },
-
-	{ "m25pe80", 0x208014,  0, 64 * 1024, 16, },
-	{ "m25pe16", 0x208015,  0, 64 * 1024, 32, SECT_4K, },
+	{ "m25p05",  INFO(0x202010,  0, 32 * 1024, 2, 0) },
+	{ "m25p10",  INFO(0x202011,  0, 32 * 1024, 4, 0) },
+	{ "m25p20",  INFO(0x202012,  0, 64 * 1024, 4, 0) },
+	{ "m25p40",  INFO(0x202013,  0, 64 * 1024, 8, 0) },
+	{ "m25p80",  INFO(0x202014,  0, 64 * 1024, 16, 0) },
+	{ "m25p16",  INFO(0x202015,  0, 64 * 1024, 32, 0) },
+	{ "m25p32",  INFO(0x202016,  0, 64 * 1024, 64, 0) },
+	{ "m25p64",  INFO(0x202017,  0, 64 * 1024, 128, 0) },
+	{ "m25p128", INFO(0x202018, 0, 256 * 1024, 64, 0) },
+
+	{ "m45pe10", INFO(0x204011,  0, 64 * 1024, 2, 0) },
+	{ "m45pe80", INFO(0x204014,  0, 64 * 1024, 16, 0) },
+	{ "m45pe16", INFO(0x204015,  0, 64 * 1024, 32, 0) },
+
+	{ "m25pe80", INFO(0x208014,  0, 64 * 1024, 16, 0) },
+	{ "m25pe16", INFO(0x208015,  0, 64 * 1024, 32, SECT_4K) },
 
 	/* Winbond -- w25x "blocks" are 64K, "sectors" are 4KiB */
-	{ "w25x10", 0xef3011, 0, 64 * 1024, 2, SECT_4K, },
-	{ "w25x20", 0xef3012, 0, 64 * 1024, 4, SECT_4K, },
-	{ "w25x40", 0xef3013, 0, 64 * 1024, 8, SECT_4K, },
-	{ "w25x80", 0xef3014, 0, 64 * 1024, 16, SECT_4K, },
-	{ "w25x16", 0xef3015, 0, 64 * 1024, 32, SECT_4K, },
-	{ "w25x32", 0xef3016, 0, 64 * 1024, 64, SECT_4K, },
-	{ "w25x64", 0xef3017, 0, 64 * 1024, 128, SECT_4K, },
+	{ "w25x10", INFO(0xef3011, 0, 64 * 1024, 2, SECT_4K) },
+	{ "w25x20", INFO(0xef3012, 0, 64 * 1024, 4, SECT_4K) },
+	{ "w25x40", INFO(0xef3013, 0, 64 * 1024, 8, SECT_4K) },
+	{ "w25x80", INFO(0xef3014, 0, 64 * 1024, 16, SECT_4K) },
+	{ "w25x16", INFO(0xef3015, 0, 64 * 1024, 32, SECT_4K) },
+	{ "w25x32", INFO(0xef3016, 0, 64 * 1024, 64, SECT_4K) },
+	{ "w25x64", INFO(0xef3017, 0, 64 * 1024, 128, SECT_4K) },
+	{ },
 };
+MODULE_DEVICE_TABLE(spi, m25p_ids);
 
-static struct flash_info *__devinit jedec_probe(struct spi_device *spi)
+static const struct spi_device_id *__devinit jedec_probe(struct spi_device *spi)
 {
 	int			tmp;
 	u8			code = OPCODE_RDID;
@@ -575,16 +583,14 @@ static struct flash_info *__devinit jedec_probe(struct spi_device *spi)
 
 	ext_jedec = id[3] << 8 | id[4];
 
-	for (tmp = 0, info = m25p_data;
-			tmp < ARRAY_SIZE(m25p_data);
-			tmp++, info++) {
+	for (tmp = 0; tmp < ARRAY_SIZE(m25p_ids) - 1; tmp++) {
+		info = m25p_ids[tmp].data;
 		if (info->jedec_id = jedec) {
 			if (info->ext_id != 0 && info->ext_id != ext_jedec)
 				continue;
-			return info;
+			return &m25p_ids[tmp];
 		}
 	}
-	dev_err(&spi->dev, "unrecognized JEDEC id %06x\n", jedec);
 	return NULL;
 }
 
@@ -594,7 +600,8 @@ static struct flash_info *__devinit jedec_probe(struct spi_device *spi)
  * matches what the READ command supports, at least until this driver
  * understands FAST_READ (for clocks over 25 MHz).
  */
-static int __devinit m25p_probe(struct spi_device *spi)
+static int __devinit m25p_probe(struct spi_device *spi,
+				const struct spi_device_id *id)
 {
 	struct flash_platform_data	*data;
 	struct m25p			*flash;
@@ -608,32 +615,40 @@ static int __devinit m25p_probe(struct spi_device *spi)
 	 */
 	data = spi->dev.platform_data;
 	if (data && data->type) {
-		for (i = 0, info = m25p_data;
-				i < ARRAY_SIZE(m25p_data);
-				i++, info++) {
-			if (strcmp(data->type, info->name) = 0)
-				break;
+		for (i = 0; i < ARRAY_SIZE(m25p_ids) - 1; i++) {
+			id = &m25p_ids[i];
+			info = m25p_ids[i].data;
+			if (strcmp(data->type, id->name))
+				continue;
+			break;
 		}
 
 		/* unrecognized chip? */
-		if (i = ARRAY_SIZE(m25p_data)) {
+		if (i = ARRAY_SIZE(m25p_ids) - 1) {
 			DEBUG(MTD_DEBUG_LEVEL0, "%s: unrecognized id %s\n",
 					dev_name(&spi->dev), data->type);
 			info = NULL;
 
 		/* recognized; is that chip really what's there? */
 		} else if (info->jedec_id) {
-			struct flash_info	*chip = jedec_probe(spi);
+			id = jedec_probe(spi);
 
-			if (!chip || chip != info) {
+			if (id != &m25p_ids[i]) {
 				dev_warn(&spi->dev, "found %s, expected %s\n",
-						chip ? chip->name : "UNKNOWN",
-						info->name);
+						id ? id->name : "UNKNOWN",
+						m25p_ids[i].name);
 				info = NULL;
 			}
 		}
-	} else
-		info = jedec_probe(spi);
+	} else {
+		const struct spi_device_id *jid;
+
+		jid = jedec_probe(spi);
+		if (jid)
+			id = jid;
+
+		info = id ? id->data : NULL;
+	}
 
 	if (!info)
 		return -ENODEV;
@@ -680,7 +695,7 @@ static int __devinit m25p_probe(struct spi_device *spi)
 
 	flash->mtd.dev.parent = &spi->dev;
 
-	dev_info(&spi->dev, "%s (%lld Kbytes)\n", info->name,
+	dev_info(&spi->dev, "%s (%lld Kbytes)\n", id->name,
 			(long long)flash->mtd.size >> 10);
 
 	DEBUG(MTD_DEBUG_LEVEL2,
@@ -766,7 +781,8 @@ static struct spi_driver m25p80_driver = {
 		.bus	= &spi_bus_type,
 		.owner	= THIS_MODULE,
 	},
-	.probe	= m25p_probe,
+	.id_table	= m25p_ids,
+	.probe_id	= m25p_probe,
 	.remove	= __devexit_p(m25p_remove),
 
 	/* REVISIT: many of these chips have deep power-down modes, which
-- 
1.6.3.3


_______________________________________________
lm-sensors mailing list
lm-sensors@lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

^ permalink raw reply related	[flat|nested] 68+ messages in thread

* [PATCH 3/7] of: Remove "stm,m25p40" alias
  2009-07-29 17:03 ` Anton Vorontsov
  (?)
  (?)
@ 2009-07-29 17:05   ` Anton Vorontsov
  -1 siblings, 0 replies; 68+ messages in thread
From: Anton Vorontsov @ 2009-07-29 17:05 UTC (permalink / raw)
  To: Andrew Morton
  Cc: David Brownell, David Woodhouse, Grant Likely, Jean Delvare,
	linux-mtd, linux-kernel, lm-sensors, linuxppc-dev

The alias isn't needed any longer since the m25p80 driver converted
to the module device table matching.

Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com>
---
 drivers/of/base.c |    1 -
 1 files changed, 0 insertions(+), 1 deletions(-)

diff --git a/drivers/of/base.c b/drivers/of/base.c
index 69f85c0..ddf224d 100644
--- a/drivers/of/base.c
+++ b/drivers/of/base.c
@@ -447,7 +447,6 @@ struct of_modalias_table {
 static struct of_modalias_table of_modalias_table[] = {
 	{ "fsl,mcu-mpc8349emitx", "mcu-mpc8349emitx" },
 	{ "mmc-spi-slot", "mmc_spi" },
-	{ "stm,m25p40", "m25p80" },
 };
 
 /**
-- 
1.6.3.3


^ permalink raw reply related	[flat|nested] 68+ messages in thread

* [PATCH 3/7] of: Remove "stm,m25p40" alias
@ 2009-07-29 17:05   ` Anton Vorontsov
  0 siblings, 0 replies; 68+ messages in thread
From: Anton Vorontsov @ 2009-07-29 17:05 UTC (permalink / raw)
  To: Andrew Morton
  Cc: David Brownell, linux-kernel, lm-sensors, linuxppc-dev,
	linux-mtd, Jean Delvare, David Woodhouse

The alias isn't needed any longer since the m25p80 driver converted
to the module device table matching.

Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com>
---
 drivers/of/base.c |    1 -
 1 files changed, 0 insertions(+), 1 deletions(-)

diff --git a/drivers/of/base.c b/drivers/of/base.c
index 69f85c0..ddf224d 100644
--- a/drivers/of/base.c
+++ b/drivers/of/base.c
@@ -447,7 +447,6 @@ struct of_modalias_table {
 static struct of_modalias_table of_modalias_table[] = {
 	{ "fsl,mcu-mpc8349emitx", "mcu-mpc8349emitx" },
 	{ "mmc-spi-slot", "mmc_spi" },
-	{ "stm,m25p40", "m25p80" },
 };
 
 /**
-- 
1.6.3.3

^ permalink raw reply related	[flat|nested] 68+ messages in thread

* [PATCH 3/7] of: Remove "stm,m25p40" alias
@ 2009-07-29 17:05   ` Anton Vorontsov
  0 siblings, 0 replies; 68+ messages in thread
From: Anton Vorontsov @ 2009-07-29 17:05 UTC (permalink / raw)
  To: Andrew Morton
  Cc: David Brownell, linux-kernel, lm-sensors, Grant Likely,
	linuxppc-dev, linux-mtd, Jean Delvare, David Woodhouse

The alias isn't needed any longer since the m25p80 driver converted
to the module device table matching.

Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com>
---
 drivers/of/base.c |    1 -
 1 files changed, 0 insertions(+), 1 deletions(-)

diff --git a/drivers/of/base.c b/drivers/of/base.c
index 69f85c0..ddf224d 100644
--- a/drivers/of/base.c
+++ b/drivers/of/base.c
@@ -447,7 +447,6 @@ struct of_modalias_table {
 static struct of_modalias_table of_modalias_table[] = {
 	{ "fsl,mcu-mpc8349emitx", "mcu-mpc8349emitx" },
 	{ "mmc-spi-slot", "mmc_spi" },
-	{ "stm,m25p40", "m25p80" },
 };
 
 /**
-- 
1.6.3.3

^ permalink raw reply related	[flat|nested] 68+ messages in thread

* [lm-sensors] [PATCH 3/7] of: Remove "stm,m25p40" alias
@ 2009-07-29 17:05   ` Anton Vorontsov
  0 siblings, 0 replies; 68+ messages in thread
From: Anton Vorontsov @ 2009-07-29 17:05 UTC (permalink / raw)
  To: Andrew Morton
  Cc: David Brownell, David Woodhouse, Grant Likely, Jean Delvare,
	linux-mtd, linux-kernel, lm-sensors, linuxppc-dev

The alias isn't needed any longer since the m25p80 driver converted
to the module device table matching.

Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com>
---
 drivers/of/base.c |    1 -
 1 files changed, 0 insertions(+), 1 deletions(-)

diff --git a/drivers/of/base.c b/drivers/of/base.c
index 69f85c0..ddf224d 100644
--- a/drivers/of/base.c
+++ b/drivers/of/base.c
@@ -447,7 +447,6 @@ struct of_modalias_table {
 static struct of_modalias_table of_modalias_table[] = {
 	{ "fsl,mcu-mpc8349emitx", "mcu-mpc8349emitx" },
 	{ "mmc-spi-slot", "mmc_spi" },
-	{ "stm,m25p40", "m25p80" },
 };
 
 /**
-- 
1.6.3.3


_______________________________________________
lm-sensors mailing list
lm-sensors@lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

^ permalink raw reply related	[flat|nested] 68+ messages in thread

* [PATCH 4/7] spi: Prefix modalias with "spi:"
  2009-07-29 17:03 ` Anton Vorontsov
  (?)
  (?)
@ 2009-07-29 17:05   ` Anton Vorontsov
  -1 siblings, 0 replies; 68+ messages in thread
From: Anton Vorontsov @ 2009-07-29 17:05 UTC (permalink / raw)
  To: Andrew Morton
  Cc: David Brownell, David Woodhouse, Grant Likely, Jean Delvare,
	linux-mtd, linux-kernel, lm-sensors, linuxppc-dev

This makes it consistent with other buses (platform, i2c, vio, ...).
I'm not sure why we use the prefixes, but there must be a reason.

This was easy enough to do it, and I did it.

Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com>
---
 drivers/gpio/max7301.c                 |    1 +
 drivers/gpio/mcp23s08.c                |    1 +
 drivers/hwmon/adcxx.c                  |    8 ++++----
 drivers/hwmon/lis3lv02d_spi.c          |    2 +-
 drivers/hwmon/lm70.c                   |    2 ++
 drivers/hwmon/max1111.c                |    1 +
 drivers/input/touchscreen/ad7877.c     |    1 +
 drivers/input/touchscreen/ad7879.c     |    1 +
 drivers/input/touchscreen/ads7846.c    |    1 +
 drivers/leds/leds-dac124s085.c         |    1 +
 drivers/mfd/ezx-pcap.c                 |    1 +
 drivers/misc/eeprom/at25.c             |    2 +-
 drivers/mmc/host/mmc_spi.c             |    1 +
 drivers/mtd/devices/mtd_dataflash.c    |    1 +
 drivers/net/enc28j60.c                 |    1 +
 drivers/net/ks8851.c                   |    1 +
 drivers/net/wireless/libertas/if_spi.c |    1 +
 drivers/net/wireless/p54/p54spi.c      |    1 +
 drivers/net/wireless/wl12xx/main.c     |    1 +
 drivers/rtc/rtc-ds1305.c               |    1 +
 drivers/rtc/rtc-ds1390.c               |    1 +
 drivers/rtc/rtc-ds3234.c               |    1 +
 drivers/rtc/rtc-m41t94.c               |    1 +
 drivers/rtc/rtc-max6902.c              |    1 +
 drivers/rtc/rtc-r9701.c                |    1 +
 drivers/rtc/rtc-rs5c348.c              |    1 +
 drivers/serial/max3100.c               |    1 +
 drivers/spi/spi.c                      |    3 ++-
 drivers/spi/spidev.c                   |    1 +
 drivers/spi/tle62x0.c                  |    1 +
 drivers/staging/stlc45xx/stlc45xx.c    |    1 +
 drivers/video/backlight/corgi_lcd.c    |    1 +
 drivers/video/backlight/ltv350qv.c     |    1 +
 drivers/video/backlight/tdo24m.c       |    1 +
 drivers/video/backlight/tosa_lcd.c     |    2 +-
 drivers/video/backlight/vgg2432a4.c    |    3 +--
 include/linux/mod_devicetable.h        |    1 +
 scripts/mod/file2alias.c               |    4 ++--
 38 files changed, 44 insertions(+), 12 deletions(-)

diff --git a/drivers/gpio/max7301.c b/drivers/gpio/max7301.c
index 7b82eaa..480956f 100644
--- a/drivers/gpio/max7301.c
+++ b/drivers/gpio/max7301.c
@@ -339,3 +339,4 @@ module_exit(max7301_exit);
 MODULE_AUTHOR("Juergen Beisert");
 MODULE_LICENSE("GPL v2");
 MODULE_DESCRIPTION("MAX7301 SPI based GPIO-Expander");
+MODULE_ALIAS("spi:" DRIVER_NAME);
diff --git a/drivers/gpio/mcp23s08.c b/drivers/gpio/mcp23s08.c
index f6fae0e..c6c7aa1 100644
--- a/drivers/gpio/mcp23s08.c
+++ b/drivers/gpio/mcp23s08.c
@@ -433,3 +433,4 @@ static void __exit mcp23s08_exit(void)
 module_exit(mcp23s08_exit);
 
 MODULE_LICENSE("GPL");
+MODULE_ALIAS("spi:mcp23s08");
diff --git a/drivers/hwmon/adcxx.c b/drivers/hwmon/adcxx.c
index 242294d..7a89fba 100644
--- a/drivers/hwmon/adcxx.c
+++ b/drivers/hwmon/adcxx.c
@@ -323,7 +323,7 @@ MODULE_AUTHOR("Marc Pignat");
 MODULE_DESCRIPTION("National Semiconductor adcxx8sxxx Linux driver");
 MODULE_LICENSE("GPL");
 
-MODULE_ALIAS("adcxx1s");
-MODULE_ALIAS("adcxx2s");
-MODULE_ALIAS("adcxx4s");
-MODULE_ALIAS("adcxx8s");
+MODULE_ALIAS("spi:adcxx1s");
+MODULE_ALIAS("spi:adcxx2s");
+MODULE_ALIAS("spi:adcxx4s");
+MODULE_ALIAS("spi:adcxx8s");
diff --git a/drivers/hwmon/lis3lv02d_spi.c b/drivers/hwmon/lis3lv02d_spi.c
index 3827ff0..b7aed07 100644
--- a/drivers/hwmon/lis3lv02d_spi.c
+++ b/drivers/hwmon/lis3lv02d_spi.c
@@ -112,4 +112,4 @@ module_exit(lis302dl_exit);
 MODULE_AUTHOR("Daniel Mack <daniel@caiaq.de>");
 MODULE_DESCRIPTION("lis3lv02d SPI glue layer");
 MODULE_LICENSE("GPL");
-
+MODULE_ALIAS("spi:" DRV_NAME);
diff --git a/drivers/hwmon/lm70.c b/drivers/hwmon/lm70.c
index ae6204f..d55cc7c 100644
--- a/drivers/hwmon/lm70.c
+++ b/drivers/hwmon/lm70.c
@@ -244,3 +244,5 @@ module_exit(cleanup_lm70);
 MODULE_AUTHOR("Kaiwan N Billimoria");
 MODULE_DESCRIPTION("NS LM70 / TI TMP121/TMP123 Linux driver");
 MODULE_LICENSE("GPL");
+MODULE_ALIAS("spi:tmp121");
+MODULE_ALIAS("spi:lm70");
diff --git a/drivers/hwmon/max1111.c b/drivers/hwmon/max1111.c
index bfaa665..9ac4972 100644
--- a/drivers/hwmon/max1111.c
+++ b/drivers/hwmon/max1111.c
@@ -242,3 +242,4 @@ module_exit(max1111_exit);
 MODULE_AUTHOR("Eric Miao <eric.miao@marvell.com>");
 MODULE_DESCRIPTION("MAX1111 ADC Driver");
 MODULE_LICENSE("GPL");
+MODULE_ALIAS("spi:max1111");
diff --git a/drivers/input/touchscreen/ad7877.c b/drivers/input/touchscreen/ad7877.c
index ecaeb7e..eb83939 100644
--- a/drivers/input/touchscreen/ad7877.c
+++ b/drivers/input/touchscreen/ad7877.c
@@ -842,3 +842,4 @@ module_exit(ad7877_exit);
 MODULE_AUTHOR("Michael Hennerich <hennerich@blackfin.uclinux.org>");
 MODULE_DESCRIPTION("AD7877 touchscreen Driver");
 MODULE_LICENSE("GPL");
+MODULE_ALIAS("spi:ad7877");
diff --git a/drivers/input/touchscreen/ad7879.c b/drivers/input/touchscreen/ad7879.c
index 5d8a703..19b4db7 100644
--- a/drivers/input/touchscreen/ad7879.c
+++ b/drivers/input/touchscreen/ad7879.c
@@ -779,3 +779,4 @@ module_exit(ad7879_exit);
 MODULE_AUTHOR("Michael Hennerich <hennerich@blackfin.uclinux.org>");
 MODULE_DESCRIPTION("AD7879(-1) touchscreen Driver");
 MODULE_LICENSE("GPL");
+MODULE_ALIAS("spi:ad7879");
diff --git a/drivers/input/touchscreen/ads7846.c b/drivers/input/touchscreen/ads7846.c
index ba9d38c..09c8109 100644
--- a/drivers/input/touchscreen/ads7846.c
+++ b/drivers/input/touchscreen/ads7846.c
@@ -1256,3 +1256,4 @@ module_exit(ads7846_exit);
 
 MODULE_DESCRIPTION("ADS7846 TouchScreen Driver");
 MODULE_LICENSE("GPL");
+MODULE_ALIAS("spi:ads7846");
diff --git a/drivers/leds/leds-dac124s085.c b/drivers/leds/leds-dac124s085.c
index 098d9aa..2913d76 100644
--- a/drivers/leds/leds-dac124s085.c
+++ b/drivers/leds/leds-dac124s085.c
@@ -148,3 +148,4 @@ module_exit(dac124s085_leds_exit);
 MODULE_AUTHOR("Guennadi Liakhovetski <lg@denx.de>");
 MODULE_DESCRIPTION("DAC124S085 LED driver");
 MODULE_LICENSE("GPL v2");
+MODULE_ALIAS("spi:dac124s085");
diff --git a/drivers/mfd/ezx-pcap.c b/drivers/mfd/ezx-pcap.c
index c1de4af..1672f30 100644
--- a/drivers/mfd/ezx-pcap.c
+++ b/drivers/mfd/ezx-pcap.c
@@ -505,3 +505,4 @@ module_exit(ezx_pcap_exit);
 MODULE_LICENSE("GPL");
 MODULE_AUTHOR("Daniel Ribeiro / Harald Welte");
 MODULE_DESCRIPTION("Motorola PCAP2 ASIC Driver");
+MODULE_ALIAS("spi:ezx-pcap");
diff --git a/drivers/misc/eeprom/at25.c b/drivers/misc/eeprom/at25.c
index b34cb5f..d564de0 100644
--- a/drivers/misc/eeprom/at25.c
+++ b/drivers/misc/eeprom/at25.c
@@ -417,4 +417,4 @@ module_exit(at25_exit);
 MODULE_DESCRIPTION("Driver for most SPI EEPROMs");
 MODULE_AUTHOR("David Brownell");
 MODULE_LICENSE("GPL");
-
+MODULE_ALIAS("spi:at25");
diff --git a/drivers/mmc/host/mmc_spi.c b/drivers/mmc/host/mmc_spi.c
index a461017..d55fe4f 100644
--- a/drivers/mmc/host/mmc_spi.c
+++ b/drivers/mmc/host/mmc_spi.c
@@ -1562,3 +1562,4 @@ MODULE_AUTHOR("Mike Lavender, David Brownell, "
 		"Hans-Peter Nilsson, Jan Nikitenko");
 MODULE_DESCRIPTION("SPI SD/MMC host driver");
 MODULE_LICENSE("GPL");
+MODULE_ALIAS("spi:mmc_spi");
diff --git a/drivers/mtd/devices/mtd_dataflash.c b/drivers/mtd/devices/mtd_dataflash.c
index 43976aa..211c27a 100644
--- a/drivers/mtd/devices/mtd_dataflash.c
+++ b/drivers/mtd/devices/mtd_dataflash.c
@@ -966,3 +966,4 @@ module_exit(dataflash_exit);
 MODULE_LICENSE("GPL");
 MODULE_AUTHOR("Andrew Victor, David Brownell");
 MODULE_DESCRIPTION("MTD DataFlash driver");
+MODULE_ALIAS("spi:mtd_dataflash");
diff --git a/drivers/net/enc28j60.c b/drivers/net/enc28j60.c
index fc6cc03..c709571 100644
--- a/drivers/net/enc28j60.c
+++ b/drivers/net/enc28j60.c
@@ -1665,3 +1665,4 @@ MODULE_AUTHOR("Claudio Lanconelli <lanconelli.claudio@eptar.com>");
 MODULE_LICENSE("GPL");
 module_param_named(debug, debug.msg_enable, int, 0);
 MODULE_PARM_DESC(debug, "Debug verbosity level (0=none, ..., ffff=all)");
+MODULE_ALIAS("spi:" DRV_NAME);
diff --git a/drivers/net/ks8851.c b/drivers/net/ks8851.c
index 9a1dea6..fe7cf4f 100644
--- a/drivers/net/ks8851.c
+++ b/drivers/net/ks8851.c
@@ -1320,3 +1320,4 @@ MODULE_LICENSE("GPL");
 
 module_param_named(message, msg_enable, int, 0);
 MODULE_PARM_DESC(message, "Message verbosity level (0=none, 31=all)");
+MODULE_ALIAS("spi:ks8851");
diff --git a/drivers/net/wireless/libertas/if_spi.c b/drivers/net/wireless/libertas/if_spi.c
index 6564282..ea45765 100644
--- a/drivers/net/wireless/libertas/if_spi.c
+++ b/drivers/net/wireless/libertas/if_spi.c
@@ -1222,3 +1222,4 @@ MODULE_DESCRIPTION("Libertas SPI WLAN Driver");
 MODULE_AUTHOR("Andrey Yurovsky <andrey@cozybit.com>, "
 	      "Colin McCabe <colin@cozybit.com>");
 MODULE_LICENSE("GPL");
+MODULE_ALIAS("spi:libertas_spi");
diff --git a/drivers/net/wireless/p54/p54spi.c b/drivers/net/wireless/p54/p54spi.c
index 72c7dbd..63bcdd1 100644
--- a/drivers/net/wireless/p54/p54spi.c
+++ b/drivers/net/wireless/p54/p54spi.c
@@ -767,3 +767,4 @@ module_exit(p54spi_exit);
 
 MODULE_LICENSE("GPL");
 MODULE_AUTHOR("Christian Lamparter <chunkeey@web.de>");
+MODULE_ALIAS("spi:cx3110x");
diff --git a/drivers/net/wireless/wl12xx/main.c b/drivers/net/wireless/wl12xx/main.c
index 603d611..6416406 100644
--- a/drivers/net/wireless/wl12xx/main.c
+++ b/drivers/net/wireless/wl12xx/main.c
@@ -1356,3 +1356,4 @@ module_exit(wl12xx_exit);
 MODULE_LICENSE("GPL");
 MODULE_AUTHOR("Kalle Valo <Kalle.Valo@nokia.com>, "
 		"Luciano Coelho <luciano.coelho@nokia.com>");
+MODULE_ALIAS("spi:wl12xx");
diff --git a/drivers/rtc/rtc-ds1305.c b/drivers/rtc/rtc-ds1305.c
index 8f410e5..2736b11 100644
--- a/drivers/rtc/rtc-ds1305.c
+++ b/drivers/rtc/rtc-ds1305.c
@@ -841,3 +841,4 @@ module_exit(ds1305_exit);
 
 MODULE_DESCRIPTION("RTC driver for DS1305 and DS1306 chips");
 MODULE_LICENSE("GPL");
+MODULE_ALIAS("spi:rtc-ds1305");
diff --git a/drivers/rtc/rtc-ds1390.c b/drivers/rtc/rtc-ds1390.c
index e01b955..cdb7050 100644
--- a/drivers/rtc/rtc-ds1390.c
+++ b/drivers/rtc/rtc-ds1390.c
@@ -189,3 +189,4 @@ module_exit(ds1390_exit);
 MODULE_DESCRIPTION("Dallas/Maxim DS1390/93/94 SPI RTC driver");
 MODULE_AUTHOR("Mark Jackson <mpfj@mimc.co.uk>");
 MODULE_LICENSE("GPL");
+MODULE_ALIAS("spi:rtc-ds1390");
diff --git a/drivers/rtc/rtc-ds3234.c b/drivers/rtc/rtc-ds3234.c
index c51589e..a774ca3 100644
--- a/drivers/rtc/rtc-ds3234.c
+++ b/drivers/rtc/rtc-ds3234.c
@@ -188,3 +188,4 @@ module_exit(ds3234_exit);
 MODULE_DESCRIPTION("DS3234 SPI RTC driver");
 MODULE_AUTHOR("Dennis Aberilla <denzzzhome@yahoo.com>");
 MODULE_LICENSE("GPL");
+MODULE_ALIAS("spi:ds3234");
diff --git a/drivers/rtc/rtc-m41t94.c b/drivers/rtc/rtc-m41t94.c
index c3a18c5..c8c97a4 100644
--- a/drivers/rtc/rtc-m41t94.c
+++ b/drivers/rtc/rtc-m41t94.c
@@ -171,3 +171,4 @@ module_exit(m41t94_exit);
 MODULE_AUTHOR("Kim B. Heino <Kim.Heino@bluegiga.com>");
 MODULE_DESCRIPTION("Driver for ST M41T94 SPI RTC");
 MODULE_LICENSE("GPL");
+MODULE_ALIAS("spi:rtc-m41t94");
diff --git a/drivers/rtc/rtc-max6902.c b/drivers/rtc/rtc-max6902.c
index 36a8ea9..657403e 100644
--- a/drivers/rtc/rtc-max6902.c
+++ b/drivers/rtc/rtc-max6902.c
@@ -175,3 +175,4 @@ module_exit(max6902_exit);
 MODULE_DESCRIPTION ("max6902 spi RTC driver");
 MODULE_AUTHOR ("Raphael Assenat");
 MODULE_LICENSE ("GPL");
+MODULE_ALIAS("spi:rtc-max6902");
diff --git a/drivers/rtc/rtc-r9701.c b/drivers/rtc/rtc-r9701.c
index 42028f2..9beba49 100644
--- a/drivers/rtc/rtc-r9701.c
+++ b/drivers/rtc/rtc-r9701.c
@@ -174,3 +174,4 @@ module_exit(r9701_exit);
 MODULE_DESCRIPTION("r9701 spi RTC driver");
 MODULE_AUTHOR("Magnus Damm <damm@opensource.se>");
 MODULE_LICENSE("GPL");
+MODULE_ALIAS("spi:rtc-r9701");
diff --git a/drivers/rtc/rtc-rs5c348.c b/drivers/rtc/rtc-rs5c348.c
index dd1e2bc..2099037 100644
--- a/drivers/rtc/rtc-rs5c348.c
+++ b/drivers/rtc/rtc-rs5c348.c
@@ -251,3 +251,4 @@ MODULE_AUTHOR("Atsushi Nemoto <anemo@mba.ocn.ne.jp>");
 MODULE_DESCRIPTION("Ricoh RS5C348 RTC driver");
 MODULE_LICENSE("GPL");
 MODULE_VERSION(DRV_VERSION);
+MODULE_ALIAS("spi:rtc-rs5c348");
diff --git a/drivers/serial/max3100.c b/drivers/serial/max3100.c
index 9fd33e5..05d36e2 100644
--- a/drivers/serial/max3100.c
+++ b/drivers/serial/max3100.c
@@ -925,3 +925,4 @@ module_exit(max3100_exit);
 MODULE_DESCRIPTION("MAX3100 driver");
 MODULE_AUTHOR("Christian Pellegrin <chripell@evolware.org>");
 MODULE_LICENSE("GPL");
+MODULE_ALIAS("spi:max3100");
diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c
index 1431bf2..a3c9804 100644
--- a/drivers/spi/spi.c
+++ b/drivers/spi/spi.c
@@ -23,6 +23,7 @@
 #include <linux/init.h>
 #include <linux/cache.h>
 #include <linux/mutex.h>
+#include <linux/mod_devicetable.h>
 #include <linux/spi/spi.h>
 
 
@@ -85,7 +86,7 @@ static int spi_uevent(struct device *dev, struct kobj_uevent_env *env)
 {
 	const struct spi_device		*spi = to_spi_device(dev);
 
-	add_uevent_var(env, "MODALIAS=%s", spi->modalias);
+	add_uevent_var(env, "MODALIAS=%s%s", SPI_MODULE_PREFIX, spi->modalias);
 	return 0;
 }
 
diff --git a/drivers/spi/spidev.c b/drivers/spi/spidev.c
index 606e7a4..f921bd1 100644
--- a/drivers/spi/spidev.c
+++ b/drivers/spi/spidev.c
@@ -688,3 +688,4 @@ module_exit(spidev_exit);
 MODULE_AUTHOR("Andrea Paterniani, <a.paterniani@swapp-eng.it>");
 MODULE_DESCRIPTION("User mode SPI device interface");
 MODULE_LICENSE("GPL");
+MODULE_ALIAS("spi:spidev");
diff --git a/drivers/spi/tle62x0.c b/drivers/spi/tle62x0.c
index 455991f..bf9540f 100644
--- a/drivers/spi/tle62x0.c
+++ b/drivers/spi/tle62x0.c
@@ -329,3 +329,4 @@ module_exit(tle62x0_exit);
 MODULE_AUTHOR("Ben Dooks <ben@simtec.co.uk>");
 MODULE_DESCRIPTION("TLE62x0 SPI driver");
 MODULE_LICENSE("GPL v2");
+MODULE_ALIAS("spi:tle62x0");
diff --git a/drivers/staging/stlc45xx/stlc45xx.c b/drivers/staging/stlc45xx/stlc45xx.c
index a137c78..38d0b24 100644
--- a/drivers/staging/stlc45xx/stlc45xx.c
+++ b/drivers/staging/stlc45xx/stlc45xx.c
@@ -2590,3 +2590,4 @@ module_exit(stlc45xx_exit);
 
 MODULE_LICENSE("GPL");
 MODULE_AUTHOR("Kalle Valo <kalle.valo@nokia.com>");
+MODULE_ALIAS("spi:cx3110x");
diff --git a/drivers/video/backlight/corgi_lcd.c b/drivers/video/backlight/corgi_lcd.c
index f8a4bb2..2211a85 100644
--- a/drivers/video/backlight/corgi_lcd.c
+++ b/drivers/video/backlight/corgi_lcd.c
@@ -639,3 +639,4 @@ module_exit(corgi_lcd_exit);
 MODULE_DESCRIPTION("LCD and backlight driver for SHARP C7x0/Cxx00");
 MODULE_AUTHOR("Eric Miao <eric.miao@marvell.com>");
 MODULE_LICENSE("GPL");
+MODULE_ALIAS("spi:corgi-lcd");
diff --git a/drivers/video/backlight/ltv350qv.c b/drivers/video/backlight/ltv350qv.c
index 2eb206b..4631ca8 100644
--- a/drivers/video/backlight/ltv350qv.c
+++ b/drivers/video/backlight/ltv350qv.c
@@ -328,3 +328,4 @@ module_exit(ltv350qv_exit);
 MODULE_AUTHOR("Haavard Skinnemoen <hskinnemoen@atmel.com>");
 MODULE_DESCRIPTION("Samsung LTV350QV LCD Driver");
 MODULE_LICENSE("GPL");
+MODULE_ALIAS("spi:ltv350qv");
diff --git a/drivers/video/backlight/tdo24m.c b/drivers/video/backlight/tdo24m.c
index 51422fc..bbfb502 100644
--- a/drivers/video/backlight/tdo24m.c
+++ b/drivers/video/backlight/tdo24m.c
@@ -472,3 +472,4 @@ module_exit(tdo24m_exit);
 MODULE_AUTHOR("Eric Miao <eric.miao@marvell.com>");
 MODULE_DESCRIPTION("Driver for Toppoly TDO24M LCD Panel");
 MODULE_LICENSE("GPL");
+MODULE_ALIAS("spi:tdo24m");
diff --git a/drivers/video/backlight/tosa_lcd.c b/drivers/video/backlight/tosa_lcd.c
index b7fbc75..50ec17d 100644
--- a/drivers/video/backlight/tosa_lcd.c
+++ b/drivers/video/backlight/tosa_lcd.c
@@ -300,4 +300,4 @@ module_exit(tosa_lcd_exit);
 MODULE_AUTHOR("Dmitry Baryshkov");
 MODULE_LICENSE("GPL v2");
 MODULE_DESCRIPTION("LCD/Backlight control for Sharp SL-6000 PDA");
-
+MODULE_ALIAS("spi:tosa-lcd");
diff --git a/drivers/video/backlight/vgg2432a4.c b/drivers/video/backlight/vgg2432a4.c
index 8e653b8..b49063c 100644
--- a/drivers/video/backlight/vgg2432a4.c
+++ b/drivers/video/backlight/vgg2432a4.c
@@ -280,5 +280,4 @@ module_exit(vgg2432a4_exit);
 MODULE_AUTHOR("Ben Dooks <ben-linux@fluff.org>");
 MODULE_DESCRIPTION("VGG2432A4 LCD Driver");
 MODULE_LICENSE("GPL v2");
-
-
+MODULE_ALIAS("spi:VGG2432A4");
diff --git a/include/linux/mod_devicetable.h b/include/linux/mod_devicetable.h
index 9660dca..814db86 100644
--- a/include/linux/mod_devicetable.h
+++ b/include/linux/mod_devicetable.h
@@ -402,6 +402,7 @@ struct i2c_device_id {
 /* spi */
 
 #define SPI_NAME_SIZE	20
+#define SPI_MODULE_PREFIX "spi:"
 
 struct spi_device_id {
 	char name[SPI_NAME_SIZE];
diff --git a/scripts/mod/file2alias.c b/scripts/mod/file2alias.c
index 9d446e3..62a9025 100644
--- a/scripts/mod/file2alias.c
+++ b/scripts/mod/file2alias.c
@@ -657,11 +657,11 @@ static int do_i2c_entry(const char *filename, struct i2c_device_id *id,
 	return 1;
 }
 
-/* Looks like: S */
+/* Looks like: spi:S */
 static int do_spi_entry(const char *filename, struct spi_device_id *id,
 			char *alias)
 {
-	sprintf(alias, "%s", id->name);
+	sprintf(alias, SPI_MODULE_PREFIX "%s", id->name);
 
 	return 1;
 }
-- 
1.6.3.3


^ permalink raw reply related	[flat|nested] 68+ messages in thread

* [PATCH 4/7] spi: Prefix modalias with "spi:"
@ 2009-07-29 17:05   ` Anton Vorontsov
  0 siblings, 0 replies; 68+ messages in thread
From: Anton Vorontsov @ 2009-07-29 17:05 UTC (permalink / raw)
  To: Andrew Morton
  Cc: David Brownell, linux-kernel, lm-sensors, linuxppc-dev,
	linux-mtd, Jean Delvare, David Woodhouse

This makes it consistent with other buses (platform, i2c, vio, ...).
I'm not sure why we use the prefixes, but there must be a reason.

This was easy enough to do it, and I did it.

Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com>
---
 drivers/gpio/max7301.c                 |    1 +
 drivers/gpio/mcp23s08.c                |    1 +
 drivers/hwmon/adcxx.c                  |    8 ++++----
 drivers/hwmon/lis3lv02d_spi.c          |    2 +-
 drivers/hwmon/lm70.c                   |    2 ++
 drivers/hwmon/max1111.c                |    1 +
 drivers/input/touchscreen/ad7877.c     |    1 +
 drivers/input/touchscreen/ad7879.c     |    1 +
 drivers/input/touchscreen/ads7846.c    |    1 +
 drivers/leds/leds-dac124s085.c         |    1 +
 drivers/mfd/ezx-pcap.c                 |    1 +
 drivers/misc/eeprom/at25.c             |    2 +-
 drivers/mmc/host/mmc_spi.c             |    1 +
 drivers/mtd/devices/mtd_dataflash.c    |    1 +
 drivers/net/enc28j60.c                 |    1 +
 drivers/net/ks8851.c                   |    1 +
 drivers/net/wireless/libertas/if_spi.c |    1 +
 drivers/net/wireless/p54/p54spi.c      |    1 +
 drivers/net/wireless/wl12xx/main.c     |    1 +
 drivers/rtc/rtc-ds1305.c               |    1 +
 drivers/rtc/rtc-ds1390.c               |    1 +
 drivers/rtc/rtc-ds3234.c               |    1 +
 drivers/rtc/rtc-m41t94.c               |    1 +
 drivers/rtc/rtc-max6902.c              |    1 +
 drivers/rtc/rtc-r9701.c                |    1 +
 drivers/rtc/rtc-rs5c348.c              |    1 +
 drivers/serial/max3100.c               |    1 +
 drivers/spi/spi.c                      |    3 ++-
 drivers/spi/spidev.c                   |    1 +
 drivers/spi/tle62x0.c                  |    1 +
 drivers/staging/stlc45xx/stlc45xx.c    |    1 +
 drivers/video/backlight/corgi_lcd.c    |    1 +
 drivers/video/backlight/ltv350qv.c     |    1 +
 drivers/video/backlight/tdo24m.c       |    1 +
 drivers/video/backlight/tosa_lcd.c     |    2 +-
 drivers/video/backlight/vgg2432a4.c    |    3 +--
 include/linux/mod_devicetable.h        |    1 +
 scripts/mod/file2alias.c               |    4 ++--
 38 files changed, 44 insertions(+), 12 deletions(-)

diff --git a/drivers/gpio/max7301.c b/drivers/gpio/max7301.c
index 7b82eaa..480956f 100644
--- a/drivers/gpio/max7301.c
+++ b/drivers/gpio/max7301.c
@@ -339,3 +339,4 @@ module_exit(max7301_exit);
 MODULE_AUTHOR("Juergen Beisert");
 MODULE_LICENSE("GPL v2");
 MODULE_DESCRIPTION("MAX7301 SPI based GPIO-Expander");
+MODULE_ALIAS("spi:" DRIVER_NAME);
diff --git a/drivers/gpio/mcp23s08.c b/drivers/gpio/mcp23s08.c
index f6fae0e..c6c7aa1 100644
--- a/drivers/gpio/mcp23s08.c
+++ b/drivers/gpio/mcp23s08.c
@@ -433,3 +433,4 @@ static void __exit mcp23s08_exit(void)
 module_exit(mcp23s08_exit);
 
 MODULE_LICENSE("GPL");
+MODULE_ALIAS("spi:mcp23s08");
diff --git a/drivers/hwmon/adcxx.c b/drivers/hwmon/adcxx.c
index 242294d..7a89fba 100644
--- a/drivers/hwmon/adcxx.c
+++ b/drivers/hwmon/adcxx.c
@@ -323,7 +323,7 @@ MODULE_AUTHOR("Marc Pignat");
 MODULE_DESCRIPTION("National Semiconductor adcxx8sxxx Linux driver");
 MODULE_LICENSE("GPL");
 
-MODULE_ALIAS("adcxx1s");
-MODULE_ALIAS("adcxx2s");
-MODULE_ALIAS("adcxx4s");
-MODULE_ALIAS("adcxx8s");
+MODULE_ALIAS("spi:adcxx1s");
+MODULE_ALIAS("spi:adcxx2s");
+MODULE_ALIAS("spi:adcxx4s");
+MODULE_ALIAS("spi:adcxx8s");
diff --git a/drivers/hwmon/lis3lv02d_spi.c b/drivers/hwmon/lis3lv02d_spi.c
index 3827ff0..b7aed07 100644
--- a/drivers/hwmon/lis3lv02d_spi.c
+++ b/drivers/hwmon/lis3lv02d_spi.c
@@ -112,4 +112,4 @@ module_exit(lis302dl_exit);
 MODULE_AUTHOR("Daniel Mack <daniel@caiaq.de>");
 MODULE_DESCRIPTION("lis3lv02d SPI glue layer");
 MODULE_LICENSE("GPL");
-
+MODULE_ALIAS("spi:" DRV_NAME);
diff --git a/drivers/hwmon/lm70.c b/drivers/hwmon/lm70.c
index ae6204f..d55cc7c 100644
--- a/drivers/hwmon/lm70.c
+++ b/drivers/hwmon/lm70.c
@@ -244,3 +244,5 @@ module_exit(cleanup_lm70);
 MODULE_AUTHOR("Kaiwan N Billimoria");
 MODULE_DESCRIPTION("NS LM70 / TI TMP121/TMP123 Linux driver");
 MODULE_LICENSE("GPL");
+MODULE_ALIAS("spi:tmp121");
+MODULE_ALIAS("spi:lm70");
diff --git a/drivers/hwmon/max1111.c b/drivers/hwmon/max1111.c
index bfaa665..9ac4972 100644
--- a/drivers/hwmon/max1111.c
+++ b/drivers/hwmon/max1111.c
@@ -242,3 +242,4 @@ module_exit(max1111_exit);
 MODULE_AUTHOR("Eric Miao <eric.miao@marvell.com>");
 MODULE_DESCRIPTION("MAX1111 ADC Driver");
 MODULE_LICENSE("GPL");
+MODULE_ALIAS("spi:max1111");
diff --git a/drivers/input/touchscreen/ad7877.c b/drivers/input/touchscreen/ad7877.c
index ecaeb7e..eb83939 100644
--- a/drivers/input/touchscreen/ad7877.c
+++ b/drivers/input/touchscreen/ad7877.c
@@ -842,3 +842,4 @@ module_exit(ad7877_exit);
 MODULE_AUTHOR("Michael Hennerich <hennerich@blackfin.uclinux.org>");
 MODULE_DESCRIPTION("AD7877 touchscreen Driver");
 MODULE_LICENSE("GPL");
+MODULE_ALIAS("spi:ad7877");
diff --git a/drivers/input/touchscreen/ad7879.c b/drivers/input/touchscreen/ad7879.c
index 5d8a703..19b4db7 100644
--- a/drivers/input/touchscreen/ad7879.c
+++ b/drivers/input/touchscreen/ad7879.c
@@ -779,3 +779,4 @@ module_exit(ad7879_exit);
 MODULE_AUTHOR("Michael Hennerich <hennerich@blackfin.uclinux.org>");
 MODULE_DESCRIPTION("AD7879(-1) touchscreen Driver");
 MODULE_LICENSE("GPL");
+MODULE_ALIAS("spi:ad7879");
diff --git a/drivers/input/touchscreen/ads7846.c b/drivers/input/touchscreen/ads7846.c
index ba9d38c..09c8109 100644
--- a/drivers/input/touchscreen/ads7846.c
+++ b/drivers/input/touchscreen/ads7846.c
@@ -1256,3 +1256,4 @@ module_exit(ads7846_exit);
 
 MODULE_DESCRIPTION("ADS7846 TouchScreen Driver");
 MODULE_LICENSE("GPL");
+MODULE_ALIAS("spi:ads7846");
diff --git a/drivers/leds/leds-dac124s085.c b/drivers/leds/leds-dac124s085.c
index 098d9aa..2913d76 100644
--- a/drivers/leds/leds-dac124s085.c
+++ b/drivers/leds/leds-dac124s085.c
@@ -148,3 +148,4 @@ module_exit(dac124s085_leds_exit);
 MODULE_AUTHOR("Guennadi Liakhovetski <lg@denx.de>");
 MODULE_DESCRIPTION("DAC124S085 LED driver");
 MODULE_LICENSE("GPL v2");
+MODULE_ALIAS("spi:dac124s085");
diff --git a/drivers/mfd/ezx-pcap.c b/drivers/mfd/ezx-pcap.c
index c1de4af..1672f30 100644
--- a/drivers/mfd/ezx-pcap.c
+++ b/drivers/mfd/ezx-pcap.c
@@ -505,3 +505,4 @@ module_exit(ezx_pcap_exit);
 MODULE_LICENSE("GPL");
 MODULE_AUTHOR("Daniel Ribeiro / Harald Welte");
 MODULE_DESCRIPTION("Motorola PCAP2 ASIC Driver");
+MODULE_ALIAS("spi:ezx-pcap");
diff --git a/drivers/misc/eeprom/at25.c b/drivers/misc/eeprom/at25.c
index b34cb5f..d564de0 100644
--- a/drivers/misc/eeprom/at25.c
+++ b/drivers/misc/eeprom/at25.c
@@ -417,4 +417,4 @@ module_exit(at25_exit);
 MODULE_DESCRIPTION("Driver for most SPI EEPROMs");
 MODULE_AUTHOR("David Brownell");
 MODULE_LICENSE("GPL");
-
+MODULE_ALIAS("spi:at25");
diff --git a/drivers/mmc/host/mmc_spi.c b/drivers/mmc/host/mmc_spi.c
index a461017..d55fe4f 100644
--- a/drivers/mmc/host/mmc_spi.c
+++ b/drivers/mmc/host/mmc_spi.c
@@ -1562,3 +1562,4 @@ MODULE_AUTHOR("Mike Lavender, David Brownell, "
 		"Hans-Peter Nilsson, Jan Nikitenko");
 MODULE_DESCRIPTION("SPI SD/MMC host driver");
 MODULE_LICENSE("GPL");
+MODULE_ALIAS("spi:mmc_spi");
diff --git a/drivers/mtd/devices/mtd_dataflash.c b/drivers/mtd/devices/mtd_dataflash.c
index 43976aa..211c27a 100644
--- a/drivers/mtd/devices/mtd_dataflash.c
+++ b/drivers/mtd/devices/mtd_dataflash.c
@@ -966,3 +966,4 @@ module_exit(dataflash_exit);
 MODULE_LICENSE("GPL");
 MODULE_AUTHOR("Andrew Victor, David Brownell");
 MODULE_DESCRIPTION("MTD DataFlash driver");
+MODULE_ALIAS("spi:mtd_dataflash");
diff --git a/drivers/net/enc28j60.c b/drivers/net/enc28j60.c
index fc6cc03..c709571 100644
--- a/drivers/net/enc28j60.c
+++ b/drivers/net/enc28j60.c
@@ -1665,3 +1665,4 @@ MODULE_AUTHOR("Claudio Lanconelli <lanconelli.claudio@eptar.com>");
 MODULE_LICENSE("GPL");
 module_param_named(debug, debug.msg_enable, int, 0);
 MODULE_PARM_DESC(debug, "Debug verbosity level (0=none, ..., ffff=all)");
+MODULE_ALIAS("spi:" DRV_NAME);
diff --git a/drivers/net/ks8851.c b/drivers/net/ks8851.c
index 9a1dea6..fe7cf4f 100644
--- a/drivers/net/ks8851.c
+++ b/drivers/net/ks8851.c
@@ -1320,3 +1320,4 @@ MODULE_LICENSE("GPL");
 
 module_param_named(message, msg_enable, int, 0);
 MODULE_PARM_DESC(message, "Message verbosity level (0=none, 31=all)");
+MODULE_ALIAS("spi:ks8851");
diff --git a/drivers/net/wireless/libertas/if_spi.c b/drivers/net/wireless/libertas/if_spi.c
index 6564282..ea45765 100644
--- a/drivers/net/wireless/libertas/if_spi.c
+++ b/drivers/net/wireless/libertas/if_spi.c
@@ -1222,3 +1222,4 @@ MODULE_DESCRIPTION("Libertas SPI WLAN Driver");
 MODULE_AUTHOR("Andrey Yurovsky <andrey@cozybit.com>, "
 	      "Colin McCabe <colin@cozybit.com>");
 MODULE_LICENSE("GPL");
+MODULE_ALIAS("spi:libertas_spi");
diff --git a/drivers/net/wireless/p54/p54spi.c b/drivers/net/wireless/p54/p54spi.c
index 72c7dbd..63bcdd1 100644
--- a/drivers/net/wireless/p54/p54spi.c
+++ b/drivers/net/wireless/p54/p54spi.c
@@ -767,3 +767,4 @@ module_exit(p54spi_exit);
 
 MODULE_LICENSE("GPL");
 MODULE_AUTHOR("Christian Lamparter <chunkeey@web.de>");
+MODULE_ALIAS("spi:cx3110x");
diff --git a/drivers/net/wireless/wl12xx/main.c b/drivers/net/wireless/wl12xx/main.c
index 603d611..6416406 100644
--- a/drivers/net/wireless/wl12xx/main.c
+++ b/drivers/net/wireless/wl12xx/main.c
@@ -1356,3 +1356,4 @@ module_exit(wl12xx_exit);
 MODULE_LICENSE("GPL");
 MODULE_AUTHOR("Kalle Valo <Kalle.Valo@nokia.com>, "
 		"Luciano Coelho <luciano.coelho@nokia.com>");
+MODULE_ALIAS("spi:wl12xx");
diff --git a/drivers/rtc/rtc-ds1305.c b/drivers/rtc/rtc-ds1305.c
index 8f410e5..2736b11 100644
--- a/drivers/rtc/rtc-ds1305.c
+++ b/drivers/rtc/rtc-ds1305.c
@@ -841,3 +841,4 @@ module_exit(ds1305_exit);
 
 MODULE_DESCRIPTION("RTC driver for DS1305 and DS1306 chips");
 MODULE_LICENSE("GPL");
+MODULE_ALIAS("spi:rtc-ds1305");
diff --git a/drivers/rtc/rtc-ds1390.c b/drivers/rtc/rtc-ds1390.c
index e01b955..cdb7050 100644
--- a/drivers/rtc/rtc-ds1390.c
+++ b/drivers/rtc/rtc-ds1390.c
@@ -189,3 +189,4 @@ module_exit(ds1390_exit);
 MODULE_DESCRIPTION("Dallas/Maxim DS1390/93/94 SPI RTC driver");
 MODULE_AUTHOR("Mark Jackson <mpfj@mimc.co.uk>");
 MODULE_LICENSE("GPL");
+MODULE_ALIAS("spi:rtc-ds1390");
diff --git a/drivers/rtc/rtc-ds3234.c b/drivers/rtc/rtc-ds3234.c
index c51589e..a774ca3 100644
--- a/drivers/rtc/rtc-ds3234.c
+++ b/drivers/rtc/rtc-ds3234.c
@@ -188,3 +188,4 @@ module_exit(ds3234_exit);
 MODULE_DESCRIPTION("DS3234 SPI RTC driver");
 MODULE_AUTHOR("Dennis Aberilla <denzzzhome@yahoo.com>");
 MODULE_LICENSE("GPL");
+MODULE_ALIAS("spi:ds3234");
diff --git a/drivers/rtc/rtc-m41t94.c b/drivers/rtc/rtc-m41t94.c
index c3a18c5..c8c97a4 100644
--- a/drivers/rtc/rtc-m41t94.c
+++ b/drivers/rtc/rtc-m41t94.c
@@ -171,3 +171,4 @@ module_exit(m41t94_exit);
 MODULE_AUTHOR("Kim B. Heino <Kim.Heino@bluegiga.com>");
 MODULE_DESCRIPTION("Driver for ST M41T94 SPI RTC");
 MODULE_LICENSE("GPL");
+MODULE_ALIAS("spi:rtc-m41t94");
diff --git a/drivers/rtc/rtc-max6902.c b/drivers/rtc/rtc-max6902.c
index 36a8ea9..657403e 100644
--- a/drivers/rtc/rtc-max6902.c
+++ b/drivers/rtc/rtc-max6902.c
@@ -175,3 +175,4 @@ module_exit(max6902_exit);
 MODULE_DESCRIPTION ("max6902 spi RTC driver");
 MODULE_AUTHOR ("Raphael Assenat");
 MODULE_LICENSE ("GPL");
+MODULE_ALIAS("spi:rtc-max6902");
diff --git a/drivers/rtc/rtc-r9701.c b/drivers/rtc/rtc-r9701.c
index 42028f2..9beba49 100644
--- a/drivers/rtc/rtc-r9701.c
+++ b/drivers/rtc/rtc-r9701.c
@@ -174,3 +174,4 @@ module_exit(r9701_exit);
 MODULE_DESCRIPTION("r9701 spi RTC driver");
 MODULE_AUTHOR("Magnus Damm <damm@opensource.se>");
 MODULE_LICENSE("GPL");
+MODULE_ALIAS("spi:rtc-r9701");
diff --git a/drivers/rtc/rtc-rs5c348.c b/drivers/rtc/rtc-rs5c348.c
index dd1e2bc..2099037 100644
--- a/drivers/rtc/rtc-rs5c348.c
+++ b/drivers/rtc/rtc-rs5c348.c
@@ -251,3 +251,4 @@ MODULE_AUTHOR("Atsushi Nemoto <anemo@mba.ocn.ne.jp>");
 MODULE_DESCRIPTION("Ricoh RS5C348 RTC driver");
 MODULE_LICENSE("GPL");
 MODULE_VERSION(DRV_VERSION);
+MODULE_ALIAS("spi:rtc-rs5c348");
diff --git a/drivers/serial/max3100.c b/drivers/serial/max3100.c
index 9fd33e5..05d36e2 100644
--- a/drivers/serial/max3100.c
+++ b/drivers/serial/max3100.c
@@ -925,3 +925,4 @@ module_exit(max3100_exit);
 MODULE_DESCRIPTION("MAX3100 driver");
 MODULE_AUTHOR("Christian Pellegrin <chripell@evolware.org>");
 MODULE_LICENSE("GPL");
+MODULE_ALIAS("spi:max3100");
diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c
index 1431bf2..a3c9804 100644
--- a/drivers/spi/spi.c
+++ b/drivers/spi/spi.c
@@ -23,6 +23,7 @@
 #include <linux/init.h>
 #include <linux/cache.h>
 #include <linux/mutex.h>
+#include <linux/mod_devicetable.h>
 #include <linux/spi/spi.h>
 
 
@@ -85,7 +86,7 @@ static int spi_uevent(struct device *dev, struct kobj_uevent_env *env)
 {
 	const struct spi_device		*spi = to_spi_device(dev);
 
-	add_uevent_var(env, "MODALIAS=%s", spi->modalias);
+	add_uevent_var(env, "MODALIAS=%s%s", SPI_MODULE_PREFIX, spi->modalias);
 	return 0;
 }
 
diff --git a/drivers/spi/spidev.c b/drivers/spi/spidev.c
index 606e7a4..f921bd1 100644
--- a/drivers/spi/spidev.c
+++ b/drivers/spi/spidev.c
@@ -688,3 +688,4 @@ module_exit(spidev_exit);
 MODULE_AUTHOR("Andrea Paterniani, <a.paterniani@swapp-eng.it>");
 MODULE_DESCRIPTION("User mode SPI device interface");
 MODULE_LICENSE("GPL");
+MODULE_ALIAS("spi:spidev");
diff --git a/drivers/spi/tle62x0.c b/drivers/spi/tle62x0.c
index 455991f..bf9540f 100644
--- a/drivers/spi/tle62x0.c
+++ b/drivers/spi/tle62x0.c
@@ -329,3 +329,4 @@ module_exit(tle62x0_exit);
 MODULE_AUTHOR("Ben Dooks <ben@simtec.co.uk>");
 MODULE_DESCRIPTION("TLE62x0 SPI driver");
 MODULE_LICENSE("GPL v2");
+MODULE_ALIAS("spi:tle62x0");
diff --git a/drivers/staging/stlc45xx/stlc45xx.c b/drivers/staging/stlc45xx/stlc45xx.c
index a137c78..38d0b24 100644
--- a/drivers/staging/stlc45xx/stlc45xx.c
+++ b/drivers/staging/stlc45xx/stlc45xx.c
@@ -2590,3 +2590,4 @@ module_exit(stlc45xx_exit);
 
 MODULE_LICENSE("GPL");
 MODULE_AUTHOR("Kalle Valo <kalle.valo@nokia.com>");
+MODULE_ALIAS("spi:cx3110x");
diff --git a/drivers/video/backlight/corgi_lcd.c b/drivers/video/backlight/corgi_lcd.c
index f8a4bb2..2211a85 100644
--- a/drivers/video/backlight/corgi_lcd.c
+++ b/drivers/video/backlight/corgi_lcd.c
@@ -639,3 +639,4 @@ module_exit(corgi_lcd_exit);
 MODULE_DESCRIPTION("LCD and backlight driver for SHARP C7x0/Cxx00");
 MODULE_AUTHOR("Eric Miao <eric.miao@marvell.com>");
 MODULE_LICENSE("GPL");
+MODULE_ALIAS("spi:corgi-lcd");
diff --git a/drivers/video/backlight/ltv350qv.c b/drivers/video/backlight/ltv350qv.c
index 2eb206b..4631ca8 100644
--- a/drivers/video/backlight/ltv350qv.c
+++ b/drivers/video/backlight/ltv350qv.c
@@ -328,3 +328,4 @@ module_exit(ltv350qv_exit);
 MODULE_AUTHOR("Haavard Skinnemoen <hskinnemoen@atmel.com>");
 MODULE_DESCRIPTION("Samsung LTV350QV LCD Driver");
 MODULE_LICENSE("GPL");
+MODULE_ALIAS("spi:ltv350qv");
diff --git a/drivers/video/backlight/tdo24m.c b/drivers/video/backlight/tdo24m.c
index 51422fc..bbfb502 100644
--- a/drivers/video/backlight/tdo24m.c
+++ b/drivers/video/backlight/tdo24m.c
@@ -472,3 +472,4 @@ module_exit(tdo24m_exit);
 MODULE_AUTHOR("Eric Miao <eric.miao@marvell.com>");
 MODULE_DESCRIPTION("Driver for Toppoly TDO24M LCD Panel");
 MODULE_LICENSE("GPL");
+MODULE_ALIAS("spi:tdo24m");
diff --git a/drivers/video/backlight/tosa_lcd.c b/drivers/video/backlight/tosa_lcd.c
index b7fbc75..50ec17d 100644
--- a/drivers/video/backlight/tosa_lcd.c
+++ b/drivers/video/backlight/tosa_lcd.c
@@ -300,4 +300,4 @@ module_exit(tosa_lcd_exit);
 MODULE_AUTHOR("Dmitry Baryshkov");
 MODULE_LICENSE("GPL v2");
 MODULE_DESCRIPTION("LCD/Backlight control for Sharp SL-6000 PDA");
-
+MODULE_ALIAS("spi:tosa-lcd");
diff --git a/drivers/video/backlight/vgg2432a4.c b/drivers/video/backlight/vgg2432a4.c
index 8e653b8..b49063c 100644
--- a/drivers/video/backlight/vgg2432a4.c
+++ b/drivers/video/backlight/vgg2432a4.c
@@ -280,5 +280,4 @@ module_exit(vgg2432a4_exit);
 MODULE_AUTHOR("Ben Dooks <ben-linux@fluff.org>");
 MODULE_DESCRIPTION("VGG2432A4 LCD Driver");
 MODULE_LICENSE("GPL v2");
-
-
+MODULE_ALIAS("spi:VGG2432A4");
diff --git a/include/linux/mod_devicetable.h b/include/linux/mod_devicetable.h
index 9660dca..814db86 100644
--- a/include/linux/mod_devicetable.h
+++ b/include/linux/mod_devicetable.h
@@ -402,6 +402,7 @@ struct i2c_device_id {
 /* spi */
 
 #define SPI_NAME_SIZE	20
+#define SPI_MODULE_PREFIX "spi:"
 
 struct spi_device_id {
 	char name[SPI_NAME_SIZE];
diff --git a/scripts/mod/file2alias.c b/scripts/mod/file2alias.c
index 9d446e3..62a9025 100644
--- a/scripts/mod/file2alias.c
+++ b/scripts/mod/file2alias.c
@@ -657,11 +657,11 @@ static int do_i2c_entry(const char *filename, struct i2c_device_id *id,
 	return 1;
 }
 
-/* Looks like: S */
+/* Looks like: spi:S */
 static int do_spi_entry(const char *filename, struct spi_device_id *id,
 			char *alias)
 {
-	sprintf(alias, "%s", id->name);
+	sprintf(alias, SPI_MODULE_PREFIX "%s", id->name);
 
 	return 1;
 }
-- 
1.6.3.3

^ permalink raw reply related	[flat|nested] 68+ messages in thread

* [PATCH 4/7] spi: Prefix modalias with "spi:"
@ 2009-07-29 17:05   ` Anton Vorontsov
  0 siblings, 0 replies; 68+ messages in thread
From: Anton Vorontsov @ 2009-07-29 17:05 UTC (permalink / raw)
  To: Andrew Morton
  Cc: David Brownell, linux-kernel, lm-sensors, Grant Likely,
	linuxppc-dev, linux-mtd, Jean Delvare, David Woodhouse

This makes it consistent with other buses (platform, i2c, vio, ...).
I'm not sure why we use the prefixes, but there must be a reason.

This was easy enough to do it, and I did it.

Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com>
---
 drivers/gpio/max7301.c                 |    1 +
 drivers/gpio/mcp23s08.c                |    1 +
 drivers/hwmon/adcxx.c                  |    8 ++++----
 drivers/hwmon/lis3lv02d_spi.c          |    2 +-
 drivers/hwmon/lm70.c                   |    2 ++
 drivers/hwmon/max1111.c                |    1 +
 drivers/input/touchscreen/ad7877.c     |    1 +
 drivers/input/touchscreen/ad7879.c     |    1 +
 drivers/input/touchscreen/ads7846.c    |    1 +
 drivers/leds/leds-dac124s085.c         |    1 +
 drivers/mfd/ezx-pcap.c                 |    1 +
 drivers/misc/eeprom/at25.c             |    2 +-
 drivers/mmc/host/mmc_spi.c             |    1 +
 drivers/mtd/devices/mtd_dataflash.c    |    1 +
 drivers/net/enc28j60.c                 |    1 +
 drivers/net/ks8851.c                   |    1 +
 drivers/net/wireless/libertas/if_spi.c |    1 +
 drivers/net/wireless/p54/p54spi.c      |    1 +
 drivers/net/wireless/wl12xx/main.c     |    1 +
 drivers/rtc/rtc-ds1305.c               |    1 +
 drivers/rtc/rtc-ds1390.c               |    1 +
 drivers/rtc/rtc-ds3234.c               |    1 +
 drivers/rtc/rtc-m41t94.c               |    1 +
 drivers/rtc/rtc-max6902.c              |    1 +
 drivers/rtc/rtc-r9701.c                |    1 +
 drivers/rtc/rtc-rs5c348.c              |    1 +
 drivers/serial/max3100.c               |    1 +
 drivers/spi/spi.c                      |    3 ++-
 drivers/spi/spidev.c                   |    1 +
 drivers/spi/tle62x0.c                  |    1 +
 drivers/staging/stlc45xx/stlc45xx.c    |    1 +
 drivers/video/backlight/corgi_lcd.c    |    1 +
 drivers/video/backlight/ltv350qv.c     |    1 +
 drivers/video/backlight/tdo24m.c       |    1 +
 drivers/video/backlight/tosa_lcd.c     |    2 +-
 drivers/video/backlight/vgg2432a4.c    |    3 +--
 include/linux/mod_devicetable.h        |    1 +
 scripts/mod/file2alias.c               |    4 ++--
 38 files changed, 44 insertions(+), 12 deletions(-)

diff --git a/drivers/gpio/max7301.c b/drivers/gpio/max7301.c
index 7b82eaa..480956f 100644
--- a/drivers/gpio/max7301.c
+++ b/drivers/gpio/max7301.c
@@ -339,3 +339,4 @@ module_exit(max7301_exit);
 MODULE_AUTHOR("Juergen Beisert");
 MODULE_LICENSE("GPL v2");
 MODULE_DESCRIPTION("MAX7301 SPI based GPIO-Expander");
+MODULE_ALIAS("spi:" DRIVER_NAME);
diff --git a/drivers/gpio/mcp23s08.c b/drivers/gpio/mcp23s08.c
index f6fae0e..c6c7aa1 100644
--- a/drivers/gpio/mcp23s08.c
+++ b/drivers/gpio/mcp23s08.c
@@ -433,3 +433,4 @@ static void __exit mcp23s08_exit(void)
 module_exit(mcp23s08_exit);
 
 MODULE_LICENSE("GPL");
+MODULE_ALIAS("spi:mcp23s08");
diff --git a/drivers/hwmon/adcxx.c b/drivers/hwmon/adcxx.c
index 242294d..7a89fba 100644
--- a/drivers/hwmon/adcxx.c
+++ b/drivers/hwmon/adcxx.c
@@ -323,7 +323,7 @@ MODULE_AUTHOR("Marc Pignat");
 MODULE_DESCRIPTION("National Semiconductor adcxx8sxxx Linux driver");
 MODULE_LICENSE("GPL");
 
-MODULE_ALIAS("adcxx1s");
-MODULE_ALIAS("adcxx2s");
-MODULE_ALIAS("adcxx4s");
-MODULE_ALIAS("adcxx8s");
+MODULE_ALIAS("spi:adcxx1s");
+MODULE_ALIAS("spi:adcxx2s");
+MODULE_ALIAS("spi:adcxx4s");
+MODULE_ALIAS("spi:adcxx8s");
diff --git a/drivers/hwmon/lis3lv02d_spi.c b/drivers/hwmon/lis3lv02d_spi.c
index 3827ff0..b7aed07 100644
--- a/drivers/hwmon/lis3lv02d_spi.c
+++ b/drivers/hwmon/lis3lv02d_spi.c
@@ -112,4 +112,4 @@ module_exit(lis302dl_exit);
 MODULE_AUTHOR("Daniel Mack <daniel@caiaq.de>");
 MODULE_DESCRIPTION("lis3lv02d SPI glue layer");
 MODULE_LICENSE("GPL");
-
+MODULE_ALIAS("spi:" DRV_NAME);
diff --git a/drivers/hwmon/lm70.c b/drivers/hwmon/lm70.c
index ae6204f..d55cc7c 100644
--- a/drivers/hwmon/lm70.c
+++ b/drivers/hwmon/lm70.c
@@ -244,3 +244,5 @@ module_exit(cleanup_lm70);
 MODULE_AUTHOR("Kaiwan N Billimoria");
 MODULE_DESCRIPTION("NS LM70 / TI TMP121/TMP123 Linux driver");
 MODULE_LICENSE("GPL");
+MODULE_ALIAS("spi:tmp121");
+MODULE_ALIAS("spi:lm70");
diff --git a/drivers/hwmon/max1111.c b/drivers/hwmon/max1111.c
index bfaa665..9ac4972 100644
--- a/drivers/hwmon/max1111.c
+++ b/drivers/hwmon/max1111.c
@@ -242,3 +242,4 @@ module_exit(max1111_exit);
 MODULE_AUTHOR("Eric Miao <eric.miao@marvell.com>");
 MODULE_DESCRIPTION("MAX1111 ADC Driver");
 MODULE_LICENSE("GPL");
+MODULE_ALIAS("spi:max1111");
diff --git a/drivers/input/touchscreen/ad7877.c b/drivers/input/touchscreen/ad7877.c
index ecaeb7e..eb83939 100644
--- a/drivers/input/touchscreen/ad7877.c
+++ b/drivers/input/touchscreen/ad7877.c
@@ -842,3 +842,4 @@ module_exit(ad7877_exit);
 MODULE_AUTHOR("Michael Hennerich <hennerich@blackfin.uclinux.org>");
 MODULE_DESCRIPTION("AD7877 touchscreen Driver");
 MODULE_LICENSE("GPL");
+MODULE_ALIAS("spi:ad7877");
diff --git a/drivers/input/touchscreen/ad7879.c b/drivers/input/touchscreen/ad7879.c
index 5d8a703..19b4db7 100644
--- a/drivers/input/touchscreen/ad7879.c
+++ b/drivers/input/touchscreen/ad7879.c
@@ -779,3 +779,4 @@ module_exit(ad7879_exit);
 MODULE_AUTHOR("Michael Hennerich <hennerich@blackfin.uclinux.org>");
 MODULE_DESCRIPTION("AD7879(-1) touchscreen Driver");
 MODULE_LICENSE("GPL");
+MODULE_ALIAS("spi:ad7879");
diff --git a/drivers/input/touchscreen/ads7846.c b/drivers/input/touchscreen/ads7846.c
index ba9d38c..09c8109 100644
--- a/drivers/input/touchscreen/ads7846.c
+++ b/drivers/input/touchscreen/ads7846.c
@@ -1256,3 +1256,4 @@ module_exit(ads7846_exit);
 
 MODULE_DESCRIPTION("ADS7846 TouchScreen Driver");
 MODULE_LICENSE("GPL");
+MODULE_ALIAS("spi:ads7846");
diff --git a/drivers/leds/leds-dac124s085.c b/drivers/leds/leds-dac124s085.c
index 098d9aa..2913d76 100644
--- a/drivers/leds/leds-dac124s085.c
+++ b/drivers/leds/leds-dac124s085.c
@@ -148,3 +148,4 @@ module_exit(dac124s085_leds_exit);
 MODULE_AUTHOR("Guennadi Liakhovetski <lg@denx.de>");
 MODULE_DESCRIPTION("DAC124S085 LED driver");
 MODULE_LICENSE("GPL v2");
+MODULE_ALIAS("spi:dac124s085");
diff --git a/drivers/mfd/ezx-pcap.c b/drivers/mfd/ezx-pcap.c
index c1de4af..1672f30 100644
--- a/drivers/mfd/ezx-pcap.c
+++ b/drivers/mfd/ezx-pcap.c
@@ -505,3 +505,4 @@ module_exit(ezx_pcap_exit);
 MODULE_LICENSE("GPL");
 MODULE_AUTHOR("Daniel Ribeiro / Harald Welte");
 MODULE_DESCRIPTION("Motorola PCAP2 ASIC Driver");
+MODULE_ALIAS("spi:ezx-pcap");
diff --git a/drivers/misc/eeprom/at25.c b/drivers/misc/eeprom/at25.c
index b34cb5f..d564de0 100644
--- a/drivers/misc/eeprom/at25.c
+++ b/drivers/misc/eeprom/at25.c
@@ -417,4 +417,4 @@ module_exit(at25_exit);
 MODULE_DESCRIPTION("Driver for most SPI EEPROMs");
 MODULE_AUTHOR("David Brownell");
 MODULE_LICENSE("GPL");
-
+MODULE_ALIAS("spi:at25");
diff --git a/drivers/mmc/host/mmc_spi.c b/drivers/mmc/host/mmc_spi.c
index a461017..d55fe4f 100644
--- a/drivers/mmc/host/mmc_spi.c
+++ b/drivers/mmc/host/mmc_spi.c
@@ -1562,3 +1562,4 @@ MODULE_AUTHOR("Mike Lavender, David Brownell, "
 		"Hans-Peter Nilsson, Jan Nikitenko");
 MODULE_DESCRIPTION("SPI SD/MMC host driver");
 MODULE_LICENSE("GPL");
+MODULE_ALIAS("spi:mmc_spi");
diff --git a/drivers/mtd/devices/mtd_dataflash.c b/drivers/mtd/devices/mtd_dataflash.c
index 43976aa..211c27a 100644
--- a/drivers/mtd/devices/mtd_dataflash.c
+++ b/drivers/mtd/devices/mtd_dataflash.c
@@ -966,3 +966,4 @@ module_exit(dataflash_exit);
 MODULE_LICENSE("GPL");
 MODULE_AUTHOR("Andrew Victor, David Brownell");
 MODULE_DESCRIPTION("MTD DataFlash driver");
+MODULE_ALIAS("spi:mtd_dataflash");
diff --git a/drivers/net/enc28j60.c b/drivers/net/enc28j60.c
index fc6cc03..c709571 100644
--- a/drivers/net/enc28j60.c
+++ b/drivers/net/enc28j60.c
@@ -1665,3 +1665,4 @@ MODULE_AUTHOR("Claudio Lanconelli <lanconelli.claudio@eptar.com>");
 MODULE_LICENSE("GPL");
 module_param_named(debug, debug.msg_enable, int, 0);
 MODULE_PARM_DESC(debug, "Debug verbosity level (0=none, ..., ffff=all)");
+MODULE_ALIAS("spi:" DRV_NAME);
diff --git a/drivers/net/ks8851.c b/drivers/net/ks8851.c
index 9a1dea6..fe7cf4f 100644
--- a/drivers/net/ks8851.c
+++ b/drivers/net/ks8851.c
@@ -1320,3 +1320,4 @@ MODULE_LICENSE("GPL");
 
 module_param_named(message, msg_enable, int, 0);
 MODULE_PARM_DESC(message, "Message verbosity level (0=none, 31=all)");
+MODULE_ALIAS("spi:ks8851");
diff --git a/drivers/net/wireless/libertas/if_spi.c b/drivers/net/wireless/libertas/if_spi.c
index 6564282..ea45765 100644
--- a/drivers/net/wireless/libertas/if_spi.c
+++ b/drivers/net/wireless/libertas/if_spi.c
@@ -1222,3 +1222,4 @@ MODULE_DESCRIPTION("Libertas SPI WLAN Driver");
 MODULE_AUTHOR("Andrey Yurovsky <andrey@cozybit.com>, "
 	      "Colin McCabe <colin@cozybit.com>");
 MODULE_LICENSE("GPL");
+MODULE_ALIAS("spi:libertas_spi");
diff --git a/drivers/net/wireless/p54/p54spi.c b/drivers/net/wireless/p54/p54spi.c
index 72c7dbd..63bcdd1 100644
--- a/drivers/net/wireless/p54/p54spi.c
+++ b/drivers/net/wireless/p54/p54spi.c
@@ -767,3 +767,4 @@ module_exit(p54spi_exit);
 
 MODULE_LICENSE("GPL");
 MODULE_AUTHOR("Christian Lamparter <chunkeey@web.de>");
+MODULE_ALIAS("spi:cx3110x");
diff --git a/drivers/net/wireless/wl12xx/main.c b/drivers/net/wireless/wl12xx/main.c
index 603d611..6416406 100644
--- a/drivers/net/wireless/wl12xx/main.c
+++ b/drivers/net/wireless/wl12xx/main.c
@@ -1356,3 +1356,4 @@ module_exit(wl12xx_exit);
 MODULE_LICENSE("GPL");
 MODULE_AUTHOR("Kalle Valo <Kalle.Valo@nokia.com>, "
 		"Luciano Coelho <luciano.coelho@nokia.com>");
+MODULE_ALIAS("spi:wl12xx");
diff --git a/drivers/rtc/rtc-ds1305.c b/drivers/rtc/rtc-ds1305.c
index 8f410e5..2736b11 100644
--- a/drivers/rtc/rtc-ds1305.c
+++ b/drivers/rtc/rtc-ds1305.c
@@ -841,3 +841,4 @@ module_exit(ds1305_exit);
 
 MODULE_DESCRIPTION("RTC driver for DS1305 and DS1306 chips");
 MODULE_LICENSE("GPL");
+MODULE_ALIAS("spi:rtc-ds1305");
diff --git a/drivers/rtc/rtc-ds1390.c b/drivers/rtc/rtc-ds1390.c
index e01b955..cdb7050 100644
--- a/drivers/rtc/rtc-ds1390.c
+++ b/drivers/rtc/rtc-ds1390.c
@@ -189,3 +189,4 @@ module_exit(ds1390_exit);
 MODULE_DESCRIPTION("Dallas/Maxim DS1390/93/94 SPI RTC driver");
 MODULE_AUTHOR("Mark Jackson <mpfj@mimc.co.uk>");
 MODULE_LICENSE("GPL");
+MODULE_ALIAS("spi:rtc-ds1390");
diff --git a/drivers/rtc/rtc-ds3234.c b/drivers/rtc/rtc-ds3234.c
index c51589e..a774ca3 100644
--- a/drivers/rtc/rtc-ds3234.c
+++ b/drivers/rtc/rtc-ds3234.c
@@ -188,3 +188,4 @@ module_exit(ds3234_exit);
 MODULE_DESCRIPTION("DS3234 SPI RTC driver");
 MODULE_AUTHOR("Dennis Aberilla <denzzzhome@yahoo.com>");
 MODULE_LICENSE("GPL");
+MODULE_ALIAS("spi:ds3234");
diff --git a/drivers/rtc/rtc-m41t94.c b/drivers/rtc/rtc-m41t94.c
index c3a18c5..c8c97a4 100644
--- a/drivers/rtc/rtc-m41t94.c
+++ b/drivers/rtc/rtc-m41t94.c
@@ -171,3 +171,4 @@ module_exit(m41t94_exit);
 MODULE_AUTHOR("Kim B. Heino <Kim.Heino@bluegiga.com>");
 MODULE_DESCRIPTION("Driver for ST M41T94 SPI RTC");
 MODULE_LICENSE("GPL");
+MODULE_ALIAS("spi:rtc-m41t94");
diff --git a/drivers/rtc/rtc-max6902.c b/drivers/rtc/rtc-max6902.c
index 36a8ea9..657403e 100644
--- a/drivers/rtc/rtc-max6902.c
+++ b/drivers/rtc/rtc-max6902.c
@@ -175,3 +175,4 @@ module_exit(max6902_exit);
 MODULE_DESCRIPTION ("max6902 spi RTC driver");
 MODULE_AUTHOR ("Raphael Assenat");
 MODULE_LICENSE ("GPL");
+MODULE_ALIAS("spi:rtc-max6902");
diff --git a/drivers/rtc/rtc-r9701.c b/drivers/rtc/rtc-r9701.c
index 42028f2..9beba49 100644
--- a/drivers/rtc/rtc-r9701.c
+++ b/drivers/rtc/rtc-r9701.c
@@ -174,3 +174,4 @@ module_exit(r9701_exit);
 MODULE_DESCRIPTION("r9701 spi RTC driver");
 MODULE_AUTHOR("Magnus Damm <damm@opensource.se>");
 MODULE_LICENSE("GPL");
+MODULE_ALIAS("spi:rtc-r9701");
diff --git a/drivers/rtc/rtc-rs5c348.c b/drivers/rtc/rtc-rs5c348.c
index dd1e2bc..2099037 100644
--- a/drivers/rtc/rtc-rs5c348.c
+++ b/drivers/rtc/rtc-rs5c348.c
@@ -251,3 +251,4 @@ MODULE_AUTHOR("Atsushi Nemoto <anemo@mba.ocn.ne.jp>");
 MODULE_DESCRIPTION("Ricoh RS5C348 RTC driver");
 MODULE_LICENSE("GPL");
 MODULE_VERSION(DRV_VERSION);
+MODULE_ALIAS("spi:rtc-rs5c348");
diff --git a/drivers/serial/max3100.c b/drivers/serial/max3100.c
index 9fd33e5..05d36e2 100644
--- a/drivers/serial/max3100.c
+++ b/drivers/serial/max3100.c
@@ -925,3 +925,4 @@ module_exit(max3100_exit);
 MODULE_DESCRIPTION("MAX3100 driver");
 MODULE_AUTHOR("Christian Pellegrin <chripell@evolware.org>");
 MODULE_LICENSE("GPL");
+MODULE_ALIAS("spi:max3100");
diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c
index 1431bf2..a3c9804 100644
--- a/drivers/spi/spi.c
+++ b/drivers/spi/spi.c
@@ -23,6 +23,7 @@
 #include <linux/init.h>
 #include <linux/cache.h>
 #include <linux/mutex.h>
+#include <linux/mod_devicetable.h>
 #include <linux/spi/spi.h>
 
 
@@ -85,7 +86,7 @@ static int spi_uevent(struct device *dev, struct kobj_uevent_env *env)
 {
 	const struct spi_device		*spi = to_spi_device(dev);
 
-	add_uevent_var(env, "MODALIAS=%s", spi->modalias);
+	add_uevent_var(env, "MODALIAS=%s%s", SPI_MODULE_PREFIX, spi->modalias);
 	return 0;
 }
 
diff --git a/drivers/spi/spidev.c b/drivers/spi/spidev.c
index 606e7a4..f921bd1 100644
--- a/drivers/spi/spidev.c
+++ b/drivers/spi/spidev.c
@@ -688,3 +688,4 @@ module_exit(spidev_exit);
 MODULE_AUTHOR("Andrea Paterniani, <a.paterniani@swapp-eng.it>");
 MODULE_DESCRIPTION("User mode SPI device interface");
 MODULE_LICENSE("GPL");
+MODULE_ALIAS("spi:spidev");
diff --git a/drivers/spi/tle62x0.c b/drivers/spi/tle62x0.c
index 455991f..bf9540f 100644
--- a/drivers/spi/tle62x0.c
+++ b/drivers/spi/tle62x0.c
@@ -329,3 +329,4 @@ module_exit(tle62x0_exit);
 MODULE_AUTHOR("Ben Dooks <ben@simtec.co.uk>");
 MODULE_DESCRIPTION("TLE62x0 SPI driver");
 MODULE_LICENSE("GPL v2");
+MODULE_ALIAS("spi:tle62x0");
diff --git a/drivers/staging/stlc45xx/stlc45xx.c b/drivers/staging/stlc45xx/stlc45xx.c
index a137c78..38d0b24 100644
--- a/drivers/staging/stlc45xx/stlc45xx.c
+++ b/drivers/staging/stlc45xx/stlc45xx.c
@@ -2590,3 +2590,4 @@ module_exit(stlc45xx_exit);
 
 MODULE_LICENSE("GPL");
 MODULE_AUTHOR("Kalle Valo <kalle.valo@nokia.com>");
+MODULE_ALIAS("spi:cx3110x");
diff --git a/drivers/video/backlight/corgi_lcd.c b/drivers/video/backlight/corgi_lcd.c
index f8a4bb2..2211a85 100644
--- a/drivers/video/backlight/corgi_lcd.c
+++ b/drivers/video/backlight/corgi_lcd.c
@@ -639,3 +639,4 @@ module_exit(corgi_lcd_exit);
 MODULE_DESCRIPTION("LCD and backlight driver for SHARP C7x0/Cxx00");
 MODULE_AUTHOR("Eric Miao <eric.miao@marvell.com>");
 MODULE_LICENSE("GPL");
+MODULE_ALIAS("spi:corgi-lcd");
diff --git a/drivers/video/backlight/ltv350qv.c b/drivers/video/backlight/ltv350qv.c
index 2eb206b..4631ca8 100644
--- a/drivers/video/backlight/ltv350qv.c
+++ b/drivers/video/backlight/ltv350qv.c
@@ -328,3 +328,4 @@ module_exit(ltv350qv_exit);
 MODULE_AUTHOR("Haavard Skinnemoen <hskinnemoen@atmel.com>");
 MODULE_DESCRIPTION("Samsung LTV350QV LCD Driver");
 MODULE_LICENSE("GPL");
+MODULE_ALIAS("spi:ltv350qv");
diff --git a/drivers/video/backlight/tdo24m.c b/drivers/video/backlight/tdo24m.c
index 51422fc..bbfb502 100644
--- a/drivers/video/backlight/tdo24m.c
+++ b/drivers/video/backlight/tdo24m.c
@@ -472,3 +472,4 @@ module_exit(tdo24m_exit);
 MODULE_AUTHOR("Eric Miao <eric.miao@marvell.com>");
 MODULE_DESCRIPTION("Driver for Toppoly TDO24M LCD Panel");
 MODULE_LICENSE("GPL");
+MODULE_ALIAS("spi:tdo24m");
diff --git a/drivers/video/backlight/tosa_lcd.c b/drivers/video/backlight/tosa_lcd.c
index b7fbc75..50ec17d 100644
--- a/drivers/video/backlight/tosa_lcd.c
+++ b/drivers/video/backlight/tosa_lcd.c
@@ -300,4 +300,4 @@ module_exit(tosa_lcd_exit);
 MODULE_AUTHOR("Dmitry Baryshkov");
 MODULE_LICENSE("GPL v2");
 MODULE_DESCRIPTION("LCD/Backlight control for Sharp SL-6000 PDA");
-
+MODULE_ALIAS("spi:tosa-lcd");
diff --git a/drivers/video/backlight/vgg2432a4.c b/drivers/video/backlight/vgg2432a4.c
index 8e653b8..b49063c 100644
--- a/drivers/video/backlight/vgg2432a4.c
+++ b/drivers/video/backlight/vgg2432a4.c
@@ -280,5 +280,4 @@ module_exit(vgg2432a4_exit);
 MODULE_AUTHOR("Ben Dooks <ben-linux@fluff.org>");
 MODULE_DESCRIPTION("VGG2432A4 LCD Driver");
 MODULE_LICENSE("GPL v2");
-
-
+MODULE_ALIAS("spi:VGG2432A4");
diff --git a/include/linux/mod_devicetable.h b/include/linux/mod_devicetable.h
index 9660dca..814db86 100644
--- a/include/linux/mod_devicetable.h
+++ b/include/linux/mod_devicetable.h
@@ -402,6 +402,7 @@ struct i2c_device_id {
 /* spi */
 
 #define SPI_NAME_SIZE	20
+#define SPI_MODULE_PREFIX "spi:"
 
 struct spi_device_id {
 	char name[SPI_NAME_SIZE];
diff --git a/scripts/mod/file2alias.c b/scripts/mod/file2alias.c
index 9d446e3..62a9025 100644
--- a/scripts/mod/file2alias.c
+++ b/scripts/mod/file2alias.c
@@ -657,11 +657,11 @@ static int do_i2c_entry(const char *filename, struct i2c_device_id *id,
 	return 1;
 }
 
-/* Looks like: S */
+/* Looks like: spi:S */
 static int do_spi_entry(const char *filename, struct spi_device_id *id,
 			char *alias)
 {
-	sprintf(alias, "%s", id->name);
+	sprintf(alias, SPI_MODULE_PREFIX "%s", id->name);
 
 	return 1;
 }
-- 
1.6.3.3

^ permalink raw reply related	[flat|nested] 68+ messages in thread

* [lm-sensors] [PATCH 4/7] spi: Prefix modalias with "spi:"
@ 2009-07-29 17:05   ` Anton Vorontsov
  0 siblings, 0 replies; 68+ messages in thread
From: Anton Vorontsov @ 2009-07-29 17:05 UTC (permalink / raw)
  To: Andrew Morton
  Cc: David Brownell, David Woodhouse, Grant Likely, Jean Delvare,
	linux-mtd, linux-kernel, lm-sensors, linuxppc-dev

This makes it consistent with other buses (platform, i2c, vio, ...).
I'm not sure why we use the prefixes, but there must be a reason.

This was easy enough to do it, and I did it.

Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com>
---
 drivers/gpio/max7301.c                 |    1 +
 drivers/gpio/mcp23s08.c                |    1 +
 drivers/hwmon/adcxx.c                  |    8 ++++----
 drivers/hwmon/lis3lv02d_spi.c          |    2 +-
 drivers/hwmon/lm70.c                   |    2 ++
 drivers/hwmon/max1111.c                |    1 +
 drivers/input/touchscreen/ad7877.c     |    1 +
 drivers/input/touchscreen/ad7879.c     |    1 +
 drivers/input/touchscreen/ads7846.c    |    1 +
 drivers/leds/leds-dac124s085.c         |    1 +
 drivers/mfd/ezx-pcap.c                 |    1 +
 drivers/misc/eeprom/at25.c             |    2 +-
 drivers/mmc/host/mmc_spi.c             |    1 +
 drivers/mtd/devices/mtd_dataflash.c    |    1 +
 drivers/net/enc28j60.c                 |    1 +
 drivers/net/ks8851.c                   |    1 +
 drivers/net/wireless/libertas/if_spi.c |    1 +
 drivers/net/wireless/p54/p54spi.c      |    1 +
 drivers/net/wireless/wl12xx/main.c     |    1 +
 drivers/rtc/rtc-ds1305.c               |    1 +
 drivers/rtc/rtc-ds1390.c               |    1 +
 drivers/rtc/rtc-ds3234.c               |    1 +
 drivers/rtc/rtc-m41t94.c               |    1 +
 drivers/rtc/rtc-max6902.c              |    1 +
 drivers/rtc/rtc-r9701.c                |    1 +
 drivers/rtc/rtc-rs5c348.c              |    1 +
 drivers/serial/max3100.c               |    1 +
 drivers/spi/spi.c                      |    3 ++-
 drivers/spi/spidev.c                   |    1 +
 drivers/spi/tle62x0.c                  |    1 +
 drivers/staging/stlc45xx/stlc45xx.c    |    1 +
 drivers/video/backlight/corgi_lcd.c    |    1 +
 drivers/video/backlight/ltv350qv.c     |    1 +
 drivers/video/backlight/tdo24m.c       |    1 +
 drivers/video/backlight/tosa_lcd.c     |    2 +-
 drivers/video/backlight/vgg2432a4.c    |    3 +--
 include/linux/mod_devicetable.h        |    1 +
 scripts/mod/file2alias.c               |    4 ++--
 38 files changed, 44 insertions(+), 12 deletions(-)

diff --git a/drivers/gpio/max7301.c b/drivers/gpio/max7301.c
index 7b82eaa..480956f 100644
--- a/drivers/gpio/max7301.c
+++ b/drivers/gpio/max7301.c
@@ -339,3 +339,4 @@ module_exit(max7301_exit);
 MODULE_AUTHOR("Juergen Beisert");
 MODULE_LICENSE("GPL v2");
 MODULE_DESCRIPTION("MAX7301 SPI based GPIO-Expander");
+MODULE_ALIAS("spi:" DRIVER_NAME);
diff --git a/drivers/gpio/mcp23s08.c b/drivers/gpio/mcp23s08.c
index f6fae0e..c6c7aa1 100644
--- a/drivers/gpio/mcp23s08.c
+++ b/drivers/gpio/mcp23s08.c
@@ -433,3 +433,4 @@ static void __exit mcp23s08_exit(void)
 module_exit(mcp23s08_exit);
 
 MODULE_LICENSE("GPL");
+MODULE_ALIAS("spi:mcp23s08");
diff --git a/drivers/hwmon/adcxx.c b/drivers/hwmon/adcxx.c
index 242294d..7a89fba 100644
--- a/drivers/hwmon/adcxx.c
+++ b/drivers/hwmon/adcxx.c
@@ -323,7 +323,7 @@ MODULE_AUTHOR("Marc Pignat");
 MODULE_DESCRIPTION("National Semiconductor adcxx8sxxx Linux driver");
 MODULE_LICENSE("GPL");
 
-MODULE_ALIAS("adcxx1s");
-MODULE_ALIAS("adcxx2s");
-MODULE_ALIAS("adcxx4s");
-MODULE_ALIAS("adcxx8s");
+MODULE_ALIAS("spi:adcxx1s");
+MODULE_ALIAS("spi:adcxx2s");
+MODULE_ALIAS("spi:adcxx4s");
+MODULE_ALIAS("spi:adcxx8s");
diff --git a/drivers/hwmon/lis3lv02d_spi.c b/drivers/hwmon/lis3lv02d_spi.c
index 3827ff0..b7aed07 100644
--- a/drivers/hwmon/lis3lv02d_spi.c
+++ b/drivers/hwmon/lis3lv02d_spi.c
@@ -112,4 +112,4 @@ module_exit(lis302dl_exit);
 MODULE_AUTHOR("Daniel Mack <daniel@caiaq.de>");
 MODULE_DESCRIPTION("lis3lv02d SPI glue layer");
 MODULE_LICENSE("GPL");
-
+MODULE_ALIAS("spi:" DRV_NAME);
diff --git a/drivers/hwmon/lm70.c b/drivers/hwmon/lm70.c
index ae6204f..d55cc7c 100644
--- a/drivers/hwmon/lm70.c
+++ b/drivers/hwmon/lm70.c
@@ -244,3 +244,5 @@ module_exit(cleanup_lm70);
 MODULE_AUTHOR("Kaiwan N Billimoria");
 MODULE_DESCRIPTION("NS LM70 / TI TMP121/TMP123 Linux driver");
 MODULE_LICENSE("GPL");
+MODULE_ALIAS("spi:tmp121");
+MODULE_ALIAS("spi:lm70");
diff --git a/drivers/hwmon/max1111.c b/drivers/hwmon/max1111.c
index bfaa665..9ac4972 100644
--- a/drivers/hwmon/max1111.c
+++ b/drivers/hwmon/max1111.c
@@ -242,3 +242,4 @@ module_exit(max1111_exit);
 MODULE_AUTHOR("Eric Miao <eric.miao@marvell.com>");
 MODULE_DESCRIPTION("MAX1111 ADC Driver");
 MODULE_LICENSE("GPL");
+MODULE_ALIAS("spi:max1111");
diff --git a/drivers/input/touchscreen/ad7877.c b/drivers/input/touchscreen/ad7877.c
index ecaeb7e..eb83939 100644
--- a/drivers/input/touchscreen/ad7877.c
+++ b/drivers/input/touchscreen/ad7877.c
@@ -842,3 +842,4 @@ module_exit(ad7877_exit);
 MODULE_AUTHOR("Michael Hennerich <hennerich@blackfin.uclinux.org>");
 MODULE_DESCRIPTION("AD7877 touchscreen Driver");
 MODULE_LICENSE("GPL");
+MODULE_ALIAS("spi:ad7877");
diff --git a/drivers/input/touchscreen/ad7879.c b/drivers/input/touchscreen/ad7879.c
index 5d8a703..19b4db7 100644
--- a/drivers/input/touchscreen/ad7879.c
+++ b/drivers/input/touchscreen/ad7879.c
@@ -779,3 +779,4 @@ module_exit(ad7879_exit);
 MODULE_AUTHOR("Michael Hennerich <hennerich@blackfin.uclinux.org>");
 MODULE_DESCRIPTION("AD7879(-1) touchscreen Driver");
 MODULE_LICENSE("GPL");
+MODULE_ALIAS("spi:ad7879");
diff --git a/drivers/input/touchscreen/ads7846.c b/drivers/input/touchscreen/ads7846.c
index ba9d38c..09c8109 100644
--- a/drivers/input/touchscreen/ads7846.c
+++ b/drivers/input/touchscreen/ads7846.c
@@ -1256,3 +1256,4 @@ module_exit(ads7846_exit);
 
 MODULE_DESCRIPTION("ADS7846 TouchScreen Driver");
 MODULE_LICENSE("GPL");
+MODULE_ALIAS("spi:ads7846");
diff --git a/drivers/leds/leds-dac124s085.c b/drivers/leds/leds-dac124s085.c
index 098d9aa..2913d76 100644
--- a/drivers/leds/leds-dac124s085.c
+++ b/drivers/leds/leds-dac124s085.c
@@ -148,3 +148,4 @@ module_exit(dac124s085_leds_exit);
 MODULE_AUTHOR("Guennadi Liakhovetski <lg@denx.de>");
 MODULE_DESCRIPTION("DAC124S085 LED driver");
 MODULE_LICENSE("GPL v2");
+MODULE_ALIAS("spi:dac124s085");
diff --git a/drivers/mfd/ezx-pcap.c b/drivers/mfd/ezx-pcap.c
index c1de4af..1672f30 100644
--- a/drivers/mfd/ezx-pcap.c
+++ b/drivers/mfd/ezx-pcap.c
@@ -505,3 +505,4 @@ module_exit(ezx_pcap_exit);
 MODULE_LICENSE("GPL");
 MODULE_AUTHOR("Daniel Ribeiro / Harald Welte");
 MODULE_DESCRIPTION("Motorola PCAP2 ASIC Driver");
+MODULE_ALIAS("spi:ezx-pcap");
diff --git a/drivers/misc/eeprom/at25.c b/drivers/misc/eeprom/at25.c
index b34cb5f..d564de0 100644
--- a/drivers/misc/eeprom/at25.c
+++ b/drivers/misc/eeprom/at25.c
@@ -417,4 +417,4 @@ module_exit(at25_exit);
 MODULE_DESCRIPTION("Driver for most SPI EEPROMs");
 MODULE_AUTHOR("David Brownell");
 MODULE_LICENSE("GPL");
-
+MODULE_ALIAS("spi:at25");
diff --git a/drivers/mmc/host/mmc_spi.c b/drivers/mmc/host/mmc_spi.c
index a461017..d55fe4f 100644
--- a/drivers/mmc/host/mmc_spi.c
+++ b/drivers/mmc/host/mmc_spi.c
@@ -1562,3 +1562,4 @@ MODULE_AUTHOR("Mike Lavender, David Brownell, "
 		"Hans-Peter Nilsson, Jan Nikitenko");
 MODULE_DESCRIPTION("SPI SD/MMC host driver");
 MODULE_LICENSE("GPL");
+MODULE_ALIAS("spi:mmc_spi");
diff --git a/drivers/mtd/devices/mtd_dataflash.c b/drivers/mtd/devices/mtd_dataflash.c
index 43976aa..211c27a 100644
--- a/drivers/mtd/devices/mtd_dataflash.c
+++ b/drivers/mtd/devices/mtd_dataflash.c
@@ -966,3 +966,4 @@ module_exit(dataflash_exit);
 MODULE_LICENSE("GPL");
 MODULE_AUTHOR("Andrew Victor, David Brownell");
 MODULE_DESCRIPTION("MTD DataFlash driver");
+MODULE_ALIAS("spi:mtd_dataflash");
diff --git a/drivers/net/enc28j60.c b/drivers/net/enc28j60.c
index fc6cc03..c709571 100644
--- a/drivers/net/enc28j60.c
+++ b/drivers/net/enc28j60.c
@@ -1665,3 +1665,4 @@ MODULE_AUTHOR("Claudio Lanconelli <lanconelli.claudio@eptar.com>");
 MODULE_LICENSE("GPL");
 module_param_named(debug, debug.msg_enable, int, 0);
 MODULE_PARM_DESC(debug, "Debug verbosity level (0=none, ..., ffff=all)");
+MODULE_ALIAS("spi:" DRV_NAME);
diff --git a/drivers/net/ks8851.c b/drivers/net/ks8851.c
index 9a1dea6..fe7cf4f 100644
--- a/drivers/net/ks8851.c
+++ b/drivers/net/ks8851.c
@@ -1320,3 +1320,4 @@ MODULE_LICENSE("GPL");
 
 module_param_named(message, msg_enable, int, 0);
 MODULE_PARM_DESC(message, "Message verbosity level (0=none, 31=all)");
+MODULE_ALIAS("spi:ks8851");
diff --git a/drivers/net/wireless/libertas/if_spi.c b/drivers/net/wireless/libertas/if_spi.c
index 6564282..ea45765 100644
--- a/drivers/net/wireless/libertas/if_spi.c
+++ b/drivers/net/wireless/libertas/if_spi.c
@@ -1222,3 +1222,4 @@ MODULE_DESCRIPTION("Libertas SPI WLAN Driver");
 MODULE_AUTHOR("Andrey Yurovsky <andrey@cozybit.com>, "
 	      "Colin McCabe <colin@cozybit.com>");
 MODULE_LICENSE("GPL");
+MODULE_ALIAS("spi:libertas_spi");
diff --git a/drivers/net/wireless/p54/p54spi.c b/drivers/net/wireless/p54/p54spi.c
index 72c7dbd..63bcdd1 100644
--- a/drivers/net/wireless/p54/p54spi.c
+++ b/drivers/net/wireless/p54/p54spi.c
@@ -767,3 +767,4 @@ module_exit(p54spi_exit);
 
 MODULE_LICENSE("GPL");
 MODULE_AUTHOR("Christian Lamparter <chunkeey@web.de>");
+MODULE_ALIAS("spi:cx3110x");
diff --git a/drivers/net/wireless/wl12xx/main.c b/drivers/net/wireless/wl12xx/main.c
index 603d611..6416406 100644
--- a/drivers/net/wireless/wl12xx/main.c
+++ b/drivers/net/wireless/wl12xx/main.c
@@ -1356,3 +1356,4 @@ module_exit(wl12xx_exit);
 MODULE_LICENSE("GPL");
 MODULE_AUTHOR("Kalle Valo <Kalle.Valo@nokia.com>, "
 		"Luciano Coelho <luciano.coelho@nokia.com>");
+MODULE_ALIAS("spi:wl12xx");
diff --git a/drivers/rtc/rtc-ds1305.c b/drivers/rtc/rtc-ds1305.c
index 8f410e5..2736b11 100644
--- a/drivers/rtc/rtc-ds1305.c
+++ b/drivers/rtc/rtc-ds1305.c
@@ -841,3 +841,4 @@ module_exit(ds1305_exit);
 
 MODULE_DESCRIPTION("RTC driver for DS1305 and DS1306 chips");
 MODULE_LICENSE("GPL");
+MODULE_ALIAS("spi:rtc-ds1305");
diff --git a/drivers/rtc/rtc-ds1390.c b/drivers/rtc/rtc-ds1390.c
index e01b955..cdb7050 100644
--- a/drivers/rtc/rtc-ds1390.c
+++ b/drivers/rtc/rtc-ds1390.c
@@ -189,3 +189,4 @@ module_exit(ds1390_exit);
 MODULE_DESCRIPTION("Dallas/Maxim DS1390/93/94 SPI RTC driver");
 MODULE_AUTHOR("Mark Jackson <mpfj@mimc.co.uk>");
 MODULE_LICENSE("GPL");
+MODULE_ALIAS("spi:rtc-ds1390");
diff --git a/drivers/rtc/rtc-ds3234.c b/drivers/rtc/rtc-ds3234.c
index c51589e..a774ca3 100644
--- a/drivers/rtc/rtc-ds3234.c
+++ b/drivers/rtc/rtc-ds3234.c
@@ -188,3 +188,4 @@ module_exit(ds3234_exit);
 MODULE_DESCRIPTION("DS3234 SPI RTC driver");
 MODULE_AUTHOR("Dennis Aberilla <denzzzhome@yahoo.com>");
 MODULE_LICENSE("GPL");
+MODULE_ALIAS("spi:ds3234");
diff --git a/drivers/rtc/rtc-m41t94.c b/drivers/rtc/rtc-m41t94.c
index c3a18c5..c8c97a4 100644
--- a/drivers/rtc/rtc-m41t94.c
+++ b/drivers/rtc/rtc-m41t94.c
@@ -171,3 +171,4 @@ module_exit(m41t94_exit);
 MODULE_AUTHOR("Kim B. Heino <Kim.Heino@bluegiga.com>");
 MODULE_DESCRIPTION("Driver for ST M41T94 SPI RTC");
 MODULE_LICENSE("GPL");
+MODULE_ALIAS("spi:rtc-m41t94");
diff --git a/drivers/rtc/rtc-max6902.c b/drivers/rtc/rtc-max6902.c
index 36a8ea9..657403e 100644
--- a/drivers/rtc/rtc-max6902.c
+++ b/drivers/rtc/rtc-max6902.c
@@ -175,3 +175,4 @@ module_exit(max6902_exit);
 MODULE_DESCRIPTION ("max6902 spi RTC driver");
 MODULE_AUTHOR ("Raphael Assenat");
 MODULE_LICENSE ("GPL");
+MODULE_ALIAS("spi:rtc-max6902");
diff --git a/drivers/rtc/rtc-r9701.c b/drivers/rtc/rtc-r9701.c
index 42028f2..9beba49 100644
--- a/drivers/rtc/rtc-r9701.c
+++ b/drivers/rtc/rtc-r9701.c
@@ -174,3 +174,4 @@ module_exit(r9701_exit);
 MODULE_DESCRIPTION("r9701 spi RTC driver");
 MODULE_AUTHOR("Magnus Damm <damm@opensource.se>");
 MODULE_LICENSE("GPL");
+MODULE_ALIAS("spi:rtc-r9701");
diff --git a/drivers/rtc/rtc-rs5c348.c b/drivers/rtc/rtc-rs5c348.c
index dd1e2bc..2099037 100644
--- a/drivers/rtc/rtc-rs5c348.c
+++ b/drivers/rtc/rtc-rs5c348.c
@@ -251,3 +251,4 @@ MODULE_AUTHOR("Atsushi Nemoto <anemo@mba.ocn.ne.jp>");
 MODULE_DESCRIPTION("Ricoh RS5C348 RTC driver");
 MODULE_LICENSE("GPL");
 MODULE_VERSION(DRV_VERSION);
+MODULE_ALIAS("spi:rtc-rs5c348");
diff --git a/drivers/serial/max3100.c b/drivers/serial/max3100.c
index 9fd33e5..05d36e2 100644
--- a/drivers/serial/max3100.c
+++ b/drivers/serial/max3100.c
@@ -925,3 +925,4 @@ module_exit(max3100_exit);
 MODULE_DESCRIPTION("MAX3100 driver");
 MODULE_AUTHOR("Christian Pellegrin <chripell@evolware.org>");
 MODULE_LICENSE("GPL");
+MODULE_ALIAS("spi:max3100");
diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c
index 1431bf2..a3c9804 100644
--- a/drivers/spi/spi.c
+++ b/drivers/spi/spi.c
@@ -23,6 +23,7 @@
 #include <linux/init.h>
 #include <linux/cache.h>
 #include <linux/mutex.h>
+#include <linux/mod_devicetable.h>
 #include <linux/spi/spi.h>
 
 
@@ -85,7 +86,7 @@ static int spi_uevent(struct device *dev, struct kobj_uevent_env *env)
 {
 	const struct spi_device		*spi = to_spi_device(dev);
 
-	add_uevent_var(env, "MODALIAS=%s", spi->modalias);
+	add_uevent_var(env, "MODALIAS=%s%s", SPI_MODULE_PREFIX, spi->modalias);
 	return 0;
 }
 
diff --git a/drivers/spi/spidev.c b/drivers/spi/spidev.c
index 606e7a4..f921bd1 100644
--- a/drivers/spi/spidev.c
+++ b/drivers/spi/spidev.c
@@ -688,3 +688,4 @@ module_exit(spidev_exit);
 MODULE_AUTHOR("Andrea Paterniani, <a.paterniani@swapp-eng.it>");
 MODULE_DESCRIPTION("User mode SPI device interface");
 MODULE_LICENSE("GPL");
+MODULE_ALIAS("spi:spidev");
diff --git a/drivers/spi/tle62x0.c b/drivers/spi/tle62x0.c
index 455991f..bf9540f 100644
--- a/drivers/spi/tle62x0.c
+++ b/drivers/spi/tle62x0.c
@@ -329,3 +329,4 @@ module_exit(tle62x0_exit);
 MODULE_AUTHOR("Ben Dooks <ben@simtec.co.uk>");
 MODULE_DESCRIPTION("TLE62x0 SPI driver");
 MODULE_LICENSE("GPL v2");
+MODULE_ALIAS("spi:tle62x0");
diff --git a/drivers/staging/stlc45xx/stlc45xx.c b/drivers/staging/stlc45xx/stlc45xx.c
index a137c78..38d0b24 100644
--- a/drivers/staging/stlc45xx/stlc45xx.c
+++ b/drivers/staging/stlc45xx/stlc45xx.c
@@ -2590,3 +2590,4 @@ module_exit(stlc45xx_exit);
 
 MODULE_LICENSE("GPL");
 MODULE_AUTHOR("Kalle Valo <kalle.valo@nokia.com>");
+MODULE_ALIAS("spi:cx3110x");
diff --git a/drivers/video/backlight/corgi_lcd.c b/drivers/video/backlight/corgi_lcd.c
index f8a4bb2..2211a85 100644
--- a/drivers/video/backlight/corgi_lcd.c
+++ b/drivers/video/backlight/corgi_lcd.c
@@ -639,3 +639,4 @@ module_exit(corgi_lcd_exit);
 MODULE_DESCRIPTION("LCD and backlight driver for SHARP C7x0/Cxx00");
 MODULE_AUTHOR("Eric Miao <eric.miao@marvell.com>");
 MODULE_LICENSE("GPL");
+MODULE_ALIAS("spi:corgi-lcd");
diff --git a/drivers/video/backlight/ltv350qv.c b/drivers/video/backlight/ltv350qv.c
index 2eb206b..4631ca8 100644
--- a/drivers/video/backlight/ltv350qv.c
+++ b/drivers/video/backlight/ltv350qv.c
@@ -328,3 +328,4 @@ module_exit(ltv350qv_exit);
 MODULE_AUTHOR("Haavard Skinnemoen <hskinnemoen@atmel.com>");
 MODULE_DESCRIPTION("Samsung LTV350QV LCD Driver");
 MODULE_LICENSE("GPL");
+MODULE_ALIAS("spi:ltv350qv");
diff --git a/drivers/video/backlight/tdo24m.c b/drivers/video/backlight/tdo24m.c
index 51422fc..bbfb502 100644
--- a/drivers/video/backlight/tdo24m.c
+++ b/drivers/video/backlight/tdo24m.c
@@ -472,3 +472,4 @@ module_exit(tdo24m_exit);
 MODULE_AUTHOR("Eric Miao <eric.miao@marvell.com>");
 MODULE_DESCRIPTION("Driver for Toppoly TDO24M LCD Panel");
 MODULE_LICENSE("GPL");
+MODULE_ALIAS("spi:tdo24m");
diff --git a/drivers/video/backlight/tosa_lcd.c b/drivers/video/backlight/tosa_lcd.c
index b7fbc75..50ec17d 100644
--- a/drivers/video/backlight/tosa_lcd.c
+++ b/drivers/video/backlight/tosa_lcd.c
@@ -300,4 +300,4 @@ module_exit(tosa_lcd_exit);
 MODULE_AUTHOR("Dmitry Baryshkov");
 MODULE_LICENSE("GPL v2");
 MODULE_DESCRIPTION("LCD/Backlight control for Sharp SL-6000 PDA");
-
+MODULE_ALIAS("spi:tosa-lcd");
diff --git a/drivers/video/backlight/vgg2432a4.c b/drivers/video/backlight/vgg2432a4.c
index 8e653b8..b49063c 100644
--- a/drivers/video/backlight/vgg2432a4.c
+++ b/drivers/video/backlight/vgg2432a4.c
@@ -280,5 +280,4 @@ module_exit(vgg2432a4_exit);
 MODULE_AUTHOR("Ben Dooks <ben-linux@fluff.org>");
 MODULE_DESCRIPTION("VGG2432A4 LCD Driver");
 MODULE_LICENSE("GPL v2");
-
-
+MODULE_ALIAS("spi:VGG2432A4");
diff --git a/include/linux/mod_devicetable.h b/include/linux/mod_devicetable.h
index 9660dca..814db86 100644
--- a/include/linux/mod_devicetable.h
+++ b/include/linux/mod_devicetable.h
@@ -402,6 +402,7 @@ struct i2c_device_id {
 /* spi */
 
 #define SPI_NAME_SIZE	20
+#define SPI_MODULE_PREFIX "spi:"
 
 struct spi_device_id {
 	char name[SPI_NAME_SIZE];
diff --git a/scripts/mod/file2alias.c b/scripts/mod/file2alias.c
index 9d446e3..62a9025 100644
--- a/scripts/mod/file2alias.c
+++ b/scripts/mod/file2alias.c
@@ -657,11 +657,11 @@ static int do_i2c_entry(const char *filename, struct i2c_device_id *id,
 	return 1;
 }
 
-/* Looks like: S */
+/* Looks like: spi:S */
 static int do_spi_entry(const char *filename, struct spi_device_id *id,
 			char *alias)
 {
-	sprintf(alias, "%s", id->name);
+	sprintf(alias, SPI_MODULE_PREFIX "%s", id->name);
 
 	return 1;
 }
-- 
1.6.3.3


_______________________________________________
lm-sensors mailing list
lm-sensors@lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

^ permalink raw reply related	[flat|nested] 68+ messages in thread

* [PATCH 5/7] spi: Merge probe and probe_id callbacks
  2009-07-29 17:03 ` Anton Vorontsov
  (?)
  (?)
@ 2009-07-29 17:05   ` Anton Vorontsov
  -1 siblings, 0 replies; 68+ messages in thread
From: Anton Vorontsov @ 2009-07-29 17:05 UTC (permalink / raw)
  To: Andrew Morton
  Cc: David Brownell, David Woodhouse, Grant Likely, Jean Delvare,
	linux-mtd, linux-kernel, lm-sensors, linuxppc-dev

The probe_id callback was introduced for the transition period
as a "new-style" probe hook. This patch makes probe() look exactly
as probe_id(), converts drivers and removes probe_id().

Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com>
---
 drivers/gpio/max7301.c                 |    3 ++-
 drivers/gpio/mcp23s08.c                |    3 ++-
 drivers/hwmon/adcxx.c                  |   12 ++++++++----
 drivers/hwmon/lis3lv02d_spi.c          |    3 ++-
 drivers/hwmon/lm70.c                   |    6 ++++--
 drivers/hwmon/max1111.c                |    3 ++-
 drivers/input/touchscreen/ad7877.c     |    3 ++-
 drivers/input/touchscreen/ad7879.c     |    3 ++-
 drivers/input/touchscreen/ads7846.c    |    3 ++-
 drivers/leds/leds-dac124s085.c         |    3 ++-
 drivers/mfd/ezx-pcap.c                 |    3 ++-
 drivers/misc/eeprom/at25.c             |    2 +-
 drivers/mmc/host/mmc_spi.c             |    3 ++-
 drivers/mtd/devices/m25p80.c           |    2 +-
 drivers/mtd/devices/mtd_dataflash.c    |    3 ++-
 drivers/net/enc28j60.c                 |    3 ++-
 drivers/net/ks8851.c                   |    3 ++-
 drivers/net/wireless/libertas/if_spi.c |    3 ++-
 drivers/net/wireless/p54/p54spi.c      |    3 ++-
 drivers/net/wireless/wl12xx/main.c     |    3 ++-
 drivers/rtc/rtc-ds1305.c               |    3 ++-
 drivers/rtc/rtc-ds1390.c               |    3 ++-
 drivers/rtc/rtc-ds3234.c               |    3 ++-
 drivers/rtc/rtc-m41t94.c               |    3 ++-
 drivers/rtc/rtc-max6902.c              |    3 ++-
 drivers/rtc/rtc-r9701.c                |    3 ++-
 drivers/rtc/rtc-rs5c348.c              |    3 ++-
 drivers/serial/max3100.c               |    3 ++-
 drivers/spi/spi.c                      |   15 +++------------
 drivers/spi/spidev.c                   |    2 +-
 drivers/spi/tle62x0.c                  |    3 ++-
 drivers/staging/stlc45xx/stlc45xx.c    |    3 ++-
 drivers/video/backlight/corgi_lcd.c    |    3 ++-
 drivers/video/backlight/ltv350qv.c     |    3 ++-
 drivers/video/backlight/tdo24m.c       |    3 ++-
 drivers/video/backlight/tosa_lcd.c     |    3 ++-
 drivers/video/backlight/vgg2432a4.c    |    3 ++-
 include/linux/spi/spi.h                |    6 ++----
 38 files changed, 82 insertions(+), 56 deletions(-)

diff --git a/drivers/gpio/max7301.c b/drivers/gpio/max7301.c
index 480956f..c92cff6 100644
--- a/drivers/gpio/max7301.c
+++ b/drivers/gpio/max7301.c
@@ -210,7 +210,8 @@ static void max7301_set(struct gpio_chip *chip, unsigned offset, int value)
 	mutex_unlock(&ts->lock);
 }
 
-static int __devinit max7301_probe(struct spi_device *spi)
+static int __devinit max7301_probe(struct spi_device *spi,
+				   const struct spi_device_id *id)
 {
 	struct max7301 *ts;
 	struct max7301_platform_data *pdata;
diff --git a/drivers/gpio/mcp23s08.c b/drivers/gpio/mcp23s08.c
index c6c7aa1..2a99eea 100644
--- a/drivers/gpio/mcp23s08.c
+++ b/drivers/gpio/mcp23s08.c
@@ -300,7 +300,8 @@ fail:
 	return status;
 }
 
-static int mcp23s08_probe(struct spi_device *spi)
+static int mcp23s08_probe(struct spi_device *spi,
+			  const struct spi_device_id *id)
 {
 	struct mcp23s08_platform_data	*pdata;
 	unsigned			addr;
diff --git a/drivers/hwmon/adcxx.c b/drivers/hwmon/adcxx.c
index 7a89fba..b01c0d5 100644
--- a/drivers/hwmon/adcxx.c
+++ b/drivers/hwmon/adcxx.c
@@ -204,22 +204,26 @@ out_err:
 	return status;
 }
 
-static int __devinit adcxx1s_probe(struct spi_device *spi)
+static int __devinit adcxx1s_probe(struct spi_device *spi,
+				   const struct spi_device_id *id)
 {
 	return adcxx_probe(spi, 1);
 }
 
-static int __devinit adcxx2s_probe(struct spi_device *spi)
+static int __devinit adcxx2s_probe(struct spi_device *spi,
+				   const struct spi_device_id *id)
 {
 	return adcxx_probe(spi, 2);
 }
 
-static int __devinit adcxx4s_probe(struct spi_device *spi)
+static int __devinit adcxx4s_probe(struct spi_device *spi,
+				   const struct spi_device_id *id)
 {
 	return adcxx_probe(spi, 4);
 }
 
-static int __devinit adcxx8s_probe(struct spi_device *spi)
+static int __devinit adcxx8s_probe(struct spi_device *spi,
+				   const struct spi_device_id *id)
 {
 	return adcxx_probe(spi, 8);
 }
diff --git a/drivers/hwmon/lis3lv02d_spi.c b/drivers/hwmon/lis3lv02d_spi.c
index b7aed07..478b1d4 100644
--- a/drivers/hwmon/lis3lv02d_spi.c
+++ b/drivers/hwmon/lis3lv02d_spi.c
@@ -56,7 +56,8 @@ static int lis3_spi_init(struct lis3lv02d *lis3)
 
 static struct axis_conversion lis3lv02d_axis_normal = { 1, 2, 3 };
 
-static int __devinit lis302dl_spi_probe(struct spi_device *spi)
+static int __devinit lis302dl_spi_probe(struct spi_device *spi,
+					const struct spi_device_id *id)
 {
 	int ret;
 
diff --git a/drivers/hwmon/lm70.c b/drivers/hwmon/lm70.c
index d55cc7c..3953c22 100644
--- a/drivers/hwmon/lm70.c
+++ b/drivers/hwmon/lm70.c
@@ -170,7 +170,8 @@ out_dev_reg_failed:
 	return status;
 }
 
-static int __devinit lm70_probe(struct spi_device *spi)
+static int __devinit lm70_probe(struct spi_device *spi,
+				const struct spi_device_id *id)
 {
 	/* signaling is SPI_MODE_0 on a 3-wire link (shared SI/SO) */
 	if ((spi->mode & (SPI_CPOL | SPI_CPHA)) || !(spi->mode & SPI_3WIRE))
@@ -179,7 +180,8 @@ static int __devinit lm70_probe(struct spi_device *spi)
 	return common_probe(spi, LM70_CHIP_LM70);
 }
 
-static int __devinit tmp121_probe(struct spi_device *spi)
+static int __devinit tmp121_probe(struct spi_device *spi,
+				  const struct spi_device_id *id)
 {
 	/* signaling is SPI_MODE_0 with only MISO connected */
 	if (spi->mode & (SPI_CPOL | SPI_CPHA))
diff --git a/drivers/hwmon/max1111.c b/drivers/hwmon/max1111.c
index 9ac4972..df0ce3b 100644
--- a/drivers/hwmon/max1111.c
+++ b/drivers/hwmon/max1111.c
@@ -154,7 +154,8 @@ static int setup_transfer(struct max1111_data *data)
 	return 0;
 }
 
-static int __devinit max1111_probe(struct spi_device *spi)
+static int __devinit max1111_probe(struct spi_device *spi,
+				   const struct spi_device_id *id)
 {
 	struct max1111_data *data;
 	int err;
diff --git a/drivers/input/touchscreen/ad7877.c b/drivers/input/touchscreen/ad7877.c
index eb83939..8b44d87 100644
--- a/drivers/input/touchscreen/ad7877.c
+++ b/drivers/input/touchscreen/ad7877.c
@@ -646,7 +646,8 @@ static void ad7877_setup_ts_def_msg(struct spi_device *spi, struct ad7877 *ts)
 	}
 }
 
-static int __devinit ad7877_probe(struct spi_device *spi)
+static int __devinit ad7877_probe(struct spi_device *spi,
+				  const struct spi_device_id *id)
 {
 	struct ad7877			*ts;
 	struct input_dev		*input_dev;
diff --git a/drivers/input/touchscreen/ad7879.c b/drivers/input/touchscreen/ad7879.c
index 19b4db7..aee8a94 100644
--- a/drivers/input/touchscreen/ad7879.c
+++ b/drivers/input/touchscreen/ad7879.c
@@ -618,7 +618,8 @@ static void ad7879_setup_ts_def_msg(struct ad7879 *ts)
 	}
 }
 
-static int __devinit ad7879_probe(struct spi_device *spi)
+static int __devinit ad7879_probe(struct spi_device *spi,
+				  const struct spi_device_id *id)
 {
 	struct ad7879 *ts;
 	int error;
diff --git a/drivers/input/touchscreen/ads7846.c b/drivers/input/touchscreen/ads7846.c
index 09c8109..eb12b09 100644
--- a/drivers/input/touchscreen/ads7846.c
+++ b/drivers/input/touchscreen/ads7846.c
@@ -872,7 +872,8 @@ static int __devinit setup_pendown(struct spi_device *spi, struct ads7846 *ts)
 	return 0;
 }
 
-static int __devinit ads7846_probe(struct spi_device *spi)
+static int __devinit ads7846_probe(struct spi_device *spi,
+				   const struct spi_device_id *id)
 {
 	struct ads7846			*ts;
 	struct ads7846_packet		*packet;
diff --git a/drivers/leds/leds-dac124s085.c b/drivers/leds/leds-dac124s085.c
index 2913d76..d6430d9 100644
--- a/drivers/leds/leds-dac124s085.c
+++ b/drivers/leds/leds-dac124s085.c
@@ -64,7 +64,8 @@ static void dac124s085_set_brightness(struct led_classdev *ldev,
 	spin_unlock(&led->lock);
 }
 
-static int dac124s085_probe(struct spi_device *spi)
+static int dac124s085_probe(struct spi_device *spi,
+			    const struct spi_device_id *id)
 {
 	struct dac124s085	*dac;
 	struct dac124s085_led	*led;
diff --git a/drivers/mfd/ezx-pcap.c b/drivers/mfd/ezx-pcap.c
index 1672f30..a658452 100644
--- a/drivers/mfd/ezx-pcap.c
+++ b/drivers/mfd/ezx-pcap.c
@@ -378,7 +378,8 @@ static int __devexit ezx_pcap_remove(struct spi_device *spi)
 	return 0;
 }
 
-static int __devinit ezx_pcap_probe(struct spi_device *spi)
+static int __devinit ezx_pcap_probe(struct spi_device *spi,
+				    const struct spi_device_id *id)
 {
 	struct pcap_platform_data *pdata = spi->dev.platform_data;
 	struct pcap_chip *pcap;
diff --git a/drivers/misc/eeprom/at25.c b/drivers/misc/eeprom/at25.c
index d564de0..39a36f3 100644
--- a/drivers/misc/eeprom/at25.c
+++ b/drivers/misc/eeprom/at25.c
@@ -287,7 +287,7 @@ static ssize_t at25_mem_write(struct memory_accessor *mem, const char *buf,
 
 /*-------------------------------------------------------------------------*/
 
-static int at25_probe(struct spi_device *spi)
+static int at25_probe(struct spi_device *spi, const struct spi_device_id *id)
 {
 	struct at25_data	*at25 = NULL;
 	const struct spi_eeprom *chip;
diff --git a/drivers/mmc/host/mmc_spi.c b/drivers/mmc/host/mmc_spi.c
index d55fe4f..0ebc11c 100644
--- a/drivers/mmc/host/mmc_spi.c
+++ b/drivers/mmc/host/mmc_spi.c
@@ -1306,7 +1306,8 @@ static int maybe_count_child(struct device *dev, void *c)
 	return 0;
 }
 
-static int mmc_spi_probe(struct spi_device *spi)
+static int mmc_spi_probe(struct spi_device *spi,
+			 const struct spi_device_id *id)
 {
 	void			*ones;
 	struct mmc_host		*mmc;
diff --git a/drivers/mtd/devices/m25p80.c b/drivers/mtd/devices/m25p80.c
index 7c3efff..74181c7 100644
--- a/drivers/mtd/devices/m25p80.c
+++ b/drivers/mtd/devices/m25p80.c
@@ -782,7 +782,7 @@ static struct spi_driver m25p80_driver = {
 		.owner	= THIS_MODULE,
 	},
 	.id_table	= m25p_ids,
-	.probe_id	= m25p_probe,
+	.probe		= m25p_probe,
 	.remove	= __devexit_p(m25p_remove),
 
 	/* REVISIT: many of these chips have deep power-down modes, which
diff --git a/drivers/mtd/devices/mtd_dataflash.c b/drivers/mtd/devices/mtd_dataflash.c
index 211c27a..6b242a0 100644
--- a/drivers/mtd/devices/mtd_dataflash.c
+++ b/drivers/mtd/devices/mtd_dataflash.c
@@ -847,7 +847,8 @@ static struct flash_info *__devinit jedec_probe(struct spi_device *spi)
  *   AT45DB0642  64Mbit  (8M)    xx111xxx (0x3c)   8192   1056     11
  *   AT45DB1282  128Mbit (16M)   xx0100xx (0x10)  16384   1056     11
  */
-static int __devinit dataflash_probe(struct spi_device *spi)
+static int __devinit dataflash_probe(struct spi_device *spi,
+				     const struct spi_device_id *id)
 {
 	int status;
 	struct flash_info	*info;
diff --git a/drivers/net/enc28j60.c b/drivers/net/enc28j60.c
index c709571..883d14f 100644
--- a/drivers/net/enc28j60.c
+++ b/drivers/net/enc28j60.c
@@ -1542,7 +1542,8 @@ static const struct net_device_ops enc28j60_netdev_ops = {
 	.ndo_validate_addr	= eth_validate_addr,
 };
 
-static int __devinit enc28j60_probe(struct spi_device *spi)
+static int __devinit enc28j60_probe(struct spi_device *spi,
+				    const struct spi_device_id *id)
 {
 	struct net_device *dev;
 	struct enc28j60_net *priv;
diff --git a/drivers/net/ks8851.c b/drivers/net/ks8851.c
index fe7cf4f..9bbbedd 100644
--- a/drivers/net/ks8851.c
+++ b/drivers/net/ks8851.c
@@ -1176,7 +1176,8 @@ static int ks8851_read_selftest(struct ks8851_net *ks)
 
 /* driver bus management functions */
 
-static int __devinit ks8851_probe(struct spi_device *spi)
+static int __devinit ks8851_probe(struct spi_device *spi,
+				  const struct spi_device_id *id)
 {
 	struct net_device *ndev;
 	struct ks8851_net *ks;
diff --git a/drivers/net/wireless/libertas/if_spi.c b/drivers/net/wireless/libertas/if_spi.c
index ea45765..4961b3a 100644
--- a/drivers/net/wireless/libertas/if_spi.c
+++ b/drivers/net/wireless/libertas/if_spi.c
@@ -1027,7 +1027,8 @@ static int if_spi_calculate_fw_names(u16 card_id,
 	return 0;
 }
 
-static int __devinit if_spi_probe(struct spi_device *spi)
+static int __devinit if_spi_probe(struct spi_device *spi,
+				  const struct spi_device_id *id)
 {
 	struct if_spi_card *card;
 	struct lbs_private *priv = NULL;
diff --git a/drivers/net/wireless/p54/p54spi.c b/drivers/net/wireless/p54/p54spi.c
index 63bcdd1..e7f1ff2 100644
--- a/drivers/net/wireless/p54/p54spi.c
+++ b/drivers/net/wireless/p54/p54spi.c
@@ -627,7 +627,8 @@ static void p54spi_op_stop(struct ieee80211_hw *dev)
 	mutex_unlock(&priv->mutex);
 }
 
-static int __devinit p54spi_probe(struct spi_device *spi)
+static int __devinit p54spi_probe(struct spi_device *spi,
+				  const struct spi_device_id *id)
 {
 	struct p54s_priv *priv = NULL;
 	struct ieee80211_hw *hw;
diff --git a/drivers/net/wireless/wl12xx/main.c b/drivers/net/wireless/wl12xx/main.c
index 6416406..66c3a91 100644
--- a/drivers/net/wireless/wl12xx/main.c
+++ b/drivers/net/wireless/wl12xx/main.c
@@ -1171,7 +1171,8 @@ static int wl12xx_init_ieee80211(struct wl12xx *wl)
 }
 
 #define WL12XX_DEFAULT_CHANNEL 1
-static int __devinit wl12xx_probe(struct spi_device *spi)
+static int __devinit wl12xx_probe(struct spi_device *spi,
+				  const struct spi_device_id *id)
 {
 	struct wl12xx_platform_data *pdata;
 	struct ieee80211_hw *hw;
diff --git a/drivers/rtc/rtc-ds1305.c b/drivers/rtc/rtc-ds1305.c
index 2736b11..4ce04db 100644
--- a/drivers/rtc/rtc-ds1305.c
+++ b/drivers/rtc/rtc-ds1305.c
@@ -614,7 +614,8 @@ static struct bin_attribute nvram = {
  * Interface to SPI stack
  */
 
-static int __devinit ds1305_probe(struct spi_device *spi)
+static int __devinit ds1305_probe(struct spi_device *spi,
+				  const struct spi_device_id *id)
 {
 	struct ds1305			*ds1305;
 	struct rtc_device		*rtc;
diff --git a/drivers/rtc/rtc-ds1390.c b/drivers/rtc/rtc-ds1390.c
index cdb7050..f18df86 100644
--- a/drivers/rtc/rtc-ds1390.c
+++ b/drivers/rtc/rtc-ds1390.c
@@ -120,7 +120,8 @@ static const struct rtc_class_ops ds1390_rtc_ops = {
 	.set_time	= ds1390_set_time,
 };
 
-static int __devinit ds1390_probe(struct spi_device *spi)
+static int __devinit ds1390_probe(struct spi_device *spi,
+				  const struct spi_device_id *id)
 {
 	unsigned char tmp;
 	struct ds1390 *chip;
diff --git a/drivers/rtc/rtc-ds3234.c b/drivers/rtc/rtc-ds3234.c
index a774ca3..b8107eb 100644
--- a/drivers/rtc/rtc-ds3234.c
+++ b/drivers/rtc/rtc-ds3234.c
@@ -105,7 +105,8 @@ static const struct rtc_class_ops ds3234_rtc_ops = {
 	.set_time	= ds3234_set_time,
 };
 
-static int __devinit ds3234_probe(struct spi_device *spi)
+static int __devinit ds3234_probe(struct spi_device *spi,
+				  const struct spi_device_id *id)
 {
 	struct rtc_device *rtc;
 	unsigned char tmp;
diff --git a/drivers/rtc/rtc-m41t94.c b/drivers/rtc/rtc-m41t94.c
index c8c97a4..87d6349 100644
--- a/drivers/rtc/rtc-m41t94.c
+++ b/drivers/rtc/rtc-m41t94.c
@@ -110,7 +110,8 @@ static const struct rtc_class_ops m41t94_rtc_ops = {
 
 static struct spi_driver m41t94_driver;
 
-static int __devinit m41t94_probe(struct spi_device *spi)
+static int __devinit m41t94_probe(struct spi_device *spi,
+				  const struct spi_device_id *id)
 {
 	struct rtc_device *rtc;
 	int res;
diff --git a/drivers/rtc/rtc-max6902.c b/drivers/rtc/rtc-max6902.c
index 657403e..95197f0 100644
--- a/drivers/rtc/rtc-max6902.c
+++ b/drivers/rtc/rtc-max6902.c
@@ -120,7 +120,8 @@ static const struct rtc_class_ops max6902_rtc_ops = {
 	.set_time	= max6902_set_time,
 };
 
-static int __devinit max6902_probe(struct spi_device *spi)
+static int __devinit max6902_probe(struct spi_device *spi,
+				   const struct spi_device_id *id)
 {
 	struct rtc_device *rtc;
 	unsigned char tmp;
diff --git a/drivers/rtc/rtc-r9701.c b/drivers/rtc/rtc-r9701.c
index 9beba49..a337c71 100644
--- a/drivers/rtc/rtc-r9701.c
+++ b/drivers/rtc/rtc-r9701.c
@@ -119,7 +119,8 @@ static const struct rtc_class_ops r9701_rtc_ops = {
 	.set_time	= r9701_set_datetime,
 };
 
-static int __devinit r9701_probe(struct spi_device *spi)
+static int __devinit r9701_probe(struct spi_device *spi,
+				 const struct spi_device_id *id)
 {
 	struct rtc_device *rtc;
 	unsigned char tmp;
diff --git a/drivers/rtc/rtc-rs5c348.c b/drivers/rtc/rtc-rs5c348.c
index 2099037..ffd3fa4 100644
--- a/drivers/rtc/rtc-rs5c348.c
+++ b/drivers/rtc/rtc-rs5c348.c
@@ -147,7 +147,8 @@ static const struct rtc_class_ops rs5c348_rtc_ops = {
 
 static struct spi_driver rs5c348_driver;
 
-static int __devinit rs5c348_probe(struct spi_device *spi)
+static int __devinit rs5c348_probe(struct spi_device *spi,
+				   const struct spi_device_id *id)
 {
 	int ret;
 	struct rtc_device *rtc;
diff --git a/drivers/serial/max3100.c b/drivers/serial/max3100.c
index 05d36e2..4b043f3 100644
--- a/drivers/serial/max3100.c
+++ b/drivers/serial/max3100.c
@@ -741,7 +741,8 @@ static struct uart_driver max3100_uart_driver = {
 };
 static int uart_driver_registered;
 
-static int __devinit max3100_probe(struct spi_device *spi)
+static int __devinit max3100_probe(struct spi_device *spi,
+				   const struct spi_device_id *id)
 {
 	int i, retval;
 	struct plat_max3100 *pdata;
diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c
index a3c9804..f05e272 100644
--- a/drivers/spi/spi.c
+++ b/drivers/spi/spi.c
@@ -137,19 +137,12 @@ struct bus_type spi_bus_type = {
 };
 EXPORT_SYMBOL_GPL(spi_bus_type);
 
-static int spi_drv_probe_id(struct device *dev)
-{
-	const struct spi_driver		*sdrv = to_spi_driver(dev->driver);
-	struct spi_device		*sdev = to_spi_device(dev);
-
-	return sdrv->probe_id(sdev, spi_match_id(sdrv->id_table, sdev));
-}
-
 static int spi_drv_probe(struct device *dev)
 {
 	const struct spi_driver		*sdrv = to_spi_driver(dev->driver);
+	struct spi_device		*sdev = to_spi_device(dev);
 
-	return sdrv->probe(to_spi_device(dev));
+	return sdrv->probe(sdev, spi_match_id(sdrv->id_table, sdev));
 }
 
 static int spi_drv_remove(struct device *dev)
@@ -174,9 +167,7 @@ static void spi_drv_shutdown(struct device *dev)
 int spi_register_driver(struct spi_driver *sdrv)
 {
 	sdrv->driver.bus = &spi_bus_type;
-	if (sdrv->probe_id)
-		sdrv->driver.probe = spi_drv_probe_id;
-	else if (sdrv->probe)
+	if (sdrv->probe)
 		sdrv->driver.probe = spi_drv_probe;
 	if (sdrv->remove)
 		sdrv->driver.remove = spi_drv_remove;
diff --git a/drivers/spi/spidev.c b/drivers/spi/spidev.c
index f921bd1..08b900b 100644
--- a/drivers/spi/spidev.c
+++ b/drivers/spi/spidev.c
@@ -561,7 +561,7 @@ static struct class *spidev_class;
 
 /*-------------------------------------------------------------------------*/
 
-static int spidev_probe(struct spi_device *spi)
+static int spidev_probe(struct spi_device *spi, const struct spi_device_id *id)
 {
 	struct spidev_data	*spidev;
 	int			status;
diff --git a/drivers/spi/tle62x0.c b/drivers/spi/tle62x0.c
index bf9540f..a6a181a 100644
--- a/drivers/spi/tle62x0.c
+++ b/drivers/spi/tle62x0.c
@@ -238,7 +238,8 @@ static int to_gpio_num(struct device_attribute *attr)
 	return -1;
 }
 
-static int __devinit tle62x0_probe(struct spi_device *spi)
+static int __devinit tle62x0_probe(struct spi_device *spi,
+				   const struct spi_device_id *id)
 {
 	struct tle62x0_state *st;
 	struct tle62x0_pdata *pdata;
diff --git a/drivers/staging/stlc45xx/stlc45xx.c b/drivers/staging/stlc45xx/stlc45xx.c
index 38d0b24..22c90fa 100644
--- a/drivers/staging/stlc45xx/stlc45xx.c
+++ b/drivers/staging/stlc45xx/stlc45xx.c
@@ -2387,7 +2387,8 @@ static struct platform_device stlc45xx_device = {
 	},
 };
 
-static int __devinit stlc45xx_probe(struct spi_device *spi)
+static int __devinit stlc45xx_probe(struct spi_device *spi,
+				    const struct spi_device_id *id)
 {
 	struct stlc45xx *stlc;
 	struct ieee80211_hw *hw;
diff --git a/drivers/video/backlight/corgi_lcd.c b/drivers/video/backlight/corgi_lcd.c
index 2211a85..eb5dced 100644
--- a/drivers/video/backlight/corgi_lcd.c
+++ b/drivers/video/backlight/corgi_lcd.c
@@ -530,7 +530,8 @@ err_free_backlight_on:
 	return err;
 }
 
-static int __devinit corgi_lcd_probe(struct spi_device *spi)
+static int __devinit corgi_lcd_probe(struct spi_device *spi,
+				     const struct spi_device_id *id)
 {
 	struct corgi_lcd_platform_data *pdata = spi->dev.platform_data;
 	struct corgi_lcd *lcd;
diff --git a/drivers/video/backlight/ltv350qv.c b/drivers/video/backlight/ltv350qv.c
index 4631ca8..4970c9f 100644
--- a/drivers/video/backlight/ltv350qv.c
+++ b/drivers/video/backlight/ltv350qv.c
@@ -225,7 +225,8 @@ static struct lcd_ops ltv_ops = {
 	.set_power	= ltv350qv_set_power,
 };
 
-static int __devinit ltv350qv_probe(struct spi_device *spi)
+static int __devinit ltv350qv_probe(struct spi_device *spi,
+				    const struct spi_device_id *id)
 {
 	struct ltv350qv *lcd;
 	struct lcd_device *ld;
diff --git a/drivers/video/backlight/tdo24m.c b/drivers/video/backlight/tdo24m.c
index bbfb502..0a2ab3f 100644
--- a/drivers/video/backlight/tdo24m.c
+++ b/drivers/video/backlight/tdo24m.c
@@ -327,7 +327,8 @@ static struct lcd_ops tdo24m_ops = {
 	.set_mode	= tdo24m_set_mode,
 };
 
-static int __devinit tdo24m_probe(struct spi_device *spi)
+static int __devinit tdo24m_probe(struct spi_device *spi,
+				  const struct spi_device_id *id)
 {
 	struct tdo24m *lcd;
 	struct spi_message *m;
diff --git a/drivers/video/backlight/tosa_lcd.c b/drivers/video/backlight/tosa_lcd.c
index 50ec17d..d8d057e 100644
--- a/drivers/video/backlight/tosa_lcd.c
+++ b/drivers/video/backlight/tosa_lcd.c
@@ -168,7 +168,8 @@ static struct lcd_ops tosa_lcd_ops = {
 	.set_mode = tosa_lcd_set_mode,
 };
 
-static int __devinit tosa_lcd_probe(struct spi_device *spi)
+static int __devinit tosa_lcd_probe(struct spi_device *spi,
+				    const struct spi_device_id *id)
 {
 	int ret;
 	struct tosa_lcd_data *data;
diff --git a/drivers/video/backlight/vgg2432a4.c b/drivers/video/backlight/vgg2432a4.c
index b49063c..3e9cb99 100644
--- a/drivers/video/backlight/vgg2432a4.c
+++ b/drivers/video/backlight/vgg2432a4.c
@@ -227,7 +227,8 @@ static struct ili9320_client vgg2432a4_client = {
 
 /* Device probe */
 
-static int __devinit vgg2432a4_probe(struct spi_device *spi)
+static int __devinit vgg2432a4_probe(struct spi_device *spi,
+				     const struct spi_device_id *id)
 {
 	int ret;
 
diff --git a/include/linux/spi/spi.h b/include/linux/spi/spi.h
index c8d92a1..fa4ada9 100644
--- a/include/linux/spi/spi.h
+++ b/include/linux/spi/spi.h
@@ -147,7 +147,6 @@ struct spi_message;
 /**
  * struct spi_driver - Host side "protocol" driver
  * @id_table: List of SPI devices supported by this driver
- * @probe_id: Binds this driver to the spi device via id_table matching.
  * @probe: Binds this driver to the spi device.  Drivers can verify
  *	that the device is actually present, and may need to configure
  *	characteristics (such as bits_per_word) which weren't needed for
@@ -174,9 +173,8 @@ struct spi_message;
  */
 struct spi_driver {
 	const struct spi_device_id *id_table;
-	int			(*probe_id)(struct spi_device *spi,
-					    const struct spi_device_id *id);
-	int			(*probe)(struct spi_device *spi);
+	int			(*probe)(struct spi_device *spi,
+					 const struct spi_device_id *id);
 	int			(*remove)(struct spi_device *spi);
 	void			(*shutdown)(struct spi_device *spi);
 	int			(*suspend)(struct spi_device *spi, pm_message_t mesg);
-- 
1.6.3.3


^ permalink raw reply related	[flat|nested] 68+ messages in thread

* [PATCH 5/7] spi: Merge probe and probe_id callbacks
@ 2009-07-29 17:05   ` Anton Vorontsov
  0 siblings, 0 replies; 68+ messages in thread
From: Anton Vorontsov @ 2009-07-29 17:05 UTC (permalink / raw)
  To: Andrew Morton
  Cc: David Brownell, linux-kernel, lm-sensors, linuxppc-dev,
	linux-mtd, Jean Delvare, David Woodhouse

The probe_id callback was introduced for the transition period
as a "new-style" probe hook. This patch makes probe() look exactly
as probe_id(), converts drivers and removes probe_id().

Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com>
---
 drivers/gpio/max7301.c                 |    3 ++-
 drivers/gpio/mcp23s08.c                |    3 ++-
 drivers/hwmon/adcxx.c                  |   12 ++++++++----
 drivers/hwmon/lis3lv02d_spi.c          |    3 ++-
 drivers/hwmon/lm70.c                   |    6 ++++--
 drivers/hwmon/max1111.c                |    3 ++-
 drivers/input/touchscreen/ad7877.c     |    3 ++-
 drivers/input/touchscreen/ad7879.c     |    3 ++-
 drivers/input/touchscreen/ads7846.c    |    3 ++-
 drivers/leds/leds-dac124s085.c         |    3 ++-
 drivers/mfd/ezx-pcap.c                 |    3 ++-
 drivers/misc/eeprom/at25.c             |    2 +-
 drivers/mmc/host/mmc_spi.c             |    3 ++-
 drivers/mtd/devices/m25p80.c           |    2 +-
 drivers/mtd/devices/mtd_dataflash.c    |    3 ++-
 drivers/net/enc28j60.c                 |    3 ++-
 drivers/net/ks8851.c                   |    3 ++-
 drivers/net/wireless/libertas/if_spi.c |    3 ++-
 drivers/net/wireless/p54/p54spi.c      |    3 ++-
 drivers/net/wireless/wl12xx/main.c     |    3 ++-
 drivers/rtc/rtc-ds1305.c               |    3 ++-
 drivers/rtc/rtc-ds1390.c               |    3 ++-
 drivers/rtc/rtc-ds3234.c               |    3 ++-
 drivers/rtc/rtc-m41t94.c               |    3 ++-
 drivers/rtc/rtc-max6902.c              |    3 ++-
 drivers/rtc/rtc-r9701.c                |    3 ++-
 drivers/rtc/rtc-rs5c348.c              |    3 ++-
 drivers/serial/max3100.c               |    3 ++-
 drivers/spi/spi.c                      |   15 +++------------
 drivers/spi/spidev.c                   |    2 +-
 drivers/spi/tle62x0.c                  |    3 ++-
 drivers/staging/stlc45xx/stlc45xx.c    |    3 ++-
 drivers/video/backlight/corgi_lcd.c    |    3 ++-
 drivers/video/backlight/ltv350qv.c     |    3 ++-
 drivers/video/backlight/tdo24m.c       |    3 ++-
 drivers/video/backlight/tosa_lcd.c     |    3 ++-
 drivers/video/backlight/vgg2432a4.c    |    3 ++-
 include/linux/spi/spi.h                |    6 ++----
 38 files changed, 82 insertions(+), 56 deletions(-)

diff --git a/drivers/gpio/max7301.c b/drivers/gpio/max7301.c
index 480956f..c92cff6 100644
--- a/drivers/gpio/max7301.c
+++ b/drivers/gpio/max7301.c
@@ -210,7 +210,8 @@ static void max7301_set(struct gpio_chip *chip, unsigned offset, int value)
 	mutex_unlock(&ts->lock);
 }
 
-static int __devinit max7301_probe(struct spi_device *spi)
+static int __devinit max7301_probe(struct spi_device *spi,
+				   const struct spi_device_id *id)
 {
 	struct max7301 *ts;
 	struct max7301_platform_data *pdata;
diff --git a/drivers/gpio/mcp23s08.c b/drivers/gpio/mcp23s08.c
index c6c7aa1..2a99eea 100644
--- a/drivers/gpio/mcp23s08.c
+++ b/drivers/gpio/mcp23s08.c
@@ -300,7 +300,8 @@ fail:
 	return status;
 }
 
-static int mcp23s08_probe(struct spi_device *spi)
+static int mcp23s08_probe(struct spi_device *spi,
+			  const struct spi_device_id *id)
 {
 	struct mcp23s08_platform_data	*pdata;
 	unsigned			addr;
diff --git a/drivers/hwmon/adcxx.c b/drivers/hwmon/adcxx.c
index 7a89fba..b01c0d5 100644
--- a/drivers/hwmon/adcxx.c
+++ b/drivers/hwmon/adcxx.c
@@ -204,22 +204,26 @@ out_err:
 	return status;
 }
 
-static int __devinit adcxx1s_probe(struct spi_device *spi)
+static int __devinit adcxx1s_probe(struct spi_device *spi,
+				   const struct spi_device_id *id)
 {
 	return adcxx_probe(spi, 1);
 }
 
-static int __devinit adcxx2s_probe(struct spi_device *spi)
+static int __devinit adcxx2s_probe(struct spi_device *spi,
+				   const struct spi_device_id *id)
 {
 	return adcxx_probe(spi, 2);
 }
 
-static int __devinit adcxx4s_probe(struct spi_device *spi)
+static int __devinit adcxx4s_probe(struct spi_device *spi,
+				   const struct spi_device_id *id)
 {
 	return adcxx_probe(spi, 4);
 }
 
-static int __devinit adcxx8s_probe(struct spi_device *spi)
+static int __devinit adcxx8s_probe(struct spi_device *spi,
+				   const struct spi_device_id *id)
 {
 	return adcxx_probe(spi, 8);
 }
diff --git a/drivers/hwmon/lis3lv02d_spi.c b/drivers/hwmon/lis3lv02d_spi.c
index b7aed07..478b1d4 100644
--- a/drivers/hwmon/lis3lv02d_spi.c
+++ b/drivers/hwmon/lis3lv02d_spi.c
@@ -56,7 +56,8 @@ static int lis3_spi_init(struct lis3lv02d *lis3)
 
 static struct axis_conversion lis3lv02d_axis_normal = { 1, 2, 3 };
 
-static int __devinit lis302dl_spi_probe(struct spi_device *spi)
+static int __devinit lis302dl_spi_probe(struct spi_device *spi,
+					const struct spi_device_id *id)
 {
 	int ret;
 
diff --git a/drivers/hwmon/lm70.c b/drivers/hwmon/lm70.c
index d55cc7c..3953c22 100644
--- a/drivers/hwmon/lm70.c
+++ b/drivers/hwmon/lm70.c
@@ -170,7 +170,8 @@ out_dev_reg_failed:
 	return status;
 }
 
-static int __devinit lm70_probe(struct spi_device *spi)
+static int __devinit lm70_probe(struct spi_device *spi,
+				const struct spi_device_id *id)
 {
 	/* signaling is SPI_MODE_0 on a 3-wire link (shared SI/SO) */
 	if ((spi->mode & (SPI_CPOL | SPI_CPHA)) || !(spi->mode & SPI_3WIRE))
@@ -179,7 +180,8 @@ static int __devinit lm70_probe(struct spi_device *spi)
 	return common_probe(spi, LM70_CHIP_LM70);
 }
 
-static int __devinit tmp121_probe(struct spi_device *spi)
+static int __devinit tmp121_probe(struct spi_device *spi,
+				  const struct spi_device_id *id)
 {
 	/* signaling is SPI_MODE_0 with only MISO connected */
 	if (spi->mode & (SPI_CPOL | SPI_CPHA))
diff --git a/drivers/hwmon/max1111.c b/drivers/hwmon/max1111.c
index 9ac4972..df0ce3b 100644
--- a/drivers/hwmon/max1111.c
+++ b/drivers/hwmon/max1111.c
@@ -154,7 +154,8 @@ static int setup_transfer(struct max1111_data *data)
 	return 0;
 }
 
-static int __devinit max1111_probe(struct spi_device *spi)
+static int __devinit max1111_probe(struct spi_device *spi,
+				   const struct spi_device_id *id)
 {
 	struct max1111_data *data;
 	int err;
diff --git a/drivers/input/touchscreen/ad7877.c b/drivers/input/touchscreen/ad7877.c
index eb83939..8b44d87 100644
--- a/drivers/input/touchscreen/ad7877.c
+++ b/drivers/input/touchscreen/ad7877.c
@@ -646,7 +646,8 @@ static void ad7877_setup_ts_def_msg(struct spi_device *spi, struct ad7877 *ts)
 	}
 }
 
-static int __devinit ad7877_probe(struct spi_device *spi)
+static int __devinit ad7877_probe(struct spi_device *spi,
+				  const struct spi_device_id *id)
 {
 	struct ad7877			*ts;
 	struct input_dev		*input_dev;
diff --git a/drivers/input/touchscreen/ad7879.c b/drivers/input/touchscreen/ad7879.c
index 19b4db7..aee8a94 100644
--- a/drivers/input/touchscreen/ad7879.c
+++ b/drivers/input/touchscreen/ad7879.c
@@ -618,7 +618,8 @@ static void ad7879_setup_ts_def_msg(struct ad7879 *ts)
 	}
 }
 
-static int __devinit ad7879_probe(struct spi_device *spi)
+static int __devinit ad7879_probe(struct spi_device *spi,
+				  const struct spi_device_id *id)
 {
 	struct ad7879 *ts;
 	int error;
diff --git a/drivers/input/touchscreen/ads7846.c b/drivers/input/touchscreen/ads7846.c
index 09c8109..eb12b09 100644
--- a/drivers/input/touchscreen/ads7846.c
+++ b/drivers/input/touchscreen/ads7846.c
@@ -872,7 +872,8 @@ static int __devinit setup_pendown(struct spi_device *spi, struct ads7846 *ts)
 	return 0;
 }
 
-static int __devinit ads7846_probe(struct spi_device *spi)
+static int __devinit ads7846_probe(struct spi_device *spi,
+				   const struct spi_device_id *id)
 {
 	struct ads7846			*ts;
 	struct ads7846_packet		*packet;
diff --git a/drivers/leds/leds-dac124s085.c b/drivers/leds/leds-dac124s085.c
index 2913d76..d6430d9 100644
--- a/drivers/leds/leds-dac124s085.c
+++ b/drivers/leds/leds-dac124s085.c
@@ -64,7 +64,8 @@ static void dac124s085_set_brightness(struct led_classdev *ldev,
 	spin_unlock(&led->lock);
 }
 
-static int dac124s085_probe(struct spi_device *spi)
+static int dac124s085_probe(struct spi_device *spi,
+			    const struct spi_device_id *id)
 {
 	struct dac124s085	*dac;
 	struct dac124s085_led	*led;
diff --git a/drivers/mfd/ezx-pcap.c b/drivers/mfd/ezx-pcap.c
index 1672f30..a658452 100644
--- a/drivers/mfd/ezx-pcap.c
+++ b/drivers/mfd/ezx-pcap.c
@@ -378,7 +378,8 @@ static int __devexit ezx_pcap_remove(struct spi_device *spi)
 	return 0;
 }
 
-static int __devinit ezx_pcap_probe(struct spi_device *spi)
+static int __devinit ezx_pcap_probe(struct spi_device *spi,
+				    const struct spi_device_id *id)
 {
 	struct pcap_platform_data *pdata = spi->dev.platform_data;
 	struct pcap_chip *pcap;
diff --git a/drivers/misc/eeprom/at25.c b/drivers/misc/eeprom/at25.c
index d564de0..39a36f3 100644
--- a/drivers/misc/eeprom/at25.c
+++ b/drivers/misc/eeprom/at25.c
@@ -287,7 +287,7 @@ static ssize_t at25_mem_write(struct memory_accessor *mem, const char *buf,
 
 /*-------------------------------------------------------------------------*/
 
-static int at25_probe(struct spi_device *spi)
+static int at25_probe(struct spi_device *spi, const struct spi_device_id *id)
 {
 	struct at25_data	*at25 = NULL;
 	const struct spi_eeprom *chip;
diff --git a/drivers/mmc/host/mmc_spi.c b/drivers/mmc/host/mmc_spi.c
index d55fe4f..0ebc11c 100644
--- a/drivers/mmc/host/mmc_spi.c
+++ b/drivers/mmc/host/mmc_spi.c
@@ -1306,7 +1306,8 @@ static int maybe_count_child(struct device *dev, void *c)
 	return 0;
 }
 
-static int mmc_spi_probe(struct spi_device *spi)
+static int mmc_spi_probe(struct spi_device *spi,
+			 const struct spi_device_id *id)
 {
 	void			*ones;
 	struct mmc_host		*mmc;
diff --git a/drivers/mtd/devices/m25p80.c b/drivers/mtd/devices/m25p80.c
index 7c3efff..74181c7 100644
--- a/drivers/mtd/devices/m25p80.c
+++ b/drivers/mtd/devices/m25p80.c
@@ -782,7 +782,7 @@ static struct spi_driver m25p80_driver = {
 		.owner	= THIS_MODULE,
 	},
 	.id_table	= m25p_ids,
-	.probe_id	= m25p_probe,
+	.probe		= m25p_probe,
 	.remove	= __devexit_p(m25p_remove),
 
 	/* REVISIT: many of these chips have deep power-down modes, which
diff --git a/drivers/mtd/devices/mtd_dataflash.c b/drivers/mtd/devices/mtd_dataflash.c
index 211c27a..6b242a0 100644
--- a/drivers/mtd/devices/mtd_dataflash.c
+++ b/drivers/mtd/devices/mtd_dataflash.c
@@ -847,7 +847,8 @@ static struct flash_info *__devinit jedec_probe(struct spi_device *spi)
  *   AT45DB0642  64Mbit  (8M)    xx111xxx (0x3c)   8192   1056     11
  *   AT45DB1282  128Mbit (16M)   xx0100xx (0x10)  16384   1056     11
  */
-static int __devinit dataflash_probe(struct spi_device *spi)
+static int __devinit dataflash_probe(struct spi_device *spi,
+				     const struct spi_device_id *id)
 {
 	int status;
 	struct flash_info	*info;
diff --git a/drivers/net/enc28j60.c b/drivers/net/enc28j60.c
index c709571..883d14f 100644
--- a/drivers/net/enc28j60.c
+++ b/drivers/net/enc28j60.c
@@ -1542,7 +1542,8 @@ static const struct net_device_ops enc28j60_netdev_ops = {
 	.ndo_validate_addr	= eth_validate_addr,
 };
 
-static int __devinit enc28j60_probe(struct spi_device *spi)
+static int __devinit enc28j60_probe(struct spi_device *spi,
+				    const struct spi_device_id *id)
 {
 	struct net_device *dev;
 	struct enc28j60_net *priv;
diff --git a/drivers/net/ks8851.c b/drivers/net/ks8851.c
index fe7cf4f..9bbbedd 100644
--- a/drivers/net/ks8851.c
+++ b/drivers/net/ks8851.c
@@ -1176,7 +1176,8 @@ static int ks8851_read_selftest(struct ks8851_net *ks)
 
 /* driver bus management functions */
 
-static int __devinit ks8851_probe(struct spi_device *spi)
+static int __devinit ks8851_probe(struct spi_device *spi,
+				  const struct spi_device_id *id)
 {
 	struct net_device *ndev;
 	struct ks8851_net *ks;
diff --git a/drivers/net/wireless/libertas/if_spi.c b/drivers/net/wireless/libertas/if_spi.c
index ea45765..4961b3a 100644
--- a/drivers/net/wireless/libertas/if_spi.c
+++ b/drivers/net/wireless/libertas/if_spi.c
@@ -1027,7 +1027,8 @@ static int if_spi_calculate_fw_names(u16 card_id,
 	return 0;
 }
 
-static int __devinit if_spi_probe(struct spi_device *spi)
+static int __devinit if_spi_probe(struct spi_device *spi,
+				  const struct spi_device_id *id)
 {
 	struct if_spi_card *card;
 	struct lbs_private *priv = NULL;
diff --git a/drivers/net/wireless/p54/p54spi.c b/drivers/net/wireless/p54/p54spi.c
index 63bcdd1..e7f1ff2 100644
--- a/drivers/net/wireless/p54/p54spi.c
+++ b/drivers/net/wireless/p54/p54spi.c
@@ -627,7 +627,8 @@ static void p54spi_op_stop(struct ieee80211_hw *dev)
 	mutex_unlock(&priv->mutex);
 }
 
-static int __devinit p54spi_probe(struct spi_device *spi)
+static int __devinit p54spi_probe(struct spi_device *spi,
+				  const struct spi_device_id *id)
 {
 	struct p54s_priv *priv = NULL;
 	struct ieee80211_hw *hw;
diff --git a/drivers/net/wireless/wl12xx/main.c b/drivers/net/wireless/wl12xx/main.c
index 6416406..66c3a91 100644
--- a/drivers/net/wireless/wl12xx/main.c
+++ b/drivers/net/wireless/wl12xx/main.c
@@ -1171,7 +1171,8 @@ static int wl12xx_init_ieee80211(struct wl12xx *wl)
 }
 
 #define WL12XX_DEFAULT_CHANNEL 1
-static int __devinit wl12xx_probe(struct spi_device *spi)
+static int __devinit wl12xx_probe(struct spi_device *spi,
+				  const struct spi_device_id *id)
 {
 	struct wl12xx_platform_data *pdata;
 	struct ieee80211_hw *hw;
diff --git a/drivers/rtc/rtc-ds1305.c b/drivers/rtc/rtc-ds1305.c
index 2736b11..4ce04db 100644
--- a/drivers/rtc/rtc-ds1305.c
+++ b/drivers/rtc/rtc-ds1305.c
@@ -614,7 +614,8 @@ static struct bin_attribute nvram = {
  * Interface to SPI stack
  */
 
-static int __devinit ds1305_probe(struct spi_device *spi)
+static int __devinit ds1305_probe(struct spi_device *spi,
+				  const struct spi_device_id *id)
 {
 	struct ds1305			*ds1305;
 	struct rtc_device		*rtc;
diff --git a/drivers/rtc/rtc-ds1390.c b/drivers/rtc/rtc-ds1390.c
index cdb7050..f18df86 100644
--- a/drivers/rtc/rtc-ds1390.c
+++ b/drivers/rtc/rtc-ds1390.c
@@ -120,7 +120,8 @@ static const struct rtc_class_ops ds1390_rtc_ops = {
 	.set_time	= ds1390_set_time,
 };
 
-static int __devinit ds1390_probe(struct spi_device *spi)
+static int __devinit ds1390_probe(struct spi_device *spi,
+				  const struct spi_device_id *id)
 {
 	unsigned char tmp;
 	struct ds1390 *chip;
diff --git a/drivers/rtc/rtc-ds3234.c b/drivers/rtc/rtc-ds3234.c
index a774ca3..b8107eb 100644
--- a/drivers/rtc/rtc-ds3234.c
+++ b/drivers/rtc/rtc-ds3234.c
@@ -105,7 +105,8 @@ static const struct rtc_class_ops ds3234_rtc_ops = {
 	.set_time	= ds3234_set_time,
 };
 
-static int __devinit ds3234_probe(struct spi_device *spi)
+static int __devinit ds3234_probe(struct spi_device *spi,
+				  const struct spi_device_id *id)
 {
 	struct rtc_device *rtc;
 	unsigned char tmp;
diff --git a/drivers/rtc/rtc-m41t94.c b/drivers/rtc/rtc-m41t94.c
index c8c97a4..87d6349 100644
--- a/drivers/rtc/rtc-m41t94.c
+++ b/drivers/rtc/rtc-m41t94.c
@@ -110,7 +110,8 @@ static const struct rtc_class_ops m41t94_rtc_ops = {
 
 static struct spi_driver m41t94_driver;
 
-static int __devinit m41t94_probe(struct spi_device *spi)
+static int __devinit m41t94_probe(struct spi_device *spi,
+				  const struct spi_device_id *id)
 {
 	struct rtc_device *rtc;
 	int res;
diff --git a/drivers/rtc/rtc-max6902.c b/drivers/rtc/rtc-max6902.c
index 657403e..95197f0 100644
--- a/drivers/rtc/rtc-max6902.c
+++ b/drivers/rtc/rtc-max6902.c
@@ -120,7 +120,8 @@ static const struct rtc_class_ops max6902_rtc_ops = {
 	.set_time	= max6902_set_time,
 };
 
-static int __devinit max6902_probe(struct spi_device *spi)
+static int __devinit max6902_probe(struct spi_device *spi,
+				   const struct spi_device_id *id)
 {
 	struct rtc_device *rtc;
 	unsigned char tmp;
diff --git a/drivers/rtc/rtc-r9701.c b/drivers/rtc/rtc-r9701.c
index 9beba49..a337c71 100644
--- a/drivers/rtc/rtc-r9701.c
+++ b/drivers/rtc/rtc-r9701.c
@@ -119,7 +119,8 @@ static const struct rtc_class_ops r9701_rtc_ops = {
 	.set_time	= r9701_set_datetime,
 };
 
-static int __devinit r9701_probe(struct spi_device *spi)
+static int __devinit r9701_probe(struct spi_device *spi,
+				 const struct spi_device_id *id)
 {
 	struct rtc_device *rtc;
 	unsigned char tmp;
diff --git a/drivers/rtc/rtc-rs5c348.c b/drivers/rtc/rtc-rs5c348.c
index 2099037..ffd3fa4 100644
--- a/drivers/rtc/rtc-rs5c348.c
+++ b/drivers/rtc/rtc-rs5c348.c
@@ -147,7 +147,8 @@ static const struct rtc_class_ops rs5c348_rtc_ops = {
 
 static struct spi_driver rs5c348_driver;
 
-static int __devinit rs5c348_probe(struct spi_device *spi)
+static int __devinit rs5c348_probe(struct spi_device *spi,
+				   const struct spi_device_id *id)
 {
 	int ret;
 	struct rtc_device *rtc;
diff --git a/drivers/serial/max3100.c b/drivers/serial/max3100.c
index 05d36e2..4b043f3 100644
--- a/drivers/serial/max3100.c
+++ b/drivers/serial/max3100.c
@@ -741,7 +741,8 @@ static struct uart_driver max3100_uart_driver = {
 };
 static int uart_driver_registered;
 
-static int __devinit max3100_probe(struct spi_device *spi)
+static int __devinit max3100_probe(struct spi_device *spi,
+				   const struct spi_device_id *id)
 {
 	int i, retval;
 	struct plat_max3100 *pdata;
diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c
index a3c9804..f05e272 100644
--- a/drivers/spi/spi.c
+++ b/drivers/spi/spi.c
@@ -137,19 +137,12 @@ struct bus_type spi_bus_type = {
 };
 EXPORT_SYMBOL_GPL(spi_bus_type);
 
-static int spi_drv_probe_id(struct device *dev)
-{
-	const struct spi_driver		*sdrv = to_spi_driver(dev->driver);
-	struct spi_device		*sdev = to_spi_device(dev);
-
-	return sdrv->probe_id(sdev, spi_match_id(sdrv->id_table, sdev));
-}
-
 static int spi_drv_probe(struct device *dev)
 {
 	const struct spi_driver		*sdrv = to_spi_driver(dev->driver);
+	struct spi_device		*sdev = to_spi_device(dev);
 
-	return sdrv->probe(to_spi_device(dev));
+	return sdrv->probe(sdev, spi_match_id(sdrv->id_table, sdev));
 }
 
 static int spi_drv_remove(struct device *dev)
@@ -174,9 +167,7 @@ static void spi_drv_shutdown(struct device *dev)
 int spi_register_driver(struct spi_driver *sdrv)
 {
 	sdrv->driver.bus = &spi_bus_type;
-	if (sdrv->probe_id)
-		sdrv->driver.probe = spi_drv_probe_id;
-	else if (sdrv->probe)
+	if (sdrv->probe)
 		sdrv->driver.probe = spi_drv_probe;
 	if (sdrv->remove)
 		sdrv->driver.remove = spi_drv_remove;
diff --git a/drivers/spi/spidev.c b/drivers/spi/spidev.c
index f921bd1..08b900b 100644
--- a/drivers/spi/spidev.c
+++ b/drivers/spi/spidev.c
@@ -561,7 +561,7 @@ static struct class *spidev_class;
 
 /*-------------------------------------------------------------------------*/
 
-static int spidev_probe(struct spi_device *spi)
+static int spidev_probe(struct spi_device *spi, const struct spi_device_id *id)
 {
 	struct spidev_data	*spidev;
 	int			status;
diff --git a/drivers/spi/tle62x0.c b/drivers/spi/tle62x0.c
index bf9540f..a6a181a 100644
--- a/drivers/spi/tle62x0.c
+++ b/drivers/spi/tle62x0.c
@@ -238,7 +238,8 @@ static int to_gpio_num(struct device_attribute *attr)
 	return -1;
 }
 
-static int __devinit tle62x0_probe(struct spi_device *spi)
+static int __devinit tle62x0_probe(struct spi_device *spi,
+				   const struct spi_device_id *id)
 {
 	struct tle62x0_state *st;
 	struct tle62x0_pdata *pdata;
diff --git a/drivers/staging/stlc45xx/stlc45xx.c b/drivers/staging/stlc45xx/stlc45xx.c
index 38d0b24..22c90fa 100644
--- a/drivers/staging/stlc45xx/stlc45xx.c
+++ b/drivers/staging/stlc45xx/stlc45xx.c
@@ -2387,7 +2387,8 @@ static struct platform_device stlc45xx_device = {
 	},
 };
 
-static int __devinit stlc45xx_probe(struct spi_device *spi)
+static int __devinit stlc45xx_probe(struct spi_device *spi,
+				    const struct spi_device_id *id)
 {
 	struct stlc45xx *stlc;
 	struct ieee80211_hw *hw;
diff --git a/drivers/video/backlight/corgi_lcd.c b/drivers/video/backlight/corgi_lcd.c
index 2211a85..eb5dced 100644
--- a/drivers/video/backlight/corgi_lcd.c
+++ b/drivers/video/backlight/corgi_lcd.c
@@ -530,7 +530,8 @@ err_free_backlight_on:
 	return err;
 }
 
-static int __devinit corgi_lcd_probe(struct spi_device *spi)
+static int __devinit corgi_lcd_probe(struct spi_device *spi,
+				     const struct spi_device_id *id)
 {
 	struct corgi_lcd_platform_data *pdata = spi->dev.platform_data;
 	struct corgi_lcd *lcd;
diff --git a/drivers/video/backlight/ltv350qv.c b/drivers/video/backlight/ltv350qv.c
index 4631ca8..4970c9f 100644
--- a/drivers/video/backlight/ltv350qv.c
+++ b/drivers/video/backlight/ltv350qv.c
@@ -225,7 +225,8 @@ static struct lcd_ops ltv_ops = {
 	.set_power	= ltv350qv_set_power,
 };
 
-static int __devinit ltv350qv_probe(struct spi_device *spi)
+static int __devinit ltv350qv_probe(struct spi_device *spi,
+				    const struct spi_device_id *id)
 {
 	struct ltv350qv *lcd;
 	struct lcd_device *ld;
diff --git a/drivers/video/backlight/tdo24m.c b/drivers/video/backlight/tdo24m.c
index bbfb502..0a2ab3f 100644
--- a/drivers/video/backlight/tdo24m.c
+++ b/drivers/video/backlight/tdo24m.c
@@ -327,7 +327,8 @@ static struct lcd_ops tdo24m_ops = {
 	.set_mode	= tdo24m_set_mode,
 };
 
-static int __devinit tdo24m_probe(struct spi_device *spi)
+static int __devinit tdo24m_probe(struct spi_device *spi,
+				  const struct spi_device_id *id)
 {
 	struct tdo24m *lcd;
 	struct spi_message *m;
diff --git a/drivers/video/backlight/tosa_lcd.c b/drivers/video/backlight/tosa_lcd.c
index 50ec17d..d8d057e 100644
--- a/drivers/video/backlight/tosa_lcd.c
+++ b/drivers/video/backlight/tosa_lcd.c
@@ -168,7 +168,8 @@ static struct lcd_ops tosa_lcd_ops = {
 	.set_mode = tosa_lcd_set_mode,
 };
 
-static int __devinit tosa_lcd_probe(struct spi_device *spi)
+static int __devinit tosa_lcd_probe(struct spi_device *spi,
+				    const struct spi_device_id *id)
 {
 	int ret;
 	struct tosa_lcd_data *data;
diff --git a/drivers/video/backlight/vgg2432a4.c b/drivers/video/backlight/vgg2432a4.c
index b49063c..3e9cb99 100644
--- a/drivers/video/backlight/vgg2432a4.c
+++ b/drivers/video/backlight/vgg2432a4.c
@@ -227,7 +227,8 @@ static struct ili9320_client vgg2432a4_client = {
 
 /* Device probe */
 
-static int __devinit vgg2432a4_probe(struct spi_device *spi)
+static int __devinit vgg2432a4_probe(struct spi_device *spi,
+				     const struct spi_device_id *id)
 {
 	int ret;
 
diff --git a/include/linux/spi/spi.h b/include/linux/spi/spi.h
index c8d92a1..fa4ada9 100644
--- a/include/linux/spi/spi.h
+++ b/include/linux/spi/spi.h
@@ -147,7 +147,6 @@ struct spi_message;
 /**
  * struct spi_driver - Host side "protocol" driver
  * @id_table: List of SPI devices supported by this driver
- * @probe_id: Binds this driver to the spi device via id_table matching.
  * @probe: Binds this driver to the spi device.  Drivers can verify
  *	that the device is actually present, and may need to configure
  *	characteristics (such as bits_per_word) which weren't needed for
@@ -174,9 +173,8 @@ struct spi_message;
  */
 struct spi_driver {
 	const struct spi_device_id *id_table;
-	int			(*probe_id)(struct spi_device *spi,
-					    const struct spi_device_id *id);
-	int			(*probe)(struct spi_device *spi);
+	int			(*probe)(struct spi_device *spi,
+					 const struct spi_device_id *id);
 	int			(*remove)(struct spi_device *spi);
 	void			(*shutdown)(struct spi_device *spi);
 	int			(*suspend)(struct spi_device *spi, pm_message_t mesg);
-- 
1.6.3.3

^ permalink raw reply related	[flat|nested] 68+ messages in thread

* [PATCH 5/7] spi: Merge probe and probe_id callbacks
@ 2009-07-29 17:05   ` Anton Vorontsov
  0 siblings, 0 replies; 68+ messages in thread
From: Anton Vorontsov @ 2009-07-29 17:05 UTC (permalink / raw)
  To: Andrew Morton
  Cc: David Brownell, linux-kernel, lm-sensors, Grant Likely,
	linuxppc-dev, linux-mtd, Jean Delvare, David Woodhouse

The probe_id callback was introduced for the transition period
as a "new-style" probe hook. This patch makes probe() look exactly
as probe_id(), converts drivers and removes probe_id().

Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com>
---
 drivers/gpio/max7301.c                 |    3 ++-
 drivers/gpio/mcp23s08.c                |    3 ++-
 drivers/hwmon/adcxx.c                  |   12 ++++++++----
 drivers/hwmon/lis3lv02d_spi.c          |    3 ++-
 drivers/hwmon/lm70.c                   |    6 ++++--
 drivers/hwmon/max1111.c                |    3 ++-
 drivers/input/touchscreen/ad7877.c     |    3 ++-
 drivers/input/touchscreen/ad7879.c     |    3 ++-
 drivers/input/touchscreen/ads7846.c    |    3 ++-
 drivers/leds/leds-dac124s085.c         |    3 ++-
 drivers/mfd/ezx-pcap.c                 |    3 ++-
 drivers/misc/eeprom/at25.c             |    2 +-
 drivers/mmc/host/mmc_spi.c             |    3 ++-
 drivers/mtd/devices/m25p80.c           |    2 +-
 drivers/mtd/devices/mtd_dataflash.c    |    3 ++-
 drivers/net/enc28j60.c                 |    3 ++-
 drivers/net/ks8851.c                   |    3 ++-
 drivers/net/wireless/libertas/if_spi.c |    3 ++-
 drivers/net/wireless/p54/p54spi.c      |    3 ++-
 drivers/net/wireless/wl12xx/main.c     |    3 ++-
 drivers/rtc/rtc-ds1305.c               |    3 ++-
 drivers/rtc/rtc-ds1390.c               |    3 ++-
 drivers/rtc/rtc-ds3234.c               |    3 ++-
 drivers/rtc/rtc-m41t94.c               |    3 ++-
 drivers/rtc/rtc-max6902.c              |    3 ++-
 drivers/rtc/rtc-r9701.c                |    3 ++-
 drivers/rtc/rtc-rs5c348.c              |    3 ++-
 drivers/serial/max3100.c               |    3 ++-
 drivers/spi/spi.c                      |   15 +++------------
 drivers/spi/spidev.c                   |    2 +-
 drivers/spi/tle62x0.c                  |    3 ++-
 drivers/staging/stlc45xx/stlc45xx.c    |    3 ++-
 drivers/video/backlight/corgi_lcd.c    |    3 ++-
 drivers/video/backlight/ltv350qv.c     |    3 ++-
 drivers/video/backlight/tdo24m.c       |    3 ++-
 drivers/video/backlight/tosa_lcd.c     |    3 ++-
 drivers/video/backlight/vgg2432a4.c    |    3 ++-
 include/linux/spi/spi.h                |    6 ++----
 38 files changed, 82 insertions(+), 56 deletions(-)

diff --git a/drivers/gpio/max7301.c b/drivers/gpio/max7301.c
index 480956f..c92cff6 100644
--- a/drivers/gpio/max7301.c
+++ b/drivers/gpio/max7301.c
@@ -210,7 +210,8 @@ static void max7301_set(struct gpio_chip *chip, unsigned offset, int value)
 	mutex_unlock(&ts->lock);
 }
 
-static int __devinit max7301_probe(struct spi_device *spi)
+static int __devinit max7301_probe(struct spi_device *spi,
+				   const struct spi_device_id *id)
 {
 	struct max7301 *ts;
 	struct max7301_platform_data *pdata;
diff --git a/drivers/gpio/mcp23s08.c b/drivers/gpio/mcp23s08.c
index c6c7aa1..2a99eea 100644
--- a/drivers/gpio/mcp23s08.c
+++ b/drivers/gpio/mcp23s08.c
@@ -300,7 +300,8 @@ fail:
 	return status;
 }
 
-static int mcp23s08_probe(struct spi_device *spi)
+static int mcp23s08_probe(struct spi_device *spi,
+			  const struct spi_device_id *id)
 {
 	struct mcp23s08_platform_data	*pdata;
 	unsigned			addr;
diff --git a/drivers/hwmon/adcxx.c b/drivers/hwmon/adcxx.c
index 7a89fba..b01c0d5 100644
--- a/drivers/hwmon/adcxx.c
+++ b/drivers/hwmon/adcxx.c
@@ -204,22 +204,26 @@ out_err:
 	return status;
 }
 
-static int __devinit adcxx1s_probe(struct spi_device *spi)
+static int __devinit adcxx1s_probe(struct spi_device *spi,
+				   const struct spi_device_id *id)
 {
 	return adcxx_probe(spi, 1);
 }
 
-static int __devinit adcxx2s_probe(struct spi_device *spi)
+static int __devinit adcxx2s_probe(struct spi_device *spi,
+				   const struct spi_device_id *id)
 {
 	return adcxx_probe(spi, 2);
 }
 
-static int __devinit adcxx4s_probe(struct spi_device *spi)
+static int __devinit adcxx4s_probe(struct spi_device *spi,
+				   const struct spi_device_id *id)
 {
 	return adcxx_probe(spi, 4);
 }
 
-static int __devinit adcxx8s_probe(struct spi_device *spi)
+static int __devinit adcxx8s_probe(struct spi_device *spi,
+				   const struct spi_device_id *id)
 {
 	return adcxx_probe(spi, 8);
 }
diff --git a/drivers/hwmon/lis3lv02d_spi.c b/drivers/hwmon/lis3lv02d_spi.c
index b7aed07..478b1d4 100644
--- a/drivers/hwmon/lis3lv02d_spi.c
+++ b/drivers/hwmon/lis3lv02d_spi.c
@@ -56,7 +56,8 @@ static int lis3_spi_init(struct lis3lv02d *lis3)
 
 static struct axis_conversion lis3lv02d_axis_normal = { 1, 2, 3 };
 
-static int __devinit lis302dl_spi_probe(struct spi_device *spi)
+static int __devinit lis302dl_spi_probe(struct spi_device *spi,
+					const struct spi_device_id *id)
 {
 	int ret;
 
diff --git a/drivers/hwmon/lm70.c b/drivers/hwmon/lm70.c
index d55cc7c..3953c22 100644
--- a/drivers/hwmon/lm70.c
+++ b/drivers/hwmon/lm70.c
@@ -170,7 +170,8 @@ out_dev_reg_failed:
 	return status;
 }
 
-static int __devinit lm70_probe(struct spi_device *spi)
+static int __devinit lm70_probe(struct spi_device *spi,
+				const struct spi_device_id *id)
 {
 	/* signaling is SPI_MODE_0 on a 3-wire link (shared SI/SO) */
 	if ((spi->mode & (SPI_CPOL | SPI_CPHA)) || !(spi->mode & SPI_3WIRE))
@@ -179,7 +180,8 @@ static int __devinit lm70_probe(struct spi_device *spi)
 	return common_probe(spi, LM70_CHIP_LM70);
 }
 
-static int __devinit tmp121_probe(struct spi_device *spi)
+static int __devinit tmp121_probe(struct spi_device *spi,
+				  const struct spi_device_id *id)
 {
 	/* signaling is SPI_MODE_0 with only MISO connected */
 	if (spi->mode & (SPI_CPOL | SPI_CPHA))
diff --git a/drivers/hwmon/max1111.c b/drivers/hwmon/max1111.c
index 9ac4972..df0ce3b 100644
--- a/drivers/hwmon/max1111.c
+++ b/drivers/hwmon/max1111.c
@@ -154,7 +154,8 @@ static int setup_transfer(struct max1111_data *data)
 	return 0;
 }
 
-static int __devinit max1111_probe(struct spi_device *spi)
+static int __devinit max1111_probe(struct spi_device *spi,
+				   const struct spi_device_id *id)
 {
 	struct max1111_data *data;
 	int err;
diff --git a/drivers/input/touchscreen/ad7877.c b/drivers/input/touchscreen/ad7877.c
index eb83939..8b44d87 100644
--- a/drivers/input/touchscreen/ad7877.c
+++ b/drivers/input/touchscreen/ad7877.c
@@ -646,7 +646,8 @@ static void ad7877_setup_ts_def_msg(struct spi_device *spi, struct ad7877 *ts)
 	}
 }
 
-static int __devinit ad7877_probe(struct spi_device *spi)
+static int __devinit ad7877_probe(struct spi_device *spi,
+				  const struct spi_device_id *id)
 {
 	struct ad7877			*ts;
 	struct input_dev		*input_dev;
diff --git a/drivers/input/touchscreen/ad7879.c b/drivers/input/touchscreen/ad7879.c
index 19b4db7..aee8a94 100644
--- a/drivers/input/touchscreen/ad7879.c
+++ b/drivers/input/touchscreen/ad7879.c
@@ -618,7 +618,8 @@ static void ad7879_setup_ts_def_msg(struct ad7879 *ts)
 	}
 }
 
-static int __devinit ad7879_probe(struct spi_device *spi)
+static int __devinit ad7879_probe(struct spi_device *spi,
+				  const struct spi_device_id *id)
 {
 	struct ad7879 *ts;
 	int error;
diff --git a/drivers/input/touchscreen/ads7846.c b/drivers/input/touchscreen/ads7846.c
index 09c8109..eb12b09 100644
--- a/drivers/input/touchscreen/ads7846.c
+++ b/drivers/input/touchscreen/ads7846.c
@@ -872,7 +872,8 @@ static int __devinit setup_pendown(struct spi_device *spi, struct ads7846 *ts)
 	return 0;
 }
 
-static int __devinit ads7846_probe(struct spi_device *spi)
+static int __devinit ads7846_probe(struct spi_device *spi,
+				   const struct spi_device_id *id)
 {
 	struct ads7846			*ts;
 	struct ads7846_packet		*packet;
diff --git a/drivers/leds/leds-dac124s085.c b/drivers/leds/leds-dac124s085.c
index 2913d76..d6430d9 100644
--- a/drivers/leds/leds-dac124s085.c
+++ b/drivers/leds/leds-dac124s085.c
@@ -64,7 +64,8 @@ static void dac124s085_set_brightness(struct led_classdev *ldev,
 	spin_unlock(&led->lock);
 }
 
-static int dac124s085_probe(struct spi_device *spi)
+static int dac124s085_probe(struct spi_device *spi,
+			    const struct spi_device_id *id)
 {
 	struct dac124s085	*dac;
 	struct dac124s085_led	*led;
diff --git a/drivers/mfd/ezx-pcap.c b/drivers/mfd/ezx-pcap.c
index 1672f30..a658452 100644
--- a/drivers/mfd/ezx-pcap.c
+++ b/drivers/mfd/ezx-pcap.c
@@ -378,7 +378,8 @@ static int __devexit ezx_pcap_remove(struct spi_device *spi)
 	return 0;
 }
 
-static int __devinit ezx_pcap_probe(struct spi_device *spi)
+static int __devinit ezx_pcap_probe(struct spi_device *spi,
+				    const struct spi_device_id *id)
 {
 	struct pcap_platform_data *pdata = spi->dev.platform_data;
 	struct pcap_chip *pcap;
diff --git a/drivers/misc/eeprom/at25.c b/drivers/misc/eeprom/at25.c
index d564de0..39a36f3 100644
--- a/drivers/misc/eeprom/at25.c
+++ b/drivers/misc/eeprom/at25.c
@@ -287,7 +287,7 @@ static ssize_t at25_mem_write(struct memory_accessor *mem, const char *buf,
 
 /*-------------------------------------------------------------------------*/
 
-static int at25_probe(struct spi_device *spi)
+static int at25_probe(struct spi_device *spi, const struct spi_device_id *id)
 {
 	struct at25_data	*at25 = NULL;
 	const struct spi_eeprom *chip;
diff --git a/drivers/mmc/host/mmc_spi.c b/drivers/mmc/host/mmc_spi.c
index d55fe4f..0ebc11c 100644
--- a/drivers/mmc/host/mmc_spi.c
+++ b/drivers/mmc/host/mmc_spi.c
@@ -1306,7 +1306,8 @@ static int maybe_count_child(struct device *dev, void *c)
 	return 0;
 }
 
-static int mmc_spi_probe(struct spi_device *spi)
+static int mmc_spi_probe(struct spi_device *spi,
+			 const struct spi_device_id *id)
 {
 	void			*ones;
 	struct mmc_host		*mmc;
diff --git a/drivers/mtd/devices/m25p80.c b/drivers/mtd/devices/m25p80.c
index 7c3efff..74181c7 100644
--- a/drivers/mtd/devices/m25p80.c
+++ b/drivers/mtd/devices/m25p80.c
@@ -782,7 +782,7 @@ static struct spi_driver m25p80_driver = {
 		.owner	= THIS_MODULE,
 	},
 	.id_table	= m25p_ids,
-	.probe_id	= m25p_probe,
+	.probe		= m25p_probe,
 	.remove	= __devexit_p(m25p_remove),
 
 	/* REVISIT: many of these chips have deep power-down modes, which
diff --git a/drivers/mtd/devices/mtd_dataflash.c b/drivers/mtd/devices/mtd_dataflash.c
index 211c27a..6b242a0 100644
--- a/drivers/mtd/devices/mtd_dataflash.c
+++ b/drivers/mtd/devices/mtd_dataflash.c
@@ -847,7 +847,8 @@ static struct flash_info *__devinit jedec_probe(struct spi_device *spi)
  *   AT45DB0642  64Mbit  (8M)    xx111xxx (0x3c)   8192   1056     11
  *   AT45DB1282  128Mbit (16M)   xx0100xx (0x10)  16384   1056     11
  */
-static int __devinit dataflash_probe(struct spi_device *spi)
+static int __devinit dataflash_probe(struct spi_device *spi,
+				     const struct spi_device_id *id)
 {
 	int status;
 	struct flash_info	*info;
diff --git a/drivers/net/enc28j60.c b/drivers/net/enc28j60.c
index c709571..883d14f 100644
--- a/drivers/net/enc28j60.c
+++ b/drivers/net/enc28j60.c
@@ -1542,7 +1542,8 @@ static const struct net_device_ops enc28j60_netdev_ops = {
 	.ndo_validate_addr	= eth_validate_addr,
 };
 
-static int __devinit enc28j60_probe(struct spi_device *spi)
+static int __devinit enc28j60_probe(struct spi_device *spi,
+				    const struct spi_device_id *id)
 {
 	struct net_device *dev;
 	struct enc28j60_net *priv;
diff --git a/drivers/net/ks8851.c b/drivers/net/ks8851.c
index fe7cf4f..9bbbedd 100644
--- a/drivers/net/ks8851.c
+++ b/drivers/net/ks8851.c
@@ -1176,7 +1176,8 @@ static int ks8851_read_selftest(struct ks8851_net *ks)
 
 /* driver bus management functions */
 
-static int __devinit ks8851_probe(struct spi_device *spi)
+static int __devinit ks8851_probe(struct spi_device *spi,
+				  const struct spi_device_id *id)
 {
 	struct net_device *ndev;
 	struct ks8851_net *ks;
diff --git a/drivers/net/wireless/libertas/if_spi.c b/drivers/net/wireless/libertas/if_spi.c
index ea45765..4961b3a 100644
--- a/drivers/net/wireless/libertas/if_spi.c
+++ b/drivers/net/wireless/libertas/if_spi.c
@@ -1027,7 +1027,8 @@ static int if_spi_calculate_fw_names(u16 card_id,
 	return 0;
 }
 
-static int __devinit if_spi_probe(struct spi_device *spi)
+static int __devinit if_spi_probe(struct spi_device *spi,
+				  const struct spi_device_id *id)
 {
 	struct if_spi_card *card;
 	struct lbs_private *priv = NULL;
diff --git a/drivers/net/wireless/p54/p54spi.c b/drivers/net/wireless/p54/p54spi.c
index 63bcdd1..e7f1ff2 100644
--- a/drivers/net/wireless/p54/p54spi.c
+++ b/drivers/net/wireless/p54/p54spi.c
@@ -627,7 +627,8 @@ static void p54spi_op_stop(struct ieee80211_hw *dev)
 	mutex_unlock(&priv->mutex);
 }
 
-static int __devinit p54spi_probe(struct spi_device *spi)
+static int __devinit p54spi_probe(struct spi_device *spi,
+				  const struct spi_device_id *id)
 {
 	struct p54s_priv *priv = NULL;
 	struct ieee80211_hw *hw;
diff --git a/drivers/net/wireless/wl12xx/main.c b/drivers/net/wireless/wl12xx/main.c
index 6416406..66c3a91 100644
--- a/drivers/net/wireless/wl12xx/main.c
+++ b/drivers/net/wireless/wl12xx/main.c
@@ -1171,7 +1171,8 @@ static int wl12xx_init_ieee80211(struct wl12xx *wl)
 }
 
 #define WL12XX_DEFAULT_CHANNEL 1
-static int __devinit wl12xx_probe(struct spi_device *spi)
+static int __devinit wl12xx_probe(struct spi_device *spi,
+				  const struct spi_device_id *id)
 {
 	struct wl12xx_platform_data *pdata;
 	struct ieee80211_hw *hw;
diff --git a/drivers/rtc/rtc-ds1305.c b/drivers/rtc/rtc-ds1305.c
index 2736b11..4ce04db 100644
--- a/drivers/rtc/rtc-ds1305.c
+++ b/drivers/rtc/rtc-ds1305.c
@@ -614,7 +614,8 @@ static struct bin_attribute nvram = {
  * Interface to SPI stack
  */
 
-static int __devinit ds1305_probe(struct spi_device *spi)
+static int __devinit ds1305_probe(struct spi_device *spi,
+				  const struct spi_device_id *id)
 {
 	struct ds1305			*ds1305;
 	struct rtc_device		*rtc;
diff --git a/drivers/rtc/rtc-ds1390.c b/drivers/rtc/rtc-ds1390.c
index cdb7050..f18df86 100644
--- a/drivers/rtc/rtc-ds1390.c
+++ b/drivers/rtc/rtc-ds1390.c
@@ -120,7 +120,8 @@ static const struct rtc_class_ops ds1390_rtc_ops = {
 	.set_time	= ds1390_set_time,
 };
 
-static int __devinit ds1390_probe(struct spi_device *spi)
+static int __devinit ds1390_probe(struct spi_device *spi,
+				  const struct spi_device_id *id)
 {
 	unsigned char tmp;
 	struct ds1390 *chip;
diff --git a/drivers/rtc/rtc-ds3234.c b/drivers/rtc/rtc-ds3234.c
index a774ca3..b8107eb 100644
--- a/drivers/rtc/rtc-ds3234.c
+++ b/drivers/rtc/rtc-ds3234.c
@@ -105,7 +105,8 @@ static const struct rtc_class_ops ds3234_rtc_ops = {
 	.set_time	= ds3234_set_time,
 };
 
-static int __devinit ds3234_probe(struct spi_device *spi)
+static int __devinit ds3234_probe(struct spi_device *spi,
+				  const struct spi_device_id *id)
 {
 	struct rtc_device *rtc;
 	unsigned char tmp;
diff --git a/drivers/rtc/rtc-m41t94.c b/drivers/rtc/rtc-m41t94.c
index c8c97a4..87d6349 100644
--- a/drivers/rtc/rtc-m41t94.c
+++ b/drivers/rtc/rtc-m41t94.c
@@ -110,7 +110,8 @@ static const struct rtc_class_ops m41t94_rtc_ops = {
 
 static struct spi_driver m41t94_driver;
 
-static int __devinit m41t94_probe(struct spi_device *spi)
+static int __devinit m41t94_probe(struct spi_device *spi,
+				  const struct spi_device_id *id)
 {
 	struct rtc_device *rtc;
 	int res;
diff --git a/drivers/rtc/rtc-max6902.c b/drivers/rtc/rtc-max6902.c
index 657403e..95197f0 100644
--- a/drivers/rtc/rtc-max6902.c
+++ b/drivers/rtc/rtc-max6902.c
@@ -120,7 +120,8 @@ static const struct rtc_class_ops max6902_rtc_ops = {
 	.set_time	= max6902_set_time,
 };
 
-static int __devinit max6902_probe(struct spi_device *spi)
+static int __devinit max6902_probe(struct spi_device *spi,
+				   const struct spi_device_id *id)
 {
 	struct rtc_device *rtc;
 	unsigned char tmp;
diff --git a/drivers/rtc/rtc-r9701.c b/drivers/rtc/rtc-r9701.c
index 9beba49..a337c71 100644
--- a/drivers/rtc/rtc-r9701.c
+++ b/drivers/rtc/rtc-r9701.c
@@ -119,7 +119,8 @@ static const struct rtc_class_ops r9701_rtc_ops = {
 	.set_time	= r9701_set_datetime,
 };
 
-static int __devinit r9701_probe(struct spi_device *spi)
+static int __devinit r9701_probe(struct spi_device *spi,
+				 const struct spi_device_id *id)
 {
 	struct rtc_device *rtc;
 	unsigned char tmp;
diff --git a/drivers/rtc/rtc-rs5c348.c b/drivers/rtc/rtc-rs5c348.c
index 2099037..ffd3fa4 100644
--- a/drivers/rtc/rtc-rs5c348.c
+++ b/drivers/rtc/rtc-rs5c348.c
@@ -147,7 +147,8 @@ static const struct rtc_class_ops rs5c348_rtc_ops = {
 
 static struct spi_driver rs5c348_driver;
 
-static int __devinit rs5c348_probe(struct spi_device *spi)
+static int __devinit rs5c348_probe(struct spi_device *spi,
+				   const struct spi_device_id *id)
 {
 	int ret;
 	struct rtc_device *rtc;
diff --git a/drivers/serial/max3100.c b/drivers/serial/max3100.c
index 05d36e2..4b043f3 100644
--- a/drivers/serial/max3100.c
+++ b/drivers/serial/max3100.c
@@ -741,7 +741,8 @@ static struct uart_driver max3100_uart_driver = {
 };
 static int uart_driver_registered;
 
-static int __devinit max3100_probe(struct spi_device *spi)
+static int __devinit max3100_probe(struct spi_device *spi,
+				   const struct spi_device_id *id)
 {
 	int i, retval;
 	struct plat_max3100 *pdata;
diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c
index a3c9804..f05e272 100644
--- a/drivers/spi/spi.c
+++ b/drivers/spi/spi.c
@@ -137,19 +137,12 @@ struct bus_type spi_bus_type = {
 };
 EXPORT_SYMBOL_GPL(spi_bus_type);
 
-static int spi_drv_probe_id(struct device *dev)
-{
-	const struct spi_driver		*sdrv = to_spi_driver(dev->driver);
-	struct spi_device		*sdev = to_spi_device(dev);
-
-	return sdrv->probe_id(sdev, spi_match_id(sdrv->id_table, sdev));
-}
-
 static int spi_drv_probe(struct device *dev)
 {
 	const struct spi_driver		*sdrv = to_spi_driver(dev->driver);
+	struct spi_device		*sdev = to_spi_device(dev);
 
-	return sdrv->probe(to_spi_device(dev));
+	return sdrv->probe(sdev, spi_match_id(sdrv->id_table, sdev));
 }
 
 static int spi_drv_remove(struct device *dev)
@@ -174,9 +167,7 @@ static void spi_drv_shutdown(struct device *dev)
 int spi_register_driver(struct spi_driver *sdrv)
 {
 	sdrv->driver.bus = &spi_bus_type;
-	if (sdrv->probe_id)
-		sdrv->driver.probe = spi_drv_probe_id;
-	else if (sdrv->probe)
+	if (sdrv->probe)
 		sdrv->driver.probe = spi_drv_probe;
 	if (sdrv->remove)
 		sdrv->driver.remove = spi_drv_remove;
diff --git a/drivers/spi/spidev.c b/drivers/spi/spidev.c
index f921bd1..08b900b 100644
--- a/drivers/spi/spidev.c
+++ b/drivers/spi/spidev.c
@@ -561,7 +561,7 @@ static struct class *spidev_class;
 
 /*-------------------------------------------------------------------------*/
 
-static int spidev_probe(struct spi_device *spi)
+static int spidev_probe(struct spi_device *spi, const struct spi_device_id *id)
 {
 	struct spidev_data	*spidev;
 	int			status;
diff --git a/drivers/spi/tle62x0.c b/drivers/spi/tle62x0.c
index bf9540f..a6a181a 100644
--- a/drivers/spi/tle62x0.c
+++ b/drivers/spi/tle62x0.c
@@ -238,7 +238,8 @@ static int to_gpio_num(struct device_attribute *attr)
 	return -1;
 }
 
-static int __devinit tle62x0_probe(struct spi_device *spi)
+static int __devinit tle62x0_probe(struct spi_device *spi,
+				   const struct spi_device_id *id)
 {
 	struct tle62x0_state *st;
 	struct tle62x0_pdata *pdata;
diff --git a/drivers/staging/stlc45xx/stlc45xx.c b/drivers/staging/stlc45xx/stlc45xx.c
index 38d0b24..22c90fa 100644
--- a/drivers/staging/stlc45xx/stlc45xx.c
+++ b/drivers/staging/stlc45xx/stlc45xx.c
@@ -2387,7 +2387,8 @@ static struct platform_device stlc45xx_device = {
 	},
 };
 
-static int __devinit stlc45xx_probe(struct spi_device *spi)
+static int __devinit stlc45xx_probe(struct spi_device *spi,
+				    const struct spi_device_id *id)
 {
 	struct stlc45xx *stlc;
 	struct ieee80211_hw *hw;
diff --git a/drivers/video/backlight/corgi_lcd.c b/drivers/video/backlight/corgi_lcd.c
index 2211a85..eb5dced 100644
--- a/drivers/video/backlight/corgi_lcd.c
+++ b/drivers/video/backlight/corgi_lcd.c
@@ -530,7 +530,8 @@ err_free_backlight_on:
 	return err;
 }
 
-static int __devinit corgi_lcd_probe(struct spi_device *spi)
+static int __devinit corgi_lcd_probe(struct spi_device *spi,
+				     const struct spi_device_id *id)
 {
 	struct corgi_lcd_platform_data *pdata = spi->dev.platform_data;
 	struct corgi_lcd *lcd;
diff --git a/drivers/video/backlight/ltv350qv.c b/drivers/video/backlight/ltv350qv.c
index 4631ca8..4970c9f 100644
--- a/drivers/video/backlight/ltv350qv.c
+++ b/drivers/video/backlight/ltv350qv.c
@@ -225,7 +225,8 @@ static struct lcd_ops ltv_ops = {
 	.set_power	= ltv350qv_set_power,
 };
 
-static int __devinit ltv350qv_probe(struct spi_device *spi)
+static int __devinit ltv350qv_probe(struct spi_device *spi,
+				    const struct spi_device_id *id)
 {
 	struct ltv350qv *lcd;
 	struct lcd_device *ld;
diff --git a/drivers/video/backlight/tdo24m.c b/drivers/video/backlight/tdo24m.c
index bbfb502..0a2ab3f 100644
--- a/drivers/video/backlight/tdo24m.c
+++ b/drivers/video/backlight/tdo24m.c
@@ -327,7 +327,8 @@ static struct lcd_ops tdo24m_ops = {
 	.set_mode	= tdo24m_set_mode,
 };
 
-static int __devinit tdo24m_probe(struct spi_device *spi)
+static int __devinit tdo24m_probe(struct spi_device *spi,
+				  const struct spi_device_id *id)
 {
 	struct tdo24m *lcd;
 	struct spi_message *m;
diff --git a/drivers/video/backlight/tosa_lcd.c b/drivers/video/backlight/tosa_lcd.c
index 50ec17d..d8d057e 100644
--- a/drivers/video/backlight/tosa_lcd.c
+++ b/drivers/video/backlight/tosa_lcd.c
@@ -168,7 +168,8 @@ static struct lcd_ops tosa_lcd_ops = {
 	.set_mode = tosa_lcd_set_mode,
 };
 
-static int __devinit tosa_lcd_probe(struct spi_device *spi)
+static int __devinit tosa_lcd_probe(struct spi_device *spi,
+				    const struct spi_device_id *id)
 {
 	int ret;
 	struct tosa_lcd_data *data;
diff --git a/drivers/video/backlight/vgg2432a4.c b/drivers/video/backlight/vgg2432a4.c
index b49063c..3e9cb99 100644
--- a/drivers/video/backlight/vgg2432a4.c
+++ b/drivers/video/backlight/vgg2432a4.c
@@ -227,7 +227,8 @@ static struct ili9320_client vgg2432a4_client = {
 
 /* Device probe */
 
-static int __devinit vgg2432a4_probe(struct spi_device *spi)
+static int __devinit vgg2432a4_probe(struct spi_device *spi,
+				     const struct spi_device_id *id)
 {
 	int ret;
 
diff --git a/include/linux/spi/spi.h b/include/linux/spi/spi.h
index c8d92a1..fa4ada9 100644
--- a/include/linux/spi/spi.h
+++ b/include/linux/spi/spi.h
@@ -147,7 +147,6 @@ struct spi_message;
 /**
  * struct spi_driver - Host side "protocol" driver
  * @id_table: List of SPI devices supported by this driver
- * @probe_id: Binds this driver to the spi device via id_table matching.
  * @probe: Binds this driver to the spi device.  Drivers can verify
  *	that the device is actually present, and may need to configure
  *	characteristics (such as bits_per_word) which weren't needed for
@@ -174,9 +173,8 @@ struct spi_message;
  */
 struct spi_driver {
 	const struct spi_device_id *id_table;
-	int			(*probe_id)(struct spi_device *spi,
-					    const struct spi_device_id *id);
-	int			(*probe)(struct spi_device *spi);
+	int			(*probe)(struct spi_device *spi,
+					 const struct spi_device_id *id);
 	int			(*remove)(struct spi_device *spi);
 	void			(*shutdown)(struct spi_device *spi);
 	int			(*suspend)(struct spi_device *spi, pm_message_t mesg);
-- 
1.6.3.3

^ permalink raw reply related	[flat|nested] 68+ messages in thread

* [lm-sensors] [PATCH 5/7] spi: Merge probe and probe_id callbacks
@ 2009-07-29 17:05   ` Anton Vorontsov
  0 siblings, 0 replies; 68+ messages in thread
From: Anton Vorontsov @ 2009-07-29 17:05 UTC (permalink / raw)
  To: Andrew Morton
  Cc: David Brownell, David Woodhouse, Grant Likely, Jean Delvare,
	linux-mtd, linux-kernel, lm-sensors, linuxppc-dev

The probe_id callback was introduced for the transition period
as a "new-style" probe hook. This patch makes probe() look exactly
as probe_id(), converts drivers and removes probe_id().

Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com>
---
 drivers/gpio/max7301.c                 |    3 ++-
 drivers/gpio/mcp23s08.c                |    3 ++-
 drivers/hwmon/adcxx.c                  |   12 ++++++++----
 drivers/hwmon/lis3lv02d_spi.c          |    3 ++-
 drivers/hwmon/lm70.c                   |    6 ++++--
 drivers/hwmon/max1111.c                |    3 ++-
 drivers/input/touchscreen/ad7877.c     |    3 ++-
 drivers/input/touchscreen/ad7879.c     |    3 ++-
 drivers/input/touchscreen/ads7846.c    |    3 ++-
 drivers/leds/leds-dac124s085.c         |    3 ++-
 drivers/mfd/ezx-pcap.c                 |    3 ++-
 drivers/misc/eeprom/at25.c             |    2 +-
 drivers/mmc/host/mmc_spi.c             |    3 ++-
 drivers/mtd/devices/m25p80.c           |    2 +-
 drivers/mtd/devices/mtd_dataflash.c    |    3 ++-
 drivers/net/enc28j60.c                 |    3 ++-
 drivers/net/ks8851.c                   |    3 ++-
 drivers/net/wireless/libertas/if_spi.c |    3 ++-
 drivers/net/wireless/p54/p54spi.c      |    3 ++-
 drivers/net/wireless/wl12xx/main.c     |    3 ++-
 drivers/rtc/rtc-ds1305.c               |    3 ++-
 drivers/rtc/rtc-ds1390.c               |    3 ++-
 drivers/rtc/rtc-ds3234.c               |    3 ++-
 drivers/rtc/rtc-m41t94.c               |    3 ++-
 drivers/rtc/rtc-max6902.c              |    3 ++-
 drivers/rtc/rtc-r9701.c                |    3 ++-
 drivers/rtc/rtc-rs5c348.c              |    3 ++-
 drivers/serial/max3100.c               |    3 ++-
 drivers/spi/spi.c                      |   15 +++------------
 drivers/spi/spidev.c                   |    2 +-
 drivers/spi/tle62x0.c                  |    3 ++-
 drivers/staging/stlc45xx/stlc45xx.c    |    3 ++-
 drivers/video/backlight/corgi_lcd.c    |    3 ++-
 drivers/video/backlight/ltv350qv.c     |    3 ++-
 drivers/video/backlight/tdo24m.c       |    3 ++-
 drivers/video/backlight/tosa_lcd.c     |    3 ++-
 drivers/video/backlight/vgg2432a4.c    |    3 ++-
 include/linux/spi/spi.h                |    6 ++----
 38 files changed, 82 insertions(+), 56 deletions(-)

diff --git a/drivers/gpio/max7301.c b/drivers/gpio/max7301.c
index 480956f..c92cff6 100644
--- a/drivers/gpio/max7301.c
+++ b/drivers/gpio/max7301.c
@@ -210,7 +210,8 @@ static void max7301_set(struct gpio_chip *chip, unsigned offset, int value)
 	mutex_unlock(&ts->lock);
 }
 
-static int __devinit max7301_probe(struct spi_device *spi)
+static int __devinit max7301_probe(struct spi_device *spi,
+				   const struct spi_device_id *id)
 {
 	struct max7301 *ts;
 	struct max7301_platform_data *pdata;
diff --git a/drivers/gpio/mcp23s08.c b/drivers/gpio/mcp23s08.c
index c6c7aa1..2a99eea 100644
--- a/drivers/gpio/mcp23s08.c
+++ b/drivers/gpio/mcp23s08.c
@@ -300,7 +300,8 @@ fail:
 	return status;
 }
 
-static int mcp23s08_probe(struct spi_device *spi)
+static int mcp23s08_probe(struct spi_device *spi,
+			  const struct spi_device_id *id)
 {
 	struct mcp23s08_platform_data	*pdata;
 	unsigned			addr;
diff --git a/drivers/hwmon/adcxx.c b/drivers/hwmon/adcxx.c
index 7a89fba..b01c0d5 100644
--- a/drivers/hwmon/adcxx.c
+++ b/drivers/hwmon/adcxx.c
@@ -204,22 +204,26 @@ out_err:
 	return status;
 }
 
-static int __devinit adcxx1s_probe(struct spi_device *spi)
+static int __devinit adcxx1s_probe(struct spi_device *spi,
+				   const struct spi_device_id *id)
 {
 	return adcxx_probe(spi, 1);
 }
 
-static int __devinit adcxx2s_probe(struct spi_device *spi)
+static int __devinit adcxx2s_probe(struct spi_device *spi,
+				   const struct spi_device_id *id)
 {
 	return adcxx_probe(spi, 2);
 }
 
-static int __devinit adcxx4s_probe(struct spi_device *spi)
+static int __devinit adcxx4s_probe(struct spi_device *spi,
+				   const struct spi_device_id *id)
 {
 	return adcxx_probe(spi, 4);
 }
 
-static int __devinit adcxx8s_probe(struct spi_device *spi)
+static int __devinit adcxx8s_probe(struct spi_device *spi,
+				   const struct spi_device_id *id)
 {
 	return adcxx_probe(spi, 8);
 }
diff --git a/drivers/hwmon/lis3lv02d_spi.c b/drivers/hwmon/lis3lv02d_spi.c
index b7aed07..478b1d4 100644
--- a/drivers/hwmon/lis3lv02d_spi.c
+++ b/drivers/hwmon/lis3lv02d_spi.c
@@ -56,7 +56,8 @@ static int lis3_spi_init(struct lis3lv02d *lis3)
 
 static struct axis_conversion lis3lv02d_axis_normal = { 1, 2, 3 };
 
-static int __devinit lis302dl_spi_probe(struct spi_device *spi)
+static int __devinit lis302dl_spi_probe(struct spi_device *spi,
+					const struct spi_device_id *id)
 {
 	int ret;
 
diff --git a/drivers/hwmon/lm70.c b/drivers/hwmon/lm70.c
index d55cc7c..3953c22 100644
--- a/drivers/hwmon/lm70.c
+++ b/drivers/hwmon/lm70.c
@@ -170,7 +170,8 @@ out_dev_reg_failed:
 	return status;
 }
 
-static int __devinit lm70_probe(struct spi_device *spi)
+static int __devinit lm70_probe(struct spi_device *spi,
+				const struct spi_device_id *id)
 {
 	/* signaling is SPI_MODE_0 on a 3-wire link (shared SI/SO) */
 	if ((spi->mode & (SPI_CPOL | SPI_CPHA)) || !(spi->mode & SPI_3WIRE))
@@ -179,7 +180,8 @@ static int __devinit lm70_probe(struct spi_device *spi)
 	return common_probe(spi, LM70_CHIP_LM70);
 }
 
-static int __devinit tmp121_probe(struct spi_device *spi)
+static int __devinit tmp121_probe(struct spi_device *spi,
+				  const struct spi_device_id *id)
 {
 	/* signaling is SPI_MODE_0 with only MISO connected */
 	if (spi->mode & (SPI_CPOL | SPI_CPHA))
diff --git a/drivers/hwmon/max1111.c b/drivers/hwmon/max1111.c
index 9ac4972..df0ce3b 100644
--- a/drivers/hwmon/max1111.c
+++ b/drivers/hwmon/max1111.c
@@ -154,7 +154,8 @@ static int setup_transfer(struct max1111_data *data)
 	return 0;
 }
 
-static int __devinit max1111_probe(struct spi_device *spi)
+static int __devinit max1111_probe(struct spi_device *spi,
+				   const struct spi_device_id *id)
 {
 	struct max1111_data *data;
 	int err;
diff --git a/drivers/input/touchscreen/ad7877.c b/drivers/input/touchscreen/ad7877.c
index eb83939..8b44d87 100644
--- a/drivers/input/touchscreen/ad7877.c
+++ b/drivers/input/touchscreen/ad7877.c
@@ -646,7 +646,8 @@ static void ad7877_setup_ts_def_msg(struct spi_device *spi, struct ad7877 *ts)
 	}
 }
 
-static int __devinit ad7877_probe(struct spi_device *spi)
+static int __devinit ad7877_probe(struct spi_device *spi,
+				  const struct spi_device_id *id)
 {
 	struct ad7877			*ts;
 	struct input_dev		*input_dev;
diff --git a/drivers/input/touchscreen/ad7879.c b/drivers/input/touchscreen/ad7879.c
index 19b4db7..aee8a94 100644
--- a/drivers/input/touchscreen/ad7879.c
+++ b/drivers/input/touchscreen/ad7879.c
@@ -618,7 +618,8 @@ static void ad7879_setup_ts_def_msg(struct ad7879 *ts)
 	}
 }
 
-static int __devinit ad7879_probe(struct spi_device *spi)
+static int __devinit ad7879_probe(struct spi_device *spi,
+				  const struct spi_device_id *id)
 {
 	struct ad7879 *ts;
 	int error;
diff --git a/drivers/input/touchscreen/ads7846.c b/drivers/input/touchscreen/ads7846.c
index 09c8109..eb12b09 100644
--- a/drivers/input/touchscreen/ads7846.c
+++ b/drivers/input/touchscreen/ads7846.c
@@ -872,7 +872,8 @@ static int __devinit setup_pendown(struct spi_device *spi, struct ads7846 *ts)
 	return 0;
 }
 
-static int __devinit ads7846_probe(struct spi_device *spi)
+static int __devinit ads7846_probe(struct spi_device *spi,
+				   const struct spi_device_id *id)
 {
 	struct ads7846			*ts;
 	struct ads7846_packet		*packet;
diff --git a/drivers/leds/leds-dac124s085.c b/drivers/leds/leds-dac124s085.c
index 2913d76..d6430d9 100644
--- a/drivers/leds/leds-dac124s085.c
+++ b/drivers/leds/leds-dac124s085.c
@@ -64,7 +64,8 @@ static void dac124s085_set_brightness(struct led_classdev *ldev,
 	spin_unlock(&led->lock);
 }
 
-static int dac124s085_probe(struct spi_device *spi)
+static int dac124s085_probe(struct spi_device *spi,
+			    const struct spi_device_id *id)
 {
 	struct dac124s085	*dac;
 	struct dac124s085_led	*led;
diff --git a/drivers/mfd/ezx-pcap.c b/drivers/mfd/ezx-pcap.c
index 1672f30..a658452 100644
--- a/drivers/mfd/ezx-pcap.c
+++ b/drivers/mfd/ezx-pcap.c
@@ -378,7 +378,8 @@ static int __devexit ezx_pcap_remove(struct spi_device *spi)
 	return 0;
 }
 
-static int __devinit ezx_pcap_probe(struct spi_device *spi)
+static int __devinit ezx_pcap_probe(struct spi_device *spi,
+				    const struct spi_device_id *id)
 {
 	struct pcap_platform_data *pdata = spi->dev.platform_data;
 	struct pcap_chip *pcap;
diff --git a/drivers/misc/eeprom/at25.c b/drivers/misc/eeprom/at25.c
index d564de0..39a36f3 100644
--- a/drivers/misc/eeprom/at25.c
+++ b/drivers/misc/eeprom/at25.c
@@ -287,7 +287,7 @@ static ssize_t at25_mem_write(struct memory_accessor *mem, const char *buf,
 
 /*-------------------------------------------------------------------------*/
 
-static int at25_probe(struct spi_device *spi)
+static int at25_probe(struct spi_device *spi, const struct spi_device_id *id)
 {
 	struct at25_data	*at25 = NULL;
 	const struct spi_eeprom *chip;
diff --git a/drivers/mmc/host/mmc_spi.c b/drivers/mmc/host/mmc_spi.c
index d55fe4f..0ebc11c 100644
--- a/drivers/mmc/host/mmc_spi.c
+++ b/drivers/mmc/host/mmc_spi.c
@@ -1306,7 +1306,8 @@ static int maybe_count_child(struct device *dev, void *c)
 	return 0;
 }
 
-static int mmc_spi_probe(struct spi_device *spi)
+static int mmc_spi_probe(struct spi_device *spi,
+			 const struct spi_device_id *id)
 {
 	void			*ones;
 	struct mmc_host		*mmc;
diff --git a/drivers/mtd/devices/m25p80.c b/drivers/mtd/devices/m25p80.c
index 7c3efff..74181c7 100644
--- a/drivers/mtd/devices/m25p80.c
+++ b/drivers/mtd/devices/m25p80.c
@@ -782,7 +782,7 @@ static struct spi_driver m25p80_driver = {
 		.owner	= THIS_MODULE,
 	},
 	.id_table	= m25p_ids,
-	.probe_id	= m25p_probe,
+	.probe		= m25p_probe,
 	.remove	= __devexit_p(m25p_remove),
 
 	/* REVISIT: many of these chips have deep power-down modes, which
diff --git a/drivers/mtd/devices/mtd_dataflash.c b/drivers/mtd/devices/mtd_dataflash.c
index 211c27a..6b242a0 100644
--- a/drivers/mtd/devices/mtd_dataflash.c
+++ b/drivers/mtd/devices/mtd_dataflash.c
@@ -847,7 +847,8 @@ static struct flash_info *__devinit jedec_probe(struct spi_device *spi)
  *   AT45DB0642  64Mbit  (8M)    xx111xxx (0x3c)   8192   1056     11
  *   AT45DB1282  128Mbit (16M)   xx0100xx (0x10)  16384   1056     11
  */
-static int __devinit dataflash_probe(struct spi_device *spi)
+static int __devinit dataflash_probe(struct spi_device *spi,
+				     const struct spi_device_id *id)
 {
 	int status;
 	struct flash_info	*info;
diff --git a/drivers/net/enc28j60.c b/drivers/net/enc28j60.c
index c709571..883d14f 100644
--- a/drivers/net/enc28j60.c
+++ b/drivers/net/enc28j60.c
@@ -1542,7 +1542,8 @@ static const struct net_device_ops enc28j60_netdev_ops = {
 	.ndo_validate_addr	= eth_validate_addr,
 };
 
-static int __devinit enc28j60_probe(struct spi_device *spi)
+static int __devinit enc28j60_probe(struct spi_device *spi,
+				    const struct spi_device_id *id)
 {
 	struct net_device *dev;
 	struct enc28j60_net *priv;
diff --git a/drivers/net/ks8851.c b/drivers/net/ks8851.c
index fe7cf4f..9bbbedd 100644
--- a/drivers/net/ks8851.c
+++ b/drivers/net/ks8851.c
@@ -1176,7 +1176,8 @@ static int ks8851_read_selftest(struct ks8851_net *ks)
 
 /* driver bus management functions */
 
-static int __devinit ks8851_probe(struct spi_device *spi)
+static int __devinit ks8851_probe(struct spi_device *spi,
+				  const struct spi_device_id *id)
 {
 	struct net_device *ndev;
 	struct ks8851_net *ks;
diff --git a/drivers/net/wireless/libertas/if_spi.c b/drivers/net/wireless/libertas/if_spi.c
index ea45765..4961b3a 100644
--- a/drivers/net/wireless/libertas/if_spi.c
+++ b/drivers/net/wireless/libertas/if_spi.c
@@ -1027,7 +1027,8 @@ static int if_spi_calculate_fw_names(u16 card_id,
 	return 0;
 }
 
-static int __devinit if_spi_probe(struct spi_device *spi)
+static int __devinit if_spi_probe(struct spi_device *spi,
+				  const struct spi_device_id *id)
 {
 	struct if_spi_card *card;
 	struct lbs_private *priv = NULL;
diff --git a/drivers/net/wireless/p54/p54spi.c b/drivers/net/wireless/p54/p54spi.c
index 63bcdd1..e7f1ff2 100644
--- a/drivers/net/wireless/p54/p54spi.c
+++ b/drivers/net/wireless/p54/p54spi.c
@@ -627,7 +627,8 @@ static void p54spi_op_stop(struct ieee80211_hw *dev)
 	mutex_unlock(&priv->mutex);
 }
 
-static int __devinit p54spi_probe(struct spi_device *spi)
+static int __devinit p54spi_probe(struct spi_device *spi,
+				  const struct spi_device_id *id)
 {
 	struct p54s_priv *priv = NULL;
 	struct ieee80211_hw *hw;
diff --git a/drivers/net/wireless/wl12xx/main.c b/drivers/net/wireless/wl12xx/main.c
index 6416406..66c3a91 100644
--- a/drivers/net/wireless/wl12xx/main.c
+++ b/drivers/net/wireless/wl12xx/main.c
@@ -1171,7 +1171,8 @@ static int wl12xx_init_ieee80211(struct wl12xx *wl)
 }
 
 #define WL12XX_DEFAULT_CHANNEL 1
-static int __devinit wl12xx_probe(struct spi_device *spi)
+static int __devinit wl12xx_probe(struct spi_device *spi,
+				  const struct spi_device_id *id)
 {
 	struct wl12xx_platform_data *pdata;
 	struct ieee80211_hw *hw;
diff --git a/drivers/rtc/rtc-ds1305.c b/drivers/rtc/rtc-ds1305.c
index 2736b11..4ce04db 100644
--- a/drivers/rtc/rtc-ds1305.c
+++ b/drivers/rtc/rtc-ds1305.c
@@ -614,7 +614,8 @@ static struct bin_attribute nvram = {
  * Interface to SPI stack
  */
 
-static int __devinit ds1305_probe(struct spi_device *spi)
+static int __devinit ds1305_probe(struct spi_device *spi,
+				  const struct spi_device_id *id)
 {
 	struct ds1305			*ds1305;
 	struct rtc_device		*rtc;
diff --git a/drivers/rtc/rtc-ds1390.c b/drivers/rtc/rtc-ds1390.c
index cdb7050..f18df86 100644
--- a/drivers/rtc/rtc-ds1390.c
+++ b/drivers/rtc/rtc-ds1390.c
@@ -120,7 +120,8 @@ static const struct rtc_class_ops ds1390_rtc_ops = {
 	.set_time	= ds1390_set_time,
 };
 
-static int __devinit ds1390_probe(struct spi_device *spi)
+static int __devinit ds1390_probe(struct spi_device *spi,
+				  const struct spi_device_id *id)
 {
 	unsigned char tmp;
 	struct ds1390 *chip;
diff --git a/drivers/rtc/rtc-ds3234.c b/drivers/rtc/rtc-ds3234.c
index a774ca3..b8107eb 100644
--- a/drivers/rtc/rtc-ds3234.c
+++ b/drivers/rtc/rtc-ds3234.c
@@ -105,7 +105,8 @@ static const struct rtc_class_ops ds3234_rtc_ops = {
 	.set_time	= ds3234_set_time,
 };
 
-static int __devinit ds3234_probe(struct spi_device *spi)
+static int __devinit ds3234_probe(struct spi_device *spi,
+				  const struct spi_device_id *id)
 {
 	struct rtc_device *rtc;
 	unsigned char tmp;
diff --git a/drivers/rtc/rtc-m41t94.c b/drivers/rtc/rtc-m41t94.c
index c8c97a4..87d6349 100644
--- a/drivers/rtc/rtc-m41t94.c
+++ b/drivers/rtc/rtc-m41t94.c
@@ -110,7 +110,8 @@ static const struct rtc_class_ops m41t94_rtc_ops = {
 
 static struct spi_driver m41t94_driver;
 
-static int __devinit m41t94_probe(struct spi_device *spi)
+static int __devinit m41t94_probe(struct spi_device *spi,
+				  const struct spi_device_id *id)
 {
 	struct rtc_device *rtc;
 	int res;
diff --git a/drivers/rtc/rtc-max6902.c b/drivers/rtc/rtc-max6902.c
index 657403e..95197f0 100644
--- a/drivers/rtc/rtc-max6902.c
+++ b/drivers/rtc/rtc-max6902.c
@@ -120,7 +120,8 @@ static const struct rtc_class_ops max6902_rtc_ops = {
 	.set_time	= max6902_set_time,
 };
 
-static int __devinit max6902_probe(struct spi_device *spi)
+static int __devinit max6902_probe(struct spi_device *spi,
+				   const struct spi_device_id *id)
 {
 	struct rtc_device *rtc;
 	unsigned char tmp;
diff --git a/drivers/rtc/rtc-r9701.c b/drivers/rtc/rtc-r9701.c
index 9beba49..a337c71 100644
--- a/drivers/rtc/rtc-r9701.c
+++ b/drivers/rtc/rtc-r9701.c
@@ -119,7 +119,8 @@ static const struct rtc_class_ops r9701_rtc_ops = {
 	.set_time	= r9701_set_datetime,
 };
 
-static int __devinit r9701_probe(struct spi_device *spi)
+static int __devinit r9701_probe(struct spi_device *spi,
+				 const struct spi_device_id *id)
 {
 	struct rtc_device *rtc;
 	unsigned char tmp;
diff --git a/drivers/rtc/rtc-rs5c348.c b/drivers/rtc/rtc-rs5c348.c
index 2099037..ffd3fa4 100644
--- a/drivers/rtc/rtc-rs5c348.c
+++ b/drivers/rtc/rtc-rs5c348.c
@@ -147,7 +147,8 @@ static const struct rtc_class_ops rs5c348_rtc_ops = {
 
 static struct spi_driver rs5c348_driver;
 
-static int __devinit rs5c348_probe(struct spi_device *spi)
+static int __devinit rs5c348_probe(struct spi_device *spi,
+				   const struct spi_device_id *id)
 {
 	int ret;
 	struct rtc_device *rtc;
diff --git a/drivers/serial/max3100.c b/drivers/serial/max3100.c
index 05d36e2..4b043f3 100644
--- a/drivers/serial/max3100.c
+++ b/drivers/serial/max3100.c
@@ -741,7 +741,8 @@ static struct uart_driver max3100_uart_driver = {
 };
 static int uart_driver_registered;
 
-static int __devinit max3100_probe(struct spi_device *spi)
+static int __devinit max3100_probe(struct spi_device *spi,
+				   const struct spi_device_id *id)
 {
 	int i, retval;
 	struct plat_max3100 *pdata;
diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c
index a3c9804..f05e272 100644
--- a/drivers/spi/spi.c
+++ b/drivers/spi/spi.c
@@ -137,19 +137,12 @@ struct bus_type spi_bus_type = {
 };
 EXPORT_SYMBOL_GPL(spi_bus_type);
 
-static int spi_drv_probe_id(struct device *dev)
-{
-	const struct spi_driver		*sdrv = to_spi_driver(dev->driver);
-	struct spi_device		*sdev = to_spi_device(dev);
-
-	return sdrv->probe_id(sdev, spi_match_id(sdrv->id_table, sdev));
-}
-
 static int spi_drv_probe(struct device *dev)
 {
 	const struct spi_driver		*sdrv = to_spi_driver(dev->driver);
+	struct spi_device		*sdev = to_spi_device(dev);
 
-	return sdrv->probe(to_spi_device(dev));
+	return sdrv->probe(sdev, spi_match_id(sdrv->id_table, sdev));
 }
 
 static int spi_drv_remove(struct device *dev)
@@ -174,9 +167,7 @@ static void spi_drv_shutdown(struct device *dev)
 int spi_register_driver(struct spi_driver *sdrv)
 {
 	sdrv->driver.bus = &spi_bus_type;
-	if (sdrv->probe_id)
-		sdrv->driver.probe = spi_drv_probe_id;
-	else if (sdrv->probe)
+	if (sdrv->probe)
 		sdrv->driver.probe = spi_drv_probe;
 	if (sdrv->remove)
 		sdrv->driver.remove = spi_drv_remove;
diff --git a/drivers/spi/spidev.c b/drivers/spi/spidev.c
index f921bd1..08b900b 100644
--- a/drivers/spi/spidev.c
+++ b/drivers/spi/spidev.c
@@ -561,7 +561,7 @@ static struct class *spidev_class;
 
 /*-------------------------------------------------------------------------*/
 
-static int spidev_probe(struct spi_device *spi)
+static int spidev_probe(struct spi_device *spi, const struct spi_device_id *id)
 {
 	struct spidev_data	*spidev;
 	int			status;
diff --git a/drivers/spi/tle62x0.c b/drivers/spi/tle62x0.c
index bf9540f..a6a181a 100644
--- a/drivers/spi/tle62x0.c
+++ b/drivers/spi/tle62x0.c
@@ -238,7 +238,8 @@ static int to_gpio_num(struct device_attribute *attr)
 	return -1;
 }
 
-static int __devinit tle62x0_probe(struct spi_device *spi)
+static int __devinit tle62x0_probe(struct spi_device *spi,
+				   const struct spi_device_id *id)
 {
 	struct tle62x0_state *st;
 	struct tle62x0_pdata *pdata;
diff --git a/drivers/staging/stlc45xx/stlc45xx.c b/drivers/staging/stlc45xx/stlc45xx.c
index 38d0b24..22c90fa 100644
--- a/drivers/staging/stlc45xx/stlc45xx.c
+++ b/drivers/staging/stlc45xx/stlc45xx.c
@@ -2387,7 +2387,8 @@ static struct platform_device stlc45xx_device = {
 	},
 };
 
-static int __devinit stlc45xx_probe(struct spi_device *spi)
+static int __devinit stlc45xx_probe(struct spi_device *spi,
+				    const struct spi_device_id *id)
 {
 	struct stlc45xx *stlc;
 	struct ieee80211_hw *hw;
diff --git a/drivers/video/backlight/corgi_lcd.c b/drivers/video/backlight/corgi_lcd.c
index 2211a85..eb5dced 100644
--- a/drivers/video/backlight/corgi_lcd.c
+++ b/drivers/video/backlight/corgi_lcd.c
@@ -530,7 +530,8 @@ err_free_backlight_on:
 	return err;
 }
 
-static int __devinit corgi_lcd_probe(struct spi_device *spi)
+static int __devinit corgi_lcd_probe(struct spi_device *spi,
+				     const struct spi_device_id *id)
 {
 	struct corgi_lcd_platform_data *pdata = spi->dev.platform_data;
 	struct corgi_lcd *lcd;
diff --git a/drivers/video/backlight/ltv350qv.c b/drivers/video/backlight/ltv350qv.c
index 4631ca8..4970c9f 100644
--- a/drivers/video/backlight/ltv350qv.c
+++ b/drivers/video/backlight/ltv350qv.c
@@ -225,7 +225,8 @@ static struct lcd_ops ltv_ops = {
 	.set_power	= ltv350qv_set_power,
 };
 
-static int __devinit ltv350qv_probe(struct spi_device *spi)
+static int __devinit ltv350qv_probe(struct spi_device *spi,
+				    const struct spi_device_id *id)
 {
 	struct ltv350qv *lcd;
 	struct lcd_device *ld;
diff --git a/drivers/video/backlight/tdo24m.c b/drivers/video/backlight/tdo24m.c
index bbfb502..0a2ab3f 100644
--- a/drivers/video/backlight/tdo24m.c
+++ b/drivers/video/backlight/tdo24m.c
@@ -327,7 +327,8 @@ static struct lcd_ops tdo24m_ops = {
 	.set_mode	= tdo24m_set_mode,
 };
 
-static int __devinit tdo24m_probe(struct spi_device *spi)
+static int __devinit tdo24m_probe(struct spi_device *spi,
+				  const struct spi_device_id *id)
 {
 	struct tdo24m *lcd;
 	struct spi_message *m;
diff --git a/drivers/video/backlight/tosa_lcd.c b/drivers/video/backlight/tosa_lcd.c
index 50ec17d..d8d057e 100644
--- a/drivers/video/backlight/tosa_lcd.c
+++ b/drivers/video/backlight/tosa_lcd.c
@@ -168,7 +168,8 @@ static struct lcd_ops tosa_lcd_ops = {
 	.set_mode = tosa_lcd_set_mode,
 };
 
-static int __devinit tosa_lcd_probe(struct spi_device *spi)
+static int __devinit tosa_lcd_probe(struct spi_device *spi,
+				    const struct spi_device_id *id)
 {
 	int ret;
 	struct tosa_lcd_data *data;
diff --git a/drivers/video/backlight/vgg2432a4.c b/drivers/video/backlight/vgg2432a4.c
index b49063c..3e9cb99 100644
--- a/drivers/video/backlight/vgg2432a4.c
+++ b/drivers/video/backlight/vgg2432a4.c
@@ -227,7 +227,8 @@ static struct ili9320_client vgg2432a4_client = {
 
 /* Device probe */
 
-static int __devinit vgg2432a4_probe(struct spi_device *spi)
+static int __devinit vgg2432a4_probe(struct spi_device *spi,
+				     const struct spi_device_id *id)
 {
 	int ret;
 
diff --git a/include/linux/spi/spi.h b/include/linux/spi/spi.h
index c8d92a1..fa4ada9 100644
--- a/include/linux/spi/spi.h
+++ b/include/linux/spi/spi.h
@@ -147,7 +147,6 @@ struct spi_message;
 /**
  * struct spi_driver - Host side "protocol" driver
  * @id_table: List of SPI devices supported by this driver
- * @probe_id: Binds this driver to the spi device via id_table matching.
  * @probe: Binds this driver to the spi device.  Drivers can verify
  *	that the device is actually present, and may need to configure
  *	characteristics (such as bits_per_word) which weren't needed for
@@ -174,9 +173,8 @@ struct spi_message;
  */
 struct spi_driver {
 	const struct spi_device_id *id_table;
-	int			(*probe_id)(struct spi_device *spi,
-					    const struct spi_device_id *id);
-	int			(*probe)(struct spi_device *spi);
+	int			(*probe)(struct spi_device *spi,
+					 const struct spi_device_id *id);
 	int			(*remove)(struct spi_device *spi);
 	void			(*shutdown)(struct spi_device *spi);
 	int			(*suspend)(struct spi_device *spi, pm_message_t mesg);
-- 
1.6.3.3


_______________________________________________
lm-sensors mailing list
lm-sensors@lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

^ permalink raw reply related	[flat|nested] 68+ messages in thread

* [PATCH 6/7] hwmon: adxx: Convert to device table matching
  2009-07-29 17:03 ` Anton Vorontsov
  (?)
  (?)
@ 2009-07-29 17:05   ` Anton Vorontsov
  -1 siblings, 0 replies; 68+ messages in thread
From: Anton Vorontsov @ 2009-07-29 17:05 UTC (permalink / raw)
  To: Andrew Morton
  Cc: David Brownell, David Woodhouse, Grant Likely, Jean Delvare,
	linux-mtd, linux-kernel, lm-sensors, linuxppc-dev

This patch makes the code a little bit nicer, and shorter.

Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com>
---
 drivers/hwmon/adcxx.c |  106 ++++++++-----------------------------------------
 1 files changed, 17 insertions(+), 89 deletions(-)

diff --git a/drivers/hwmon/adcxx.c b/drivers/hwmon/adcxx.c
index b01c0d5..6b3b057 100644
--- a/drivers/hwmon/adcxx.c
+++ b/drivers/hwmon/adcxx.c
@@ -43,6 +43,7 @@
 #include <linux/hwmon.h>
 #include <linux/hwmon-sysfs.h>
 #include <linux/mutex.h>
+#include <linux/mod_devicetable.h>
 #include <linux/spi/spi.h>
 
 #define DRVNAME		"adcxx"
@@ -157,8 +158,10 @@ static struct sensor_device_attribute ad_input[] = {
 
 /*----------------------------------------------------------------------*/
 
-static int __devinit adcxx_probe(struct spi_device *spi, int channels)
+static int __devinit adcxx_probe(struct spi_device *spi,
+				 const struct spi_device_id *id)
 {
+	int channels = (int)id->data;
 	struct adcxx *adc;
 	int status;
 	int i;
@@ -204,30 +207,6 @@ out_err:
 	return status;
 }
 
-static int __devinit adcxx1s_probe(struct spi_device *spi,
-				   const struct spi_device_id *id)
-{
-	return adcxx_probe(spi, 1);
-}
-
-static int __devinit adcxx2s_probe(struct spi_device *spi,
-				   const struct spi_device_id *id)
-{
-	return adcxx_probe(spi, 2);
-}
-
-static int __devinit adcxx4s_probe(struct spi_device *spi,
-				   const struct spi_device_id *id)
-{
-	return adcxx_probe(spi, 4);
-}
-
-static int __devinit adcxx8s_probe(struct spi_device *spi,
-				   const struct spi_device_id *id)
-{
-	return adcxx_probe(spi, 8);
-}
-
 static int __devexit adcxx_remove(struct spi_device *spi)
 {
 	struct adcxx *adc = dev_get_drvdata(&spi->dev);
@@ -245,79 +224,33 @@ static int __devexit adcxx_remove(struct spi_device *spi)
 	return 0;
 }
 
-static struct spi_driver adcxx1s_driver = {
-	.driver = {
-		.name	= "adcxx1s",
-		.owner	= THIS_MODULE,
-	},
-	.probe	= adcxx1s_probe,
-	.remove	= __devexit_p(adcxx_remove),
+static const struct spi_device_id adcxx_ids[] = {
+	{ "adcxx1s", (void *)1 },
+	{ "adcxx2s", (void *)2 },
+	{ "adcxx4s", (void *)4 },
+	{ "adcxx8s", (void *)8 },
+	{ },
 };
+MODULE_DEVICE_TABLE(spi, adcxx_ids);
 
-static struct spi_driver adcxx2s_driver = {
+static struct spi_driver adcxx_driver = {
 	.driver = {
-		.name	= "adcxx2s",
+		.name	= "adcxx",
 		.owner	= THIS_MODULE,
 	},
-	.probe	= adcxx2s_probe,
-	.remove	= __devexit_p(adcxx_remove),
-};
-
-static struct spi_driver adcxx4s_driver = {
-	.driver = {
-		.name	= "adcxx4s",
-		.owner	= THIS_MODULE,
-	},
-	.probe	= adcxx4s_probe,
-	.remove	= __devexit_p(adcxx_remove),
-};
-
-static struct spi_driver adcxx8s_driver = {
-	.driver = {
-		.name	= "adcxx8s",
-		.owner	= THIS_MODULE,
-	},
-	.probe	= adcxx8s_probe,
+	.id_table = adcxx_ids,
+	.probe	= adcxx_probe,
 	.remove	= __devexit_p(adcxx_remove),
 };
 
 static int __init init_adcxx(void)
 {
-	int status;
-	status = spi_register_driver(&adcxx1s_driver);
-	if (status)
-		goto reg_1_failed;
-
-	status = spi_register_driver(&adcxx2s_driver);
-	if (status)
-		goto reg_2_failed;
-
-	status = spi_register_driver(&adcxx4s_driver);
-	if (status)
-		goto reg_4_failed;
-
-	status = spi_register_driver(&adcxx8s_driver);
-	if (status)
-		goto reg_8_failed;
-
-	return status;
-
-reg_8_failed:
-	spi_unregister_driver(&adcxx4s_driver);
-reg_4_failed:
-	spi_unregister_driver(&adcxx2s_driver);
-reg_2_failed:
-	spi_unregister_driver(&adcxx1s_driver);
-reg_1_failed:
-	return status;
+	return spi_register_driver(&adcxx_driver);
 }
 
 static void __exit exit_adcxx(void)
 {
-	spi_unregister_driver(&adcxx1s_driver);
-	spi_unregister_driver(&adcxx2s_driver);
-	spi_unregister_driver(&adcxx4s_driver);
-	spi_unregister_driver(&adcxx8s_driver);
+	spi_unregister_driver(&adcxx_driver);
 }
 
 module_init(init_adcxx);
@@ -326,8 +259,3 @@ module_exit(exit_adcxx);
 MODULE_AUTHOR("Marc Pignat");
 MODULE_DESCRIPTION("National Semiconductor adcxx8sxxx Linux driver");
 MODULE_LICENSE("GPL");
-
-MODULE_ALIAS("spi:adcxx1s");
-MODULE_ALIAS("spi:adcxx2s");
-MODULE_ALIAS("spi:adcxx4s");
-MODULE_ALIAS("spi:adcxx8s");
-- 
1.6.3.3


^ permalink raw reply related	[flat|nested] 68+ messages in thread

* [PATCH 6/7] hwmon: adxx: Convert to device table matching
@ 2009-07-29 17:05   ` Anton Vorontsov
  0 siblings, 0 replies; 68+ messages in thread
From: Anton Vorontsov @ 2009-07-29 17:05 UTC (permalink / raw)
  To: Andrew Morton
  Cc: David Brownell, linux-kernel, lm-sensors, linuxppc-dev,
	linux-mtd, Jean Delvare, David Woodhouse

This patch makes the code a little bit nicer, and shorter.

Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com>
---
 drivers/hwmon/adcxx.c |  106 ++++++++-----------------------------------------
 1 files changed, 17 insertions(+), 89 deletions(-)

diff --git a/drivers/hwmon/adcxx.c b/drivers/hwmon/adcxx.c
index b01c0d5..6b3b057 100644
--- a/drivers/hwmon/adcxx.c
+++ b/drivers/hwmon/adcxx.c
@@ -43,6 +43,7 @@
 #include <linux/hwmon.h>
 #include <linux/hwmon-sysfs.h>
 #include <linux/mutex.h>
+#include <linux/mod_devicetable.h>
 #include <linux/spi/spi.h>
 
 #define DRVNAME		"adcxx"
@@ -157,8 +158,10 @@ static struct sensor_device_attribute ad_input[] = {
 
 /*----------------------------------------------------------------------*/
 
-static int __devinit adcxx_probe(struct spi_device *spi, int channels)
+static int __devinit adcxx_probe(struct spi_device *spi,
+				 const struct spi_device_id *id)
 {
+	int channels = (int)id->data;
 	struct adcxx *adc;
 	int status;
 	int i;
@@ -204,30 +207,6 @@ out_err:
 	return status;
 }
 
-static int __devinit adcxx1s_probe(struct spi_device *spi,
-				   const struct spi_device_id *id)
-{
-	return adcxx_probe(spi, 1);
-}
-
-static int __devinit adcxx2s_probe(struct spi_device *spi,
-				   const struct spi_device_id *id)
-{
-	return adcxx_probe(spi, 2);
-}
-
-static int __devinit adcxx4s_probe(struct spi_device *spi,
-				   const struct spi_device_id *id)
-{
-	return adcxx_probe(spi, 4);
-}
-
-static int __devinit adcxx8s_probe(struct spi_device *spi,
-				   const struct spi_device_id *id)
-{
-	return adcxx_probe(spi, 8);
-}
-
 static int __devexit adcxx_remove(struct spi_device *spi)
 {
 	struct adcxx *adc = dev_get_drvdata(&spi->dev);
@@ -245,79 +224,33 @@ static int __devexit adcxx_remove(struct spi_device *spi)
 	return 0;
 }
 
-static struct spi_driver adcxx1s_driver = {
-	.driver = {
-		.name	= "adcxx1s",
-		.owner	= THIS_MODULE,
-	},
-	.probe	= adcxx1s_probe,
-	.remove	= __devexit_p(adcxx_remove),
+static const struct spi_device_id adcxx_ids[] = {
+	{ "adcxx1s", (void *)1 },
+	{ "adcxx2s", (void *)2 },
+	{ "adcxx4s", (void *)4 },
+	{ "adcxx8s", (void *)8 },
+	{ },
 };
+MODULE_DEVICE_TABLE(spi, adcxx_ids);
 
-static struct spi_driver adcxx2s_driver = {
+static struct spi_driver adcxx_driver = {
 	.driver = {
-		.name	= "adcxx2s",
+		.name	= "adcxx",
 		.owner	= THIS_MODULE,
 	},
-	.probe	= adcxx2s_probe,
-	.remove	= __devexit_p(adcxx_remove),
-};
-
-static struct spi_driver adcxx4s_driver = {
-	.driver = {
-		.name	= "adcxx4s",
-		.owner	= THIS_MODULE,
-	},
-	.probe	= adcxx4s_probe,
-	.remove	= __devexit_p(adcxx_remove),
-};
-
-static struct spi_driver adcxx8s_driver = {
-	.driver = {
-		.name	= "adcxx8s",
-		.owner	= THIS_MODULE,
-	},
-	.probe	= adcxx8s_probe,
+	.id_table = adcxx_ids,
+	.probe	= adcxx_probe,
 	.remove	= __devexit_p(adcxx_remove),
 };
 
 static int __init init_adcxx(void)
 {
-	int status;
-	status = spi_register_driver(&adcxx1s_driver);
-	if (status)
-		goto reg_1_failed;
-
-	status = spi_register_driver(&adcxx2s_driver);
-	if (status)
-		goto reg_2_failed;
-
-	status = spi_register_driver(&adcxx4s_driver);
-	if (status)
-		goto reg_4_failed;
-
-	status = spi_register_driver(&adcxx8s_driver);
-	if (status)
-		goto reg_8_failed;
-
-	return status;
-
-reg_8_failed:
-	spi_unregister_driver(&adcxx4s_driver);
-reg_4_failed:
-	spi_unregister_driver(&adcxx2s_driver);
-reg_2_failed:
-	spi_unregister_driver(&adcxx1s_driver);
-reg_1_failed:
-	return status;
+	return spi_register_driver(&adcxx_driver);
 }
 
 static void __exit exit_adcxx(void)
 {
-	spi_unregister_driver(&adcxx1s_driver);
-	spi_unregister_driver(&adcxx2s_driver);
-	spi_unregister_driver(&adcxx4s_driver);
-	spi_unregister_driver(&adcxx8s_driver);
+	spi_unregister_driver(&adcxx_driver);
 }
 
 module_init(init_adcxx);
@@ -326,8 +259,3 @@ module_exit(exit_adcxx);
 MODULE_AUTHOR("Marc Pignat");
 MODULE_DESCRIPTION("National Semiconductor adcxx8sxxx Linux driver");
 MODULE_LICENSE("GPL");
-
-MODULE_ALIAS("spi:adcxx1s");
-MODULE_ALIAS("spi:adcxx2s");
-MODULE_ALIAS("spi:adcxx4s");
-MODULE_ALIAS("spi:adcxx8s");
-- 
1.6.3.3

^ permalink raw reply related	[flat|nested] 68+ messages in thread

* [PATCH 6/7] hwmon: adxx: Convert to device table matching
@ 2009-07-29 17:05   ` Anton Vorontsov
  0 siblings, 0 replies; 68+ messages in thread
From: Anton Vorontsov @ 2009-07-29 17:05 UTC (permalink / raw)
  To: Andrew Morton
  Cc: David Brownell, linux-kernel, lm-sensors, Grant Likely,
	linuxppc-dev, linux-mtd, Jean Delvare, David Woodhouse

This patch makes the code a little bit nicer, and shorter.

Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com>
---
 drivers/hwmon/adcxx.c |  106 ++++++++-----------------------------------------
 1 files changed, 17 insertions(+), 89 deletions(-)

diff --git a/drivers/hwmon/adcxx.c b/drivers/hwmon/adcxx.c
index b01c0d5..6b3b057 100644
--- a/drivers/hwmon/adcxx.c
+++ b/drivers/hwmon/adcxx.c
@@ -43,6 +43,7 @@
 #include <linux/hwmon.h>
 #include <linux/hwmon-sysfs.h>
 #include <linux/mutex.h>
+#include <linux/mod_devicetable.h>
 #include <linux/spi/spi.h>
 
 #define DRVNAME		"adcxx"
@@ -157,8 +158,10 @@ static struct sensor_device_attribute ad_input[] = {
 
 /*----------------------------------------------------------------------*/
 
-static int __devinit adcxx_probe(struct spi_device *spi, int channels)
+static int __devinit adcxx_probe(struct spi_device *spi,
+				 const struct spi_device_id *id)
 {
+	int channels = (int)id->data;
 	struct adcxx *adc;
 	int status;
 	int i;
@@ -204,30 +207,6 @@ out_err:
 	return status;
 }
 
-static int __devinit adcxx1s_probe(struct spi_device *spi,
-				   const struct spi_device_id *id)
-{
-	return adcxx_probe(spi, 1);
-}
-
-static int __devinit adcxx2s_probe(struct spi_device *spi,
-				   const struct spi_device_id *id)
-{
-	return adcxx_probe(spi, 2);
-}
-
-static int __devinit adcxx4s_probe(struct spi_device *spi,
-				   const struct spi_device_id *id)
-{
-	return adcxx_probe(spi, 4);
-}
-
-static int __devinit adcxx8s_probe(struct spi_device *spi,
-				   const struct spi_device_id *id)
-{
-	return adcxx_probe(spi, 8);
-}
-
 static int __devexit adcxx_remove(struct spi_device *spi)
 {
 	struct adcxx *adc = dev_get_drvdata(&spi->dev);
@@ -245,79 +224,33 @@ static int __devexit adcxx_remove(struct spi_device *spi)
 	return 0;
 }
 
-static struct spi_driver adcxx1s_driver = {
-	.driver = {
-		.name	= "adcxx1s",
-		.owner	= THIS_MODULE,
-	},
-	.probe	= adcxx1s_probe,
-	.remove	= __devexit_p(adcxx_remove),
+static const struct spi_device_id adcxx_ids[] = {
+	{ "adcxx1s", (void *)1 },
+	{ "adcxx2s", (void *)2 },
+	{ "adcxx4s", (void *)4 },
+	{ "adcxx8s", (void *)8 },
+	{ },
 };
+MODULE_DEVICE_TABLE(spi, adcxx_ids);
 
-static struct spi_driver adcxx2s_driver = {
+static struct spi_driver adcxx_driver = {
 	.driver = {
-		.name	= "adcxx2s",
+		.name	= "adcxx",
 		.owner	= THIS_MODULE,
 	},
-	.probe	= adcxx2s_probe,
-	.remove	= __devexit_p(adcxx_remove),
-};
-
-static struct spi_driver adcxx4s_driver = {
-	.driver = {
-		.name	= "adcxx4s",
-		.owner	= THIS_MODULE,
-	},
-	.probe	= adcxx4s_probe,
-	.remove	= __devexit_p(adcxx_remove),
-};
-
-static struct spi_driver adcxx8s_driver = {
-	.driver = {
-		.name	= "adcxx8s",
-		.owner	= THIS_MODULE,
-	},
-	.probe	= adcxx8s_probe,
+	.id_table = adcxx_ids,
+	.probe	= adcxx_probe,
 	.remove	= __devexit_p(adcxx_remove),
 };
 
 static int __init init_adcxx(void)
 {
-	int status;
-	status = spi_register_driver(&adcxx1s_driver);
-	if (status)
-		goto reg_1_failed;
-
-	status = spi_register_driver(&adcxx2s_driver);
-	if (status)
-		goto reg_2_failed;
-
-	status = spi_register_driver(&adcxx4s_driver);
-	if (status)
-		goto reg_4_failed;
-
-	status = spi_register_driver(&adcxx8s_driver);
-	if (status)
-		goto reg_8_failed;
-
-	return status;
-
-reg_8_failed:
-	spi_unregister_driver(&adcxx4s_driver);
-reg_4_failed:
-	spi_unregister_driver(&adcxx2s_driver);
-reg_2_failed:
-	spi_unregister_driver(&adcxx1s_driver);
-reg_1_failed:
-	return status;
+	return spi_register_driver(&adcxx_driver);
 }
 
 static void __exit exit_adcxx(void)
 {
-	spi_unregister_driver(&adcxx1s_driver);
-	spi_unregister_driver(&adcxx2s_driver);
-	spi_unregister_driver(&adcxx4s_driver);
-	spi_unregister_driver(&adcxx8s_driver);
+	spi_unregister_driver(&adcxx_driver);
 }
 
 module_init(init_adcxx);
@@ -326,8 +259,3 @@ module_exit(exit_adcxx);
 MODULE_AUTHOR("Marc Pignat");
 MODULE_DESCRIPTION("National Semiconductor adcxx8sxxx Linux driver");
 MODULE_LICENSE("GPL");
-
-MODULE_ALIAS("spi:adcxx1s");
-MODULE_ALIAS("spi:adcxx2s");
-MODULE_ALIAS("spi:adcxx4s");
-MODULE_ALIAS("spi:adcxx8s");
-- 
1.6.3.3

^ permalink raw reply related	[flat|nested] 68+ messages in thread

* [lm-sensors] [PATCH 6/7] hwmon: adxx: Convert to device table
@ 2009-07-29 17:05   ` Anton Vorontsov
  0 siblings, 0 replies; 68+ messages in thread
From: Anton Vorontsov @ 2009-07-29 17:05 UTC (permalink / raw)
  To: Andrew Morton
  Cc: David Brownell, David Woodhouse, Grant Likely, Jean Delvare,
	linux-mtd, linux-kernel, lm-sensors, linuxppc-dev

This patch makes the code a little bit nicer, and shorter.

Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com>
---
 drivers/hwmon/adcxx.c |  106 ++++++++-----------------------------------------
 1 files changed, 17 insertions(+), 89 deletions(-)

diff --git a/drivers/hwmon/adcxx.c b/drivers/hwmon/adcxx.c
index b01c0d5..6b3b057 100644
--- a/drivers/hwmon/adcxx.c
+++ b/drivers/hwmon/adcxx.c
@@ -43,6 +43,7 @@
 #include <linux/hwmon.h>
 #include <linux/hwmon-sysfs.h>
 #include <linux/mutex.h>
+#include <linux/mod_devicetable.h>
 #include <linux/spi/spi.h>
 
 #define DRVNAME		"adcxx"
@@ -157,8 +158,10 @@ static struct sensor_device_attribute ad_input[] = {
 
 /*----------------------------------------------------------------------*/
 
-static int __devinit adcxx_probe(struct spi_device *spi, int channels)
+static int __devinit adcxx_probe(struct spi_device *spi,
+				 const struct spi_device_id *id)
 {
+	int channels = (int)id->data;
 	struct adcxx *adc;
 	int status;
 	int i;
@@ -204,30 +207,6 @@ out_err:
 	return status;
 }
 
-static int __devinit adcxx1s_probe(struct spi_device *spi,
-				   const struct spi_device_id *id)
-{
-	return adcxx_probe(spi, 1);
-}
-
-static int __devinit adcxx2s_probe(struct spi_device *spi,
-				   const struct spi_device_id *id)
-{
-	return adcxx_probe(spi, 2);
-}
-
-static int __devinit adcxx4s_probe(struct spi_device *spi,
-				   const struct spi_device_id *id)
-{
-	return adcxx_probe(spi, 4);
-}
-
-static int __devinit adcxx8s_probe(struct spi_device *spi,
-				   const struct spi_device_id *id)
-{
-	return adcxx_probe(spi, 8);
-}
-
 static int __devexit adcxx_remove(struct spi_device *spi)
 {
 	struct adcxx *adc = dev_get_drvdata(&spi->dev);
@@ -245,79 +224,33 @@ static int __devexit adcxx_remove(struct spi_device *spi)
 	return 0;
 }
 
-static struct spi_driver adcxx1s_driver = {
-	.driver = {
-		.name	= "adcxx1s",
-		.owner	= THIS_MODULE,
-	},
-	.probe	= adcxx1s_probe,
-	.remove	= __devexit_p(adcxx_remove),
+static const struct spi_device_id adcxx_ids[] = {
+	{ "adcxx1s", (void *)1 },
+	{ "adcxx2s", (void *)2 },
+	{ "adcxx4s", (void *)4 },
+	{ "adcxx8s", (void *)8 },
+	{ },
 };
+MODULE_DEVICE_TABLE(spi, adcxx_ids);
 
-static struct spi_driver adcxx2s_driver = {
+static struct spi_driver adcxx_driver = {
 	.driver = {
-		.name	= "adcxx2s",
+		.name	= "adcxx",
 		.owner	= THIS_MODULE,
 	},
-	.probe	= adcxx2s_probe,
-	.remove	= __devexit_p(adcxx_remove),
-};
-
-static struct spi_driver adcxx4s_driver = {
-	.driver = {
-		.name	= "adcxx4s",
-		.owner	= THIS_MODULE,
-	},
-	.probe	= adcxx4s_probe,
-	.remove	= __devexit_p(adcxx_remove),
-};
-
-static struct spi_driver adcxx8s_driver = {
-	.driver = {
-		.name	= "adcxx8s",
-		.owner	= THIS_MODULE,
-	},
-	.probe	= adcxx8s_probe,
+	.id_table = adcxx_ids,
+	.probe	= adcxx_probe,
 	.remove	= __devexit_p(adcxx_remove),
 };
 
 static int __init init_adcxx(void)
 {
-	int status;
-	status = spi_register_driver(&adcxx1s_driver);
-	if (status)
-		goto reg_1_failed;
-
-	status = spi_register_driver(&adcxx2s_driver);
-	if (status)
-		goto reg_2_failed;
-
-	status = spi_register_driver(&adcxx4s_driver);
-	if (status)
-		goto reg_4_failed;
-
-	status = spi_register_driver(&adcxx8s_driver);
-	if (status)
-		goto reg_8_failed;
-
-	return status;
-
-reg_8_failed:
-	spi_unregister_driver(&adcxx4s_driver);
-reg_4_failed:
-	spi_unregister_driver(&adcxx2s_driver);
-reg_2_failed:
-	spi_unregister_driver(&adcxx1s_driver);
-reg_1_failed:
-	return status;
+	return spi_register_driver(&adcxx_driver);
 }
 
 static void __exit exit_adcxx(void)
 {
-	spi_unregister_driver(&adcxx1s_driver);
-	spi_unregister_driver(&adcxx2s_driver);
-	spi_unregister_driver(&adcxx4s_driver);
-	spi_unregister_driver(&adcxx8s_driver);
+	spi_unregister_driver(&adcxx_driver);
 }
 
 module_init(init_adcxx);
@@ -326,8 +259,3 @@ module_exit(exit_adcxx);
 MODULE_AUTHOR("Marc Pignat");
 MODULE_DESCRIPTION("National Semiconductor adcxx8sxxx Linux driver");
 MODULE_LICENSE("GPL");
-
-MODULE_ALIAS("spi:adcxx1s");
-MODULE_ALIAS("spi:adcxx2s");
-MODULE_ALIAS("spi:adcxx4s");
-MODULE_ALIAS("spi:adcxx8s");
-- 
1.6.3.3


_______________________________________________
lm-sensors mailing list
lm-sensors@lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

^ permalink raw reply related	[flat|nested] 68+ messages in thread

* [PATCH 7/7] hwmon: lm70: Convert to device table matching
  2009-07-29 17:03 ` Anton Vorontsov
  (?)
  (?)
@ 2009-07-29 17:05   ` Anton Vorontsov
  -1 siblings, 0 replies; 68+ messages in thread
From: Anton Vorontsov @ 2009-07-29 17:05 UTC (permalink / raw)
  To: Andrew Morton
  Cc: David Brownell, David Woodhouse, Grant Likely, Jean Delvare,
	linux-mtd, linux-kernel, lm-sensors, linuxppc-dev

This patch makes the code a little bit nicer, and shorter.

Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com>
---
 drivers/hwmon/lm70.c |   58 +++++++++++++++++--------------------------------
 1 files changed, 20 insertions(+), 38 deletions(-)

diff --git a/drivers/hwmon/lm70.c b/drivers/hwmon/lm70.c
index 3953c22..b4be110 100644
--- a/drivers/hwmon/lm70.c
+++ b/drivers/hwmon/lm70.c
@@ -32,6 +32,7 @@
 #include <linux/sysfs.h>
 #include <linux/hwmon.h>
 #include <linux/mutex.h>
+#include <linux/mod_devicetable.h>
 #include <linux/spi/spi.h>
 
 
@@ -130,11 +131,21 @@ static DEVICE_ATTR(name, S_IRUGO, lm70_show_name, NULL);
 
 /*----------------------------------------------------------------------*/
 
-static int __devinit common_probe(struct spi_device *spi, int chip)
+static int __devinit lm70_probe(struct spi_device *spi,
+				const struct spi_device_id *id)
 {
+	int chip = (int)id->data;
 	struct lm70 *p_lm70;
 	int status;
 
+	/* signaling is SPI_MODE_0 for both LM70 and TMP121 */
+	if (spi->mode & (SPI_CPOL | SPI_CPHA))
+		return -EINVAL;
+
+	/* 3-wire link (shared SI/SO) for LM70 */
+	if (chip == LM70_CHIP_LM70 && !(spi->mode & SPI_3WIRE))
+		return -EINVAL;
+
 	/* NOTE:  we assume 8-bit words, and convert to 16 bits manually */
 
 	p_lm70 = kzalloc(sizeof *p_lm70, GFP_KERNEL);
@@ -170,26 +181,6 @@ out_dev_reg_failed:
 	return status;
 }
 
-static int __devinit lm70_probe(struct spi_device *spi,
-				const struct spi_device_id *id)
-{
-	/* signaling is SPI_MODE_0 on a 3-wire link (shared SI/SO) */
-	if ((spi->mode & (SPI_CPOL | SPI_CPHA)) || !(spi->mode & SPI_3WIRE))
-		return -EINVAL;
-
-	return common_probe(spi, LM70_CHIP_LM70);
-}
-
-static int __devinit tmp121_probe(struct spi_device *spi,
-				  const struct spi_device_id *id)
-{
-	/* signaling is SPI_MODE_0 with only MISO connected */
-	if (spi->mode & (SPI_CPOL | SPI_CPHA))
-		return -EINVAL;
-
-	return common_probe(spi, LM70_CHIP_TMP121);
-}
-
 static int __devexit lm70_remove(struct spi_device *spi)
 {
 	struct lm70 *p_lm70 = dev_get_drvdata(&spi->dev);
@@ -203,41 +194,32 @@ static int __devexit lm70_remove(struct spi_device *spi)
 	return 0;
 }
 
-static struct spi_driver tmp121_driver = {
-	.driver = {
-		.name	= "tmp121",
-		.owner	= THIS_MODULE,
-	},
-	.probe	= tmp121_probe,
-	.remove	= __devexit_p(lm70_remove),
+
+static const struct spi_device_id lm70_ids[] = {
+	{ "lm70",   (void *)LM70_CHIP_LM70 },
+	{ "tmp121", (void *)LM70_CHIP_TMP121 },
+	{ },
 };
+MODULE_DEVICE_TABLE(spi, lm70_ids);
 
 static struct spi_driver lm70_driver = {
 	.driver = {
 		.name	= "lm70",
 		.owner	= THIS_MODULE,
 	},
+	.id_table = lm70_ids,
 	.probe	= lm70_probe,
 	.remove	= __devexit_p(lm70_remove),
 };
 
 static int __init init_lm70(void)
 {
-	int ret = spi_register_driver(&lm70_driver);
-	if (ret)
-		return ret;
-
-	ret = spi_register_driver(&tmp121_driver);
-	if (ret)
-		spi_unregister_driver(&lm70_driver);
-
-	return ret;
+	return spi_register_driver(&lm70_driver);
 }
 
 static void __exit cleanup_lm70(void)
 {
 	spi_unregister_driver(&lm70_driver);
-	spi_unregister_driver(&tmp121_driver);
 }
 
 module_init(init_lm70);
-- 
1.6.3.3

^ permalink raw reply related	[flat|nested] 68+ messages in thread

* [PATCH 7/7] hwmon: lm70: Convert to device table matching
@ 2009-07-29 17:05   ` Anton Vorontsov
  0 siblings, 0 replies; 68+ messages in thread
From: Anton Vorontsov @ 2009-07-29 17:05 UTC (permalink / raw)
  To: Andrew Morton
  Cc: David Brownell, linux-kernel, lm-sensors, linuxppc-dev,
	linux-mtd, Jean Delvare, David Woodhouse

This patch makes the code a little bit nicer, and shorter.

Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com>
---
 drivers/hwmon/lm70.c |   58 +++++++++++++++++--------------------------------
 1 files changed, 20 insertions(+), 38 deletions(-)

diff --git a/drivers/hwmon/lm70.c b/drivers/hwmon/lm70.c
index 3953c22..b4be110 100644
--- a/drivers/hwmon/lm70.c
+++ b/drivers/hwmon/lm70.c
@@ -32,6 +32,7 @@
 #include <linux/sysfs.h>
 #include <linux/hwmon.h>
 #include <linux/mutex.h>
+#include <linux/mod_devicetable.h>
 #include <linux/spi/spi.h>
 
 
@@ -130,11 +131,21 @@ static DEVICE_ATTR(name, S_IRUGO, lm70_show_name, NULL);
 
 /*----------------------------------------------------------------------*/
 
-static int __devinit common_probe(struct spi_device *spi, int chip)
+static int __devinit lm70_probe(struct spi_device *spi,
+				const struct spi_device_id *id)
 {
+	int chip = (int)id->data;
 	struct lm70 *p_lm70;
 	int status;
 
+	/* signaling is SPI_MODE_0 for both LM70 and TMP121 */
+	if (spi->mode & (SPI_CPOL | SPI_CPHA))
+		return -EINVAL;
+
+	/* 3-wire link (shared SI/SO) for LM70 */
+	if (chip == LM70_CHIP_LM70 && !(spi->mode & SPI_3WIRE))
+		return -EINVAL;
+
 	/* NOTE:  we assume 8-bit words, and convert to 16 bits manually */
 
 	p_lm70 = kzalloc(sizeof *p_lm70, GFP_KERNEL);
@@ -170,26 +181,6 @@ out_dev_reg_failed:
 	return status;
 }
 
-static int __devinit lm70_probe(struct spi_device *spi,
-				const struct spi_device_id *id)
-{
-	/* signaling is SPI_MODE_0 on a 3-wire link (shared SI/SO) */
-	if ((spi->mode & (SPI_CPOL | SPI_CPHA)) || !(spi->mode & SPI_3WIRE))
-		return -EINVAL;
-
-	return common_probe(spi, LM70_CHIP_LM70);
-}
-
-static int __devinit tmp121_probe(struct spi_device *spi,
-				  const struct spi_device_id *id)
-{
-	/* signaling is SPI_MODE_0 with only MISO connected */
-	if (spi->mode & (SPI_CPOL | SPI_CPHA))
-		return -EINVAL;
-
-	return common_probe(spi, LM70_CHIP_TMP121);
-}
-
 static int __devexit lm70_remove(struct spi_device *spi)
 {
 	struct lm70 *p_lm70 = dev_get_drvdata(&spi->dev);
@@ -203,41 +194,32 @@ static int __devexit lm70_remove(struct spi_device *spi)
 	return 0;
 }
 
-static struct spi_driver tmp121_driver = {
-	.driver = {
-		.name	= "tmp121",
-		.owner	= THIS_MODULE,
-	},
-	.probe	= tmp121_probe,
-	.remove	= __devexit_p(lm70_remove),
+
+static const struct spi_device_id lm70_ids[] = {
+	{ "lm70",   (void *)LM70_CHIP_LM70 },
+	{ "tmp121", (void *)LM70_CHIP_TMP121 },
+	{ },
 };
+MODULE_DEVICE_TABLE(spi, lm70_ids);
 
 static struct spi_driver lm70_driver = {
 	.driver = {
 		.name	= "lm70",
 		.owner	= THIS_MODULE,
 	},
+	.id_table = lm70_ids,
 	.probe	= lm70_probe,
 	.remove	= __devexit_p(lm70_remove),
 };
 
 static int __init init_lm70(void)
 {
-	int ret = spi_register_driver(&lm70_driver);
-	if (ret)
-		return ret;
-
-	ret = spi_register_driver(&tmp121_driver);
-	if (ret)
-		spi_unregister_driver(&lm70_driver);
-
-	return ret;
+	return spi_register_driver(&lm70_driver);
 }
 
 static void __exit cleanup_lm70(void)
 {
 	spi_unregister_driver(&lm70_driver);
-	spi_unregister_driver(&tmp121_driver);
 }
 
 module_init(init_lm70);
-- 
1.6.3.3

^ permalink raw reply related	[flat|nested] 68+ messages in thread

* [PATCH 7/7] hwmon: lm70: Convert to device table matching
@ 2009-07-29 17:05   ` Anton Vorontsov
  0 siblings, 0 replies; 68+ messages in thread
From: Anton Vorontsov @ 2009-07-29 17:05 UTC (permalink / raw)
  To: Andrew Morton
  Cc: David Brownell, linux-kernel, lm-sensors, Grant Likely,
	linuxppc-dev, linux-mtd, Jean Delvare, David Woodhouse

This patch makes the code a little bit nicer, and shorter.

Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com>
---
 drivers/hwmon/lm70.c |   58 +++++++++++++++++--------------------------------
 1 files changed, 20 insertions(+), 38 deletions(-)

diff --git a/drivers/hwmon/lm70.c b/drivers/hwmon/lm70.c
index 3953c22..b4be110 100644
--- a/drivers/hwmon/lm70.c
+++ b/drivers/hwmon/lm70.c
@@ -32,6 +32,7 @@
 #include <linux/sysfs.h>
 #include <linux/hwmon.h>
 #include <linux/mutex.h>
+#include <linux/mod_devicetable.h>
 #include <linux/spi/spi.h>
 
 
@@ -130,11 +131,21 @@ static DEVICE_ATTR(name, S_IRUGO, lm70_show_name, NULL);
 
 /*----------------------------------------------------------------------*/
 
-static int __devinit common_probe(struct spi_device *spi, int chip)
+static int __devinit lm70_probe(struct spi_device *spi,
+				const struct spi_device_id *id)
 {
+	int chip = (int)id->data;
 	struct lm70 *p_lm70;
 	int status;
 
+	/* signaling is SPI_MODE_0 for both LM70 and TMP121 */
+	if (spi->mode & (SPI_CPOL | SPI_CPHA))
+		return -EINVAL;
+
+	/* 3-wire link (shared SI/SO) for LM70 */
+	if (chip == LM70_CHIP_LM70 && !(spi->mode & SPI_3WIRE))
+		return -EINVAL;
+
 	/* NOTE:  we assume 8-bit words, and convert to 16 bits manually */
 
 	p_lm70 = kzalloc(sizeof *p_lm70, GFP_KERNEL);
@@ -170,26 +181,6 @@ out_dev_reg_failed:
 	return status;
 }
 
-static int __devinit lm70_probe(struct spi_device *spi,
-				const struct spi_device_id *id)
-{
-	/* signaling is SPI_MODE_0 on a 3-wire link (shared SI/SO) */
-	if ((spi->mode & (SPI_CPOL | SPI_CPHA)) || !(spi->mode & SPI_3WIRE))
-		return -EINVAL;
-
-	return common_probe(spi, LM70_CHIP_LM70);
-}
-
-static int __devinit tmp121_probe(struct spi_device *spi,
-				  const struct spi_device_id *id)
-{
-	/* signaling is SPI_MODE_0 with only MISO connected */
-	if (spi->mode & (SPI_CPOL | SPI_CPHA))
-		return -EINVAL;
-
-	return common_probe(spi, LM70_CHIP_TMP121);
-}
-
 static int __devexit lm70_remove(struct spi_device *spi)
 {
 	struct lm70 *p_lm70 = dev_get_drvdata(&spi->dev);
@@ -203,41 +194,32 @@ static int __devexit lm70_remove(struct spi_device *spi)
 	return 0;
 }
 
-static struct spi_driver tmp121_driver = {
-	.driver = {
-		.name	= "tmp121",
-		.owner	= THIS_MODULE,
-	},
-	.probe	= tmp121_probe,
-	.remove	= __devexit_p(lm70_remove),
+
+static const struct spi_device_id lm70_ids[] = {
+	{ "lm70",   (void *)LM70_CHIP_LM70 },
+	{ "tmp121", (void *)LM70_CHIP_TMP121 },
+	{ },
 };
+MODULE_DEVICE_TABLE(spi, lm70_ids);
 
 static struct spi_driver lm70_driver = {
 	.driver = {
 		.name	= "lm70",
 		.owner	= THIS_MODULE,
 	},
+	.id_table = lm70_ids,
 	.probe	= lm70_probe,
 	.remove	= __devexit_p(lm70_remove),
 };
 
 static int __init init_lm70(void)
 {
-	int ret = spi_register_driver(&lm70_driver);
-	if (ret)
-		return ret;
-
-	ret = spi_register_driver(&tmp121_driver);
-	if (ret)
-		spi_unregister_driver(&lm70_driver);
-
-	return ret;
+	return spi_register_driver(&lm70_driver);
 }
 
 static void __exit cleanup_lm70(void)
 {
 	spi_unregister_driver(&lm70_driver);
-	spi_unregister_driver(&tmp121_driver);
 }
 
 module_init(init_lm70);
-- 
1.6.3.3

^ permalink raw reply related	[flat|nested] 68+ messages in thread

* [lm-sensors] [PATCH 7/7] hwmon: lm70: Convert to device table
@ 2009-07-29 17:05   ` Anton Vorontsov
  0 siblings, 0 replies; 68+ messages in thread
From: Anton Vorontsov @ 2009-07-29 17:05 UTC (permalink / raw)
  To: Andrew Morton
  Cc: David Brownell, David Woodhouse, Grant Likely, Jean Delvare,
	linux-mtd, linux-kernel, lm-sensors, linuxppc-dev

This patch makes the code a little bit nicer, and shorter.

Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com>
---
 drivers/hwmon/lm70.c |   58 +++++++++++++++++--------------------------------
 1 files changed, 20 insertions(+), 38 deletions(-)

diff --git a/drivers/hwmon/lm70.c b/drivers/hwmon/lm70.c
index 3953c22..b4be110 100644
--- a/drivers/hwmon/lm70.c
+++ b/drivers/hwmon/lm70.c
@@ -32,6 +32,7 @@
 #include <linux/sysfs.h>
 #include <linux/hwmon.h>
 #include <linux/mutex.h>
+#include <linux/mod_devicetable.h>
 #include <linux/spi/spi.h>
 
 
@@ -130,11 +131,21 @@ static DEVICE_ATTR(name, S_IRUGO, lm70_show_name, NULL);
 
 /*----------------------------------------------------------------------*/
 
-static int __devinit common_probe(struct spi_device *spi, int chip)
+static int __devinit lm70_probe(struct spi_device *spi,
+				const struct spi_device_id *id)
 {
+	int chip = (int)id->data;
 	struct lm70 *p_lm70;
 	int status;
 
+	/* signaling is SPI_MODE_0 for both LM70 and TMP121 */
+	if (spi->mode & (SPI_CPOL | SPI_CPHA))
+		return -EINVAL;
+
+	/* 3-wire link (shared SI/SO) for LM70 */
+	if (chip = LM70_CHIP_LM70 && !(spi->mode & SPI_3WIRE))
+		return -EINVAL;
+
 	/* NOTE:  we assume 8-bit words, and convert to 16 bits manually */
 
 	p_lm70 = kzalloc(sizeof *p_lm70, GFP_KERNEL);
@@ -170,26 +181,6 @@ out_dev_reg_failed:
 	return status;
 }
 
-static int __devinit lm70_probe(struct spi_device *spi,
-				const struct spi_device_id *id)
-{
-	/* signaling is SPI_MODE_0 on a 3-wire link (shared SI/SO) */
-	if ((spi->mode & (SPI_CPOL | SPI_CPHA)) || !(spi->mode & SPI_3WIRE))
-		return -EINVAL;
-
-	return common_probe(spi, LM70_CHIP_LM70);
-}
-
-static int __devinit tmp121_probe(struct spi_device *spi,
-				  const struct spi_device_id *id)
-{
-	/* signaling is SPI_MODE_0 with only MISO connected */
-	if (spi->mode & (SPI_CPOL | SPI_CPHA))
-		return -EINVAL;
-
-	return common_probe(spi, LM70_CHIP_TMP121);
-}
-
 static int __devexit lm70_remove(struct spi_device *spi)
 {
 	struct lm70 *p_lm70 = dev_get_drvdata(&spi->dev);
@@ -203,41 +194,32 @@ static int __devexit lm70_remove(struct spi_device *spi)
 	return 0;
 }
 
-static struct spi_driver tmp121_driver = {
-	.driver = {
-		.name	= "tmp121",
-		.owner	= THIS_MODULE,
-	},
-	.probe	= tmp121_probe,
-	.remove	= __devexit_p(lm70_remove),
+
+static const struct spi_device_id lm70_ids[] = {
+	{ "lm70",   (void *)LM70_CHIP_LM70 },
+	{ "tmp121", (void *)LM70_CHIP_TMP121 },
+	{ },
 };
+MODULE_DEVICE_TABLE(spi, lm70_ids);
 
 static struct spi_driver lm70_driver = {
 	.driver = {
 		.name	= "lm70",
 		.owner	= THIS_MODULE,
 	},
+	.id_table = lm70_ids,
 	.probe	= lm70_probe,
 	.remove	= __devexit_p(lm70_remove),
 };
 
 static int __init init_lm70(void)
 {
-	int ret = spi_register_driver(&lm70_driver);
-	if (ret)
-		return ret;
-
-	ret = spi_register_driver(&tmp121_driver);
-	if (ret)
-		spi_unregister_driver(&lm70_driver);
-
-	return ret;
+	return spi_register_driver(&lm70_driver);
 }
 
 static void __exit cleanup_lm70(void)
 {
 	spi_unregister_driver(&lm70_driver);
-	spi_unregister_driver(&tmp121_driver);
 }
 
 module_init(init_lm70);
-- 
1.6.3.3

_______________________________________________
lm-sensors mailing list
lm-sensors@lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

^ permalink raw reply related	[flat|nested] 68+ messages in thread

* Re: [PATCH 1/7] spi: Add support for device table matching
  2009-07-29 17:04   ` Anton Vorontsov
  (?)
  (?)
@ 2009-07-29 21:44     ` Ben Dooks
  -1 siblings, 0 replies; 68+ messages in thread
From: Ben Dooks @ 2009-07-29 21:44 UTC (permalink / raw)
  To: Anton Vorontsov
  Cc: Andrew Morton, David Brownell, David Woodhouse, Grant Likely,
	Jean Delvare, linux-mtd, linux-kernel, lm-sensors, linuxppc-dev

On Wed, Jul 29, 2009 at 09:04:57PM +0400, Anton Vorontsov wrote:
> With this patch spi drivers can use standard spi_driver.id_table and
> MODULE_DEVICE_TABLE() mechanisms to bind against the devices. Just
> like we do with I2C drivers.
> 
> This is useful when a single driver supports several variants of
> devices but it is not possible to detect them in run-time (like
> non-JEDEC chips probing in drivers/mtd/devices/m25p80.c), and
> when platform_data usage is overkill.
> 
> This patch also makes life a lot easier on OpenFirmware platforms,
> since with OF we extensively use proper device IDs in modaliases.
> 
> Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com>
> ---
>  drivers/spi/spi.c               |   26 +++++++++++++++++++++++++-
>  include/linux/mod_devicetable.h |   13 +++++++++++++
>  include/linux/spi/spi.h         |   10 ++++++++--
>  scripts/mod/file2alias.c        |   13 +++++++++++++
>  4 files changed, 59 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c
> index 70845cc..1431bf2 100644
> --- a/drivers/spi/spi.c
> +++ b/drivers/spi/spi.c
> @@ -59,9 +59,24 @@ static struct device_attribute spi_dev_attrs[] = {
>   * and the sysfs version makes coldplug work too.
>   */
>  
> +static const struct spi_device_id *spi_match_id(const struct spi_device_id *id,
> +						const struct spi_device *sdev)
> +{
> +	while (id->name[0]) {
> +		if (!strcmp(sdev->modalias, id->name))
> +			return id;
> +		id++;
> +	}
> +	return NULL;
> +}
> +
>  static int spi_match_device(struct device *dev, struct device_driver *drv)
>  {
>  	const struct spi_device	*spi = to_spi_device(dev);
> +	const struct spi_driver	*sdrv = to_spi_driver(drv);
> +
> +	if (sdrv->id_table)
> +		return !!spi_match_id(sdrv->id_table, spi);
>  
>  	return strcmp(spi->modalias, drv->name) == 0;
>  }
> @@ -121,6 +136,13 @@ struct bus_type spi_bus_type = {
>  };
>  EXPORT_SYMBOL_GPL(spi_bus_type);
>  
> +static int spi_drv_probe_id(struct device *dev)
> +{
> +	const struct spi_driver		*sdrv = to_spi_driver(dev->driver);
> +	struct spi_device		*sdev = to_spi_device(dev);
> +
> +	return sdrv->probe_id(sdev, spi_match_id(sdrv->id_table, sdev));
> +}
>  
>  static int spi_drv_probe(struct device *dev)
>  {
> @@ -151,7 +173,9 @@ static void spi_drv_shutdown(struct device *dev)
>  int spi_register_driver(struct spi_driver *sdrv)
>  {
>  	sdrv->driver.bus = &spi_bus_type;
> -	if (sdrv->probe)
> +	if (sdrv->probe_id)
> +		sdrv->driver.probe = spi_drv_probe_id;
> +	else if (sdrv->probe)
>  		sdrv->driver.probe = spi_drv_probe;
>  	if (sdrv->remove)
>  		sdrv->driver.remove = spi_drv_remove;
> diff --git a/include/linux/mod_devicetable.h b/include/linux/mod_devicetable.h
> index 1bf5900..9660dca 100644
> --- a/include/linux/mod_devicetable.h
> +++ b/include/linux/mod_devicetable.h
> @@ -399,6 +399,19 @@ struct i2c_device_id {
>  			__attribute__((aligned(sizeof(kernel_ulong_t))));
>  };
>  
> +/* spi */
> +
> +#define SPI_NAME_SIZE	20
> +
> +struct spi_device_id {
> +	char name[SPI_NAME_SIZE];
> +#ifdef __KERNEL__
> +	void *data;
> +#else
> +	kernel_ulong_t data;
> +#endif
> +};
> +
>  /* dmi */
>  enum dmi_field {
>  	DMI_NONE,
> diff --git a/include/linux/spi/spi.h b/include/linux/spi/spi.h
> index c47c4b4..c8d92a1 100644
> --- a/include/linux/spi/spi.h
> +++ b/include/linux/spi/spi.h
> @@ -20,6 +20,7 @@
>  #define __LINUX_SPI_H
>  
>  #include <linux/device.h>
> +#include <linux/mod_devicetable.h>
>  
>  /*
>   * INTERFACES between SPI master-side drivers and SPI infrastructure.
> @@ -86,7 +87,7 @@ struct spi_device {
>  	int			irq;
>  	void			*controller_state;
>  	void			*controller_data;
> -	char			modalias[32];
> +	char			modalias[SPI_NAME_SIZE];
>  
>  	/*
>  	 * likely need more hooks for more protocol options affecting how
> @@ -145,6 +146,8 @@ struct spi_message;
>  
>  /**
>   * struct spi_driver - Host side "protocol" driver
> + * @id_table: List of SPI devices supported by this driver
> + * @probe_id: Binds this driver to the spi device via id_table matching.
>   * @probe: Binds this driver to the spi device.  Drivers can verify
>   *	that the device is actually present, and may need to configure
>   *	characteristics (such as bits_per_word) which weren't needed for
> @@ -170,6 +173,9 @@ struct spi_message;
>   * MMC, RTC, filesystem character device nodes, and hardware monitoring.
>   */
>  struct spi_driver {
> +	const struct spi_device_id *id_table;
> +	int			(*probe_id)(struct spi_device *spi,
> +					    const struct spi_device_id *id);

how about leaving it at just probe and have either a call or a field
in the device that you can look at to see if this was a new style of
call?

>  	int			(*probe)(struct spi_device *spi);
>  	int			(*remove)(struct spi_device *spi);
>  	void			(*shutdown)(struct spi_device *spi);
> @@ -732,7 +738,7 @@ struct spi_board_info {
>  	 * controller_data goes to spi_device.controller_data,
>  	 * irq is copied too
>  	 */
> -	char		modalias[32];
> +	char		modalias[SPI_NAME_SIZE];
>  	const void	*platform_data;
>  	void		*controller_data;
>  	int		irq;
> diff --git a/scripts/mod/file2alias.c b/scripts/mod/file2alias.c
> index 40e0045..9d446e3 100644
> --- a/scripts/mod/file2alias.c
> +++ b/scripts/mod/file2alias.c
> @@ -657,6 +657,15 @@ static int do_i2c_entry(const char *filename, struct i2c_device_id *id,
>  	return 1;
>  }
>  
> +/* Looks like: S */
> +static int do_spi_entry(const char *filename, struct spi_device_id *id,
> +			char *alias)
> +{
> +	sprintf(alias, "%s", id->name);
> +
> +	return 1;
> +}
> +
>  static const struct dmifield {
>  	const char *prefix;
>  	int field;
> @@ -853,6 +862,10 @@ void handle_moddevtable(struct module *mod, struct elf_info *info,
>  		do_table(symval, sym->st_size,
>  			 sizeof(struct i2c_device_id), "i2c",
>  			 do_i2c_entry, mod);
> +	else if (sym_is(symname, "__mod_spi_device_table"))
> +		do_table(symval, sym->st_size,
> +			 sizeof(struct spi_device_id), "spi",
> +			 do_spi_entry, mod);
>  	else if (sym_is(symname, "__mod_dmi_device_table"))
>  		do_table(symval, sym->st_size,
>  			 sizeof(struct dmi_system_id), "dmi",
> -- 
> 1.6.3.3
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/

-- 
Ben (ben@fluff.org, http://www.fluff.org/)

  'a smiley only costs 4 bytes'

^ permalink raw reply	[flat|nested] 68+ messages in thread

* Re: [PATCH 1/7] spi: Add support for device table matching
@ 2009-07-29 21:44     ` Ben Dooks
  0 siblings, 0 replies; 68+ messages in thread
From: Ben Dooks @ 2009-07-29 21:44 UTC (permalink / raw)
  To: Anton Vorontsov
  Cc: David Brownell, linux-kernel, lm-sensors, linuxppc-dev,
	linux-mtd, Jean Delvare, Andrew Morton, David Woodhouse

On Wed, Jul 29, 2009 at 09:04:57PM +0400, Anton Vorontsov wrote:
> With this patch spi drivers can use standard spi_driver.id_table and
> MODULE_DEVICE_TABLE() mechanisms to bind against the devices. Just
> like we do with I2C drivers.
> 
> This is useful when a single driver supports several variants of
> devices but it is not possible to detect them in run-time (like
> non-JEDEC chips probing in drivers/mtd/devices/m25p80.c), and
> when platform_data usage is overkill.
> 
> This patch also makes life a lot easier on OpenFirmware platforms,
> since with OF we extensively use proper device IDs in modaliases.
> 
> Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com>
> ---
>  drivers/spi/spi.c               |   26 +++++++++++++++++++++++++-
>  include/linux/mod_devicetable.h |   13 +++++++++++++
>  include/linux/spi/spi.h         |   10 ++++++++--
>  scripts/mod/file2alias.c        |   13 +++++++++++++
>  4 files changed, 59 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c
> index 70845cc..1431bf2 100644
> --- a/drivers/spi/spi.c
> +++ b/drivers/spi/spi.c
> @@ -59,9 +59,24 @@ static struct device_attribute spi_dev_attrs[] = {
>   * and the sysfs version makes coldplug work too.
>   */
>  
> +static const struct spi_device_id *spi_match_id(const struct spi_device_id *id,
> +						const struct spi_device *sdev)
> +{
> +	while (id->name[0]) {
> +		if (!strcmp(sdev->modalias, id->name))
> +			return id;
> +		id++;
> +	}
> +	return NULL;
> +}
> +
>  static int spi_match_device(struct device *dev, struct device_driver *drv)
>  {
>  	const struct spi_device	*spi = to_spi_device(dev);
> +	const struct spi_driver	*sdrv = to_spi_driver(drv);
> +
> +	if (sdrv->id_table)
> +		return !!spi_match_id(sdrv->id_table, spi);
>  
>  	return strcmp(spi->modalias, drv->name) == 0;
>  }
> @@ -121,6 +136,13 @@ struct bus_type spi_bus_type = {
>  };
>  EXPORT_SYMBOL_GPL(spi_bus_type);
>  
> +static int spi_drv_probe_id(struct device *dev)
> +{
> +	const struct spi_driver		*sdrv = to_spi_driver(dev->driver);
> +	struct spi_device		*sdev = to_spi_device(dev);
> +
> +	return sdrv->probe_id(sdev, spi_match_id(sdrv->id_table, sdev));
> +}
>  
>  static int spi_drv_probe(struct device *dev)
>  {
> @@ -151,7 +173,9 @@ static void spi_drv_shutdown(struct device *dev)
>  int spi_register_driver(struct spi_driver *sdrv)
>  {
>  	sdrv->driver.bus = &spi_bus_type;
> -	if (sdrv->probe)
> +	if (sdrv->probe_id)
> +		sdrv->driver.probe = spi_drv_probe_id;
> +	else if (sdrv->probe)
>  		sdrv->driver.probe = spi_drv_probe;
>  	if (sdrv->remove)
>  		sdrv->driver.remove = spi_drv_remove;
> diff --git a/include/linux/mod_devicetable.h b/include/linux/mod_devicetable.h
> index 1bf5900..9660dca 100644
> --- a/include/linux/mod_devicetable.h
> +++ b/include/linux/mod_devicetable.h
> @@ -399,6 +399,19 @@ struct i2c_device_id {
>  			__attribute__((aligned(sizeof(kernel_ulong_t))));
>  };
>  
> +/* spi */
> +
> +#define SPI_NAME_SIZE	20
> +
> +struct spi_device_id {
> +	char name[SPI_NAME_SIZE];
> +#ifdef __KERNEL__
> +	void *data;
> +#else
> +	kernel_ulong_t data;
> +#endif
> +};
> +
>  /* dmi */
>  enum dmi_field {
>  	DMI_NONE,
> diff --git a/include/linux/spi/spi.h b/include/linux/spi/spi.h
> index c47c4b4..c8d92a1 100644
> --- a/include/linux/spi/spi.h
> +++ b/include/linux/spi/spi.h
> @@ -20,6 +20,7 @@
>  #define __LINUX_SPI_H
>  
>  #include <linux/device.h>
> +#include <linux/mod_devicetable.h>
>  
>  /*
>   * INTERFACES between SPI master-side drivers and SPI infrastructure.
> @@ -86,7 +87,7 @@ struct spi_device {
>  	int			irq;
>  	void			*controller_state;
>  	void			*controller_data;
> -	char			modalias[32];
> +	char			modalias[SPI_NAME_SIZE];
>  
>  	/*
>  	 * likely need more hooks for more protocol options affecting how
> @@ -145,6 +146,8 @@ struct spi_message;
>  
>  /**
>   * struct spi_driver - Host side "protocol" driver
> + * @id_table: List of SPI devices supported by this driver
> + * @probe_id: Binds this driver to the spi device via id_table matching.
>   * @probe: Binds this driver to the spi device.  Drivers can verify
>   *	that the device is actually present, and may need to configure
>   *	characteristics (such as bits_per_word) which weren't needed for
> @@ -170,6 +173,9 @@ struct spi_message;
>   * MMC, RTC, filesystem character device nodes, and hardware monitoring.
>   */
>  struct spi_driver {
> +	const struct spi_device_id *id_table;
> +	int			(*probe_id)(struct spi_device *spi,
> +					    const struct spi_device_id *id);

how about leaving it at just probe and have either a call or a field
in the device that you can look at to see if this was a new style of
call?

>  	int			(*probe)(struct spi_device *spi);
>  	int			(*remove)(struct spi_device *spi);
>  	void			(*shutdown)(struct spi_device *spi);
> @@ -732,7 +738,7 @@ struct spi_board_info {
>  	 * controller_data goes to spi_device.controller_data,
>  	 * irq is copied too
>  	 */
> -	char		modalias[32];
> +	char		modalias[SPI_NAME_SIZE];
>  	const void	*platform_data;
>  	void		*controller_data;
>  	int		irq;
> diff --git a/scripts/mod/file2alias.c b/scripts/mod/file2alias.c
> index 40e0045..9d446e3 100644
> --- a/scripts/mod/file2alias.c
> +++ b/scripts/mod/file2alias.c
> @@ -657,6 +657,15 @@ static int do_i2c_entry(const char *filename, struct i2c_device_id *id,
>  	return 1;
>  }
>  
> +/* Looks like: S */
> +static int do_spi_entry(const char *filename, struct spi_device_id *id,
> +			char *alias)
> +{
> +	sprintf(alias, "%s", id->name);
> +
> +	return 1;
> +}
> +
>  static const struct dmifield {
>  	const char *prefix;
>  	int field;
> @@ -853,6 +862,10 @@ void handle_moddevtable(struct module *mod, struct elf_info *info,
>  		do_table(symval, sym->st_size,
>  			 sizeof(struct i2c_device_id), "i2c",
>  			 do_i2c_entry, mod);
> +	else if (sym_is(symname, "__mod_spi_device_table"))
> +		do_table(symval, sym->st_size,
> +			 sizeof(struct spi_device_id), "spi",
> +			 do_spi_entry, mod);
>  	else if (sym_is(symname, "__mod_dmi_device_table"))
>  		do_table(symval, sym->st_size,
>  			 sizeof(struct dmi_system_id), "dmi",
> -- 
> 1.6.3.3
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/

-- 
Ben (ben@fluff.org, http://www.fluff.org/)

  'a smiley only costs 4 bytes'

^ permalink raw reply	[flat|nested] 68+ messages in thread

* Re: [PATCH 1/7] spi: Add support for device table matching
@ 2009-07-29 21:44     ` Ben Dooks
  0 siblings, 0 replies; 68+ messages in thread
From: Ben Dooks @ 2009-07-29 21:44 UTC (permalink / raw)
  To: Anton Vorontsov
  Cc: David Brownell, linux-kernel, lm-sensors, Grant Likely,
	linuxppc-dev, linux-mtd, Jean Delvare, Andrew Morton,
	David Woodhouse

On Wed, Jul 29, 2009 at 09:04:57PM +0400, Anton Vorontsov wrote:
> With this patch spi drivers can use standard spi_driver.id_table and
> MODULE_DEVICE_TABLE() mechanisms to bind against the devices. Just
> like we do with I2C drivers.
> 
> This is useful when a single driver supports several variants of
> devices but it is not possible to detect them in run-time (like
> non-JEDEC chips probing in drivers/mtd/devices/m25p80.c), and
> when platform_data usage is overkill.
> 
> This patch also makes life a lot easier on OpenFirmware platforms,
> since with OF we extensively use proper device IDs in modaliases.
> 
> Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com>
> ---
>  drivers/spi/spi.c               |   26 +++++++++++++++++++++++++-
>  include/linux/mod_devicetable.h |   13 +++++++++++++
>  include/linux/spi/spi.h         |   10 ++++++++--
>  scripts/mod/file2alias.c        |   13 +++++++++++++
>  4 files changed, 59 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c
> index 70845cc..1431bf2 100644
> --- a/drivers/spi/spi.c
> +++ b/drivers/spi/spi.c
> @@ -59,9 +59,24 @@ static struct device_attribute spi_dev_attrs[] = {
>   * and the sysfs version makes coldplug work too.
>   */
>  
> +static const struct spi_device_id *spi_match_id(const struct spi_device_id *id,
> +						const struct spi_device *sdev)
> +{
> +	while (id->name[0]) {
> +		if (!strcmp(sdev->modalias, id->name))
> +			return id;
> +		id++;
> +	}
> +	return NULL;
> +}
> +
>  static int spi_match_device(struct device *dev, struct device_driver *drv)
>  {
>  	const struct spi_device	*spi = to_spi_device(dev);
> +	const struct spi_driver	*sdrv = to_spi_driver(drv);
> +
> +	if (sdrv->id_table)
> +		return !!spi_match_id(sdrv->id_table, spi);
>  
>  	return strcmp(spi->modalias, drv->name) == 0;
>  }
> @@ -121,6 +136,13 @@ struct bus_type spi_bus_type = {
>  };
>  EXPORT_SYMBOL_GPL(spi_bus_type);
>  
> +static int spi_drv_probe_id(struct device *dev)
> +{
> +	const struct spi_driver		*sdrv = to_spi_driver(dev->driver);
> +	struct spi_device		*sdev = to_spi_device(dev);
> +
> +	return sdrv->probe_id(sdev, spi_match_id(sdrv->id_table, sdev));
> +}
>  
>  static int spi_drv_probe(struct device *dev)
>  {
> @@ -151,7 +173,9 @@ static void spi_drv_shutdown(struct device *dev)
>  int spi_register_driver(struct spi_driver *sdrv)
>  {
>  	sdrv->driver.bus = &spi_bus_type;
> -	if (sdrv->probe)
> +	if (sdrv->probe_id)
> +		sdrv->driver.probe = spi_drv_probe_id;
> +	else if (sdrv->probe)
>  		sdrv->driver.probe = spi_drv_probe;
>  	if (sdrv->remove)
>  		sdrv->driver.remove = spi_drv_remove;
> diff --git a/include/linux/mod_devicetable.h b/include/linux/mod_devicetable.h
> index 1bf5900..9660dca 100644
> --- a/include/linux/mod_devicetable.h
> +++ b/include/linux/mod_devicetable.h
> @@ -399,6 +399,19 @@ struct i2c_device_id {
>  			__attribute__((aligned(sizeof(kernel_ulong_t))));
>  };
>  
> +/* spi */
> +
> +#define SPI_NAME_SIZE	20
> +
> +struct spi_device_id {
> +	char name[SPI_NAME_SIZE];
> +#ifdef __KERNEL__
> +	void *data;
> +#else
> +	kernel_ulong_t data;
> +#endif
> +};
> +
>  /* dmi */
>  enum dmi_field {
>  	DMI_NONE,
> diff --git a/include/linux/spi/spi.h b/include/linux/spi/spi.h
> index c47c4b4..c8d92a1 100644
> --- a/include/linux/spi/spi.h
> +++ b/include/linux/spi/spi.h
> @@ -20,6 +20,7 @@
>  #define __LINUX_SPI_H
>  
>  #include <linux/device.h>
> +#include <linux/mod_devicetable.h>
>  
>  /*
>   * INTERFACES between SPI master-side drivers and SPI infrastructure.
> @@ -86,7 +87,7 @@ struct spi_device {
>  	int			irq;
>  	void			*controller_state;
>  	void			*controller_data;
> -	char			modalias[32];
> +	char			modalias[SPI_NAME_SIZE];
>  
>  	/*
>  	 * likely need more hooks for more protocol options affecting how
> @@ -145,6 +146,8 @@ struct spi_message;
>  
>  /**
>   * struct spi_driver - Host side "protocol" driver
> + * @id_table: List of SPI devices supported by this driver
> + * @probe_id: Binds this driver to the spi device via id_table matching.
>   * @probe: Binds this driver to the spi device.  Drivers can verify
>   *	that the device is actually present, and may need to configure
>   *	characteristics (such as bits_per_word) which weren't needed for
> @@ -170,6 +173,9 @@ struct spi_message;
>   * MMC, RTC, filesystem character device nodes, and hardware monitoring.
>   */
>  struct spi_driver {
> +	const struct spi_device_id *id_table;
> +	int			(*probe_id)(struct spi_device *spi,
> +					    const struct spi_device_id *id);

how about leaving it at just probe and have either a call or a field
in the device that you can look at to see if this was a new style of
call?

>  	int			(*probe)(struct spi_device *spi);
>  	int			(*remove)(struct spi_device *spi);
>  	void			(*shutdown)(struct spi_device *spi);
> @@ -732,7 +738,7 @@ struct spi_board_info {
>  	 * controller_data goes to spi_device.controller_data,
>  	 * irq is copied too
>  	 */
> -	char		modalias[32];
> +	char		modalias[SPI_NAME_SIZE];
>  	const void	*platform_data;
>  	void		*controller_data;
>  	int		irq;
> diff --git a/scripts/mod/file2alias.c b/scripts/mod/file2alias.c
> index 40e0045..9d446e3 100644
> --- a/scripts/mod/file2alias.c
> +++ b/scripts/mod/file2alias.c
> @@ -657,6 +657,15 @@ static int do_i2c_entry(const char *filename, struct i2c_device_id *id,
>  	return 1;
>  }
>  
> +/* Looks like: S */
> +static int do_spi_entry(const char *filename, struct spi_device_id *id,
> +			char *alias)
> +{
> +	sprintf(alias, "%s", id->name);
> +
> +	return 1;
> +}
> +
>  static const struct dmifield {
>  	const char *prefix;
>  	int field;
> @@ -853,6 +862,10 @@ void handle_moddevtable(struct module *mod, struct elf_info *info,
>  		do_table(symval, sym->st_size,
>  			 sizeof(struct i2c_device_id), "i2c",
>  			 do_i2c_entry, mod);
> +	else if (sym_is(symname, "__mod_spi_device_table"))
> +		do_table(symval, sym->st_size,
> +			 sizeof(struct spi_device_id), "spi",
> +			 do_spi_entry, mod);
>  	else if (sym_is(symname, "__mod_dmi_device_table"))
>  		do_table(symval, sym->st_size,
>  			 sizeof(struct dmi_system_id), "dmi",
> -- 
> 1.6.3.3
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/

-- 
Ben (ben@fluff.org, http://www.fluff.org/)

  'a smiley only costs 4 bytes'

^ permalink raw reply	[flat|nested] 68+ messages in thread

* Re: [lm-sensors] [PATCH 1/7] spi: Add support for device table
@ 2009-07-29 21:44     ` Ben Dooks
  0 siblings, 0 replies; 68+ messages in thread
From: Ben Dooks @ 2009-07-29 21:44 UTC (permalink / raw)
  To: Anton Vorontsov
  Cc: Andrew Morton, David Brownell, David Woodhouse, Grant Likely,
	Jean Delvare, linux-mtd, linux-kernel, lm-sensors, linuxppc-dev

On Wed, Jul 29, 2009 at 09:04:57PM +0400, Anton Vorontsov wrote:
> With this patch spi drivers can use standard spi_driver.id_table and
> MODULE_DEVICE_TABLE() mechanisms to bind against the devices. Just
> like we do with I2C drivers.
> 
> This is useful when a single driver supports several variants of
> devices but it is not possible to detect them in run-time (like
> non-JEDEC chips probing in drivers/mtd/devices/m25p80.c), and
> when platform_data usage is overkill.
> 
> This patch also makes life a lot easier on OpenFirmware platforms,
> since with OF we extensively use proper device IDs in modaliases.
> 
> Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com>
> ---
>  drivers/spi/spi.c               |   26 +++++++++++++++++++++++++-
>  include/linux/mod_devicetable.h |   13 +++++++++++++
>  include/linux/spi/spi.h         |   10 ++++++++--
>  scripts/mod/file2alias.c        |   13 +++++++++++++
>  4 files changed, 59 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c
> index 70845cc..1431bf2 100644
> --- a/drivers/spi/spi.c
> +++ b/drivers/spi/spi.c
> @@ -59,9 +59,24 @@ static struct device_attribute spi_dev_attrs[] = {
>   * and the sysfs version makes coldplug work too.
>   */
>  
> +static const struct spi_device_id *spi_match_id(const struct spi_device_id *id,
> +						const struct spi_device *sdev)
> +{
> +	while (id->name[0]) {
> +		if (!strcmp(sdev->modalias, id->name))
> +			return id;
> +		id++;
> +	}
> +	return NULL;
> +}
> +
>  static int spi_match_device(struct device *dev, struct device_driver *drv)
>  {
>  	const struct spi_device	*spi = to_spi_device(dev);
> +	const struct spi_driver	*sdrv = to_spi_driver(drv);
> +
> +	if (sdrv->id_table)
> +		return !!spi_match_id(sdrv->id_table, spi);
>  
>  	return strcmp(spi->modalias, drv->name) = 0;
>  }
> @@ -121,6 +136,13 @@ struct bus_type spi_bus_type = {
>  };
>  EXPORT_SYMBOL_GPL(spi_bus_type);
>  
> +static int spi_drv_probe_id(struct device *dev)
> +{
> +	const struct spi_driver		*sdrv = to_spi_driver(dev->driver);
> +	struct spi_device		*sdev = to_spi_device(dev);
> +
> +	return sdrv->probe_id(sdev, spi_match_id(sdrv->id_table, sdev));
> +}
>  
>  static int spi_drv_probe(struct device *dev)
>  {
> @@ -151,7 +173,9 @@ static void spi_drv_shutdown(struct device *dev)
>  int spi_register_driver(struct spi_driver *sdrv)
>  {
>  	sdrv->driver.bus = &spi_bus_type;
> -	if (sdrv->probe)
> +	if (sdrv->probe_id)
> +		sdrv->driver.probe = spi_drv_probe_id;
> +	else if (sdrv->probe)
>  		sdrv->driver.probe = spi_drv_probe;
>  	if (sdrv->remove)
>  		sdrv->driver.remove = spi_drv_remove;
> diff --git a/include/linux/mod_devicetable.h b/include/linux/mod_devicetable.h
> index 1bf5900..9660dca 100644
> --- a/include/linux/mod_devicetable.h
> +++ b/include/linux/mod_devicetable.h
> @@ -399,6 +399,19 @@ struct i2c_device_id {
>  			__attribute__((aligned(sizeof(kernel_ulong_t))));
>  };
>  
> +/* spi */
> +
> +#define SPI_NAME_SIZE	20
> +
> +struct spi_device_id {
> +	char name[SPI_NAME_SIZE];
> +#ifdef __KERNEL__
> +	void *data;
> +#else
> +	kernel_ulong_t data;
> +#endif
> +};
> +
>  /* dmi */
>  enum dmi_field {
>  	DMI_NONE,
> diff --git a/include/linux/spi/spi.h b/include/linux/spi/spi.h
> index c47c4b4..c8d92a1 100644
> --- a/include/linux/spi/spi.h
> +++ b/include/linux/spi/spi.h
> @@ -20,6 +20,7 @@
>  #define __LINUX_SPI_H
>  
>  #include <linux/device.h>
> +#include <linux/mod_devicetable.h>
>  
>  /*
>   * INTERFACES between SPI master-side drivers and SPI infrastructure.
> @@ -86,7 +87,7 @@ struct spi_device {
>  	int			irq;
>  	void			*controller_state;
>  	void			*controller_data;
> -	char			modalias[32];
> +	char			modalias[SPI_NAME_SIZE];
>  
>  	/*
>  	 * likely need more hooks for more protocol options affecting how
> @@ -145,6 +146,8 @@ struct spi_message;
>  
>  /**
>   * struct spi_driver - Host side "protocol" driver
> + * @id_table: List of SPI devices supported by this driver
> + * @probe_id: Binds this driver to the spi device via id_table matching.
>   * @probe: Binds this driver to the spi device.  Drivers can verify
>   *	that the device is actually present, and may need to configure
>   *	characteristics (such as bits_per_word) which weren't needed for
> @@ -170,6 +173,9 @@ struct spi_message;
>   * MMC, RTC, filesystem character device nodes, and hardware monitoring.
>   */
>  struct spi_driver {
> +	const struct spi_device_id *id_table;
> +	int			(*probe_id)(struct spi_device *spi,
> +					    const struct spi_device_id *id);

how about leaving it at just probe and have either a call or a field
in the device that you can look at to see if this was a new style of
call?

>  	int			(*probe)(struct spi_device *spi);
>  	int			(*remove)(struct spi_device *spi);
>  	void			(*shutdown)(struct spi_device *spi);
> @@ -732,7 +738,7 @@ struct spi_board_info {
>  	 * controller_data goes to spi_device.controller_data,
>  	 * irq is copied too
>  	 */
> -	char		modalias[32];
> +	char		modalias[SPI_NAME_SIZE];
>  	const void	*platform_data;
>  	void		*controller_data;
>  	int		irq;
> diff --git a/scripts/mod/file2alias.c b/scripts/mod/file2alias.c
> index 40e0045..9d446e3 100644
> --- a/scripts/mod/file2alias.c
> +++ b/scripts/mod/file2alias.c
> @@ -657,6 +657,15 @@ static int do_i2c_entry(const char *filename, struct i2c_device_id *id,
>  	return 1;
>  }
>  
> +/* Looks like: S */
> +static int do_spi_entry(const char *filename, struct spi_device_id *id,
> +			char *alias)
> +{
> +	sprintf(alias, "%s", id->name);
> +
> +	return 1;
> +}
> +
>  static const struct dmifield {
>  	const char *prefix;
>  	int field;
> @@ -853,6 +862,10 @@ void handle_moddevtable(struct module *mod, struct elf_info *info,
>  		do_table(symval, sym->st_size,
>  			 sizeof(struct i2c_device_id), "i2c",
>  			 do_i2c_entry, mod);
> +	else if (sym_is(symname, "__mod_spi_device_table"))
> +		do_table(symval, sym->st_size,
> +			 sizeof(struct spi_device_id), "spi",
> +			 do_spi_entry, mod);
>  	else if (sym_is(symname, "__mod_dmi_device_table"))
>  		do_table(symval, sym->st_size,
>  			 sizeof(struct dmi_system_id), "dmi",
> -- 
> 1.6.3.3
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/

-- 
Ben (ben@fluff.org, http://www.fluff.org/)

  'a smiley only costs 4 bytes'

_______________________________________________
lm-sensors mailing list
lm-sensors@lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

^ permalink raw reply	[flat|nested] 68+ messages in thread

* Re: [PATCH 1/7] spi: Add support for device table matching
  2009-07-29 21:44     ` Ben Dooks
  (?)
  (?)
@ 2009-07-29 22:32       ` Anton Vorontsov
  -1 siblings, 0 replies; 68+ messages in thread
From: Anton Vorontsov @ 2009-07-29 22:32 UTC (permalink / raw)
  To: Ben Dooks
  Cc: Andrew Morton, David Brownell, David Woodhouse, Grant Likely,
	Jean Delvare, linux-mtd, linux-kernel, lm-sensors, linuxppc-dev

On Wed, Jul 29, 2009 at 10:44:46PM +0100, Ben Dooks wrote:
[...]
> > +	const struct spi_device_id *id_table;
> > +	int			(*probe_id)(struct spi_device *spi,
> > +					    const struct spi_device_id *id);
> 
> how about leaving it at just probe and have either a call or a field
> in the device that you can look at to see if this was a new style of
> call?

There are no technical difficulties with that, but it would be
inconsitent wrt other "device table"-aware buses (i2c, pci, of).

Note that I'm getting rid of probe_id function in patch 5/7, as a
cleanup step. I want to keep "new features" and "api cleanups"
separate. That way it's easier to review the changes.

Thanks!

-- 
Anton Vorontsov
email: cbouatmailru@gmail.com
irc://irc.freenode.net/bd2

^ permalink raw reply	[flat|nested] 68+ messages in thread

* Re: [PATCH 1/7] spi: Add support for device table matching
@ 2009-07-29 22:32       ` Anton Vorontsov
  0 siblings, 0 replies; 68+ messages in thread
From: Anton Vorontsov @ 2009-07-29 22:32 UTC (permalink / raw)
  To: Ben Dooks
  Cc: David Brownell, linux-kernel, lm-sensors, linuxppc-dev,
	linux-mtd, Jean Delvare, Andrew Morton, David Woodhouse

On Wed, Jul 29, 2009 at 10:44:46PM +0100, Ben Dooks wrote:
[...]
> > +	const struct spi_device_id *id_table;
> > +	int			(*probe_id)(struct spi_device *spi,
> > +					    const struct spi_device_id *id);
> 
> how about leaving it at just probe and have either a call or a field
> in the device that you can look at to see if this was a new style of
> call?

There are no technical difficulties with that, but it would be
inconsitent wrt other "device table"-aware buses (i2c, pci, of).

Note that I'm getting rid of probe_id function in patch 5/7, as a
cleanup step. I want to keep "new features" and "api cleanups"
separate. That way it's easier to review the changes.

Thanks!

-- 
Anton Vorontsov
email: cbouatmailru@gmail.com
irc://irc.freenode.net/bd2

^ permalink raw reply	[flat|nested] 68+ messages in thread

* Re: [PATCH 1/7] spi: Add support for device table matching
@ 2009-07-29 22:32       ` Anton Vorontsov
  0 siblings, 0 replies; 68+ messages in thread
From: Anton Vorontsov @ 2009-07-29 22:32 UTC (permalink / raw)
  To: Ben Dooks
  Cc: David Brownell, linux-kernel, lm-sensors, Grant Likely,
	linuxppc-dev, linux-mtd, Jean Delvare, Andrew Morton,
	David Woodhouse

On Wed, Jul 29, 2009 at 10:44:46PM +0100, Ben Dooks wrote:
[...]
> > +	const struct spi_device_id *id_table;
> > +	int			(*probe_id)(struct spi_device *spi,
> > +					    const struct spi_device_id *id);
> 
> how about leaving it at just probe and have either a call or a field
> in the device that you can look at to see if this was a new style of
> call?

There are no technical difficulties with that, but it would be
inconsitent wrt other "device table"-aware buses (i2c, pci, of).

Note that I'm getting rid of probe_id function in patch 5/7, as a
cleanup step. I want to keep "new features" and "api cleanups"
separate. That way it's easier to review the changes.

Thanks!

-- 
Anton Vorontsov
email: cbouatmailru@gmail.com
irc://irc.freenode.net/bd2

^ permalink raw reply	[flat|nested] 68+ messages in thread

* Re: [lm-sensors] [PATCH 1/7] spi: Add support for device table
@ 2009-07-29 22:32       ` Anton Vorontsov
  0 siblings, 0 replies; 68+ messages in thread
From: Anton Vorontsov @ 2009-07-29 22:32 UTC (permalink / raw)
  To: Ben Dooks
  Cc: Andrew Morton, David Brownell, David Woodhouse, Grant Likely,
	Jean Delvare, linux-mtd, linux-kernel, lm-sensors, linuxppc-dev

On Wed, Jul 29, 2009 at 10:44:46PM +0100, Ben Dooks wrote:
[...]
> > +	const struct spi_device_id *id_table;
> > +	int			(*probe_id)(struct spi_device *spi,
> > +					    const struct spi_device_id *id);
> 
> how about leaving it at just probe and have either a call or a field
> in the device that you can look at to see if this was a new style of
> call?

There are no technical difficulties with that, but it would be
inconsitent wrt other "device table"-aware buses (i2c, pci, of).

Note that I'm getting rid of probe_id function in patch 5/7, as a
cleanup step. I want to keep "new features" and "api cleanups"
separate. That way it's easier to review the changes.

Thanks!

-- 
Anton Vorontsov
email: cbouatmailru@gmail.com
irc://irc.freenode.net/bd2

_______________________________________________
lm-sensors mailing list
lm-sensors@lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

^ permalink raw reply	[flat|nested] 68+ messages in thread

* Re: [PATCH 1/7] spi: Add support for device table matching
  2009-07-29 22:32       ` Anton Vorontsov
  (?)
  (?)
@ 2009-07-29 22:40         ` Anton Vorontsov
  -1 siblings, 0 replies; 68+ messages in thread
From: Anton Vorontsov @ 2009-07-29 22:40 UTC (permalink / raw)
  To: Ben Dooks
  Cc: Andrew Morton, David Brownell, David Woodhouse, Grant Likely,
	Jean Delvare, linux-mtd, linux-kernel, lm-sensors, linuxppc-dev

On Thu, Jul 30, 2009 at 02:32:23AM +0400, Anton Vorontsov wrote:
> On Wed, Jul 29, 2009 at 10:44:46PM +0100, Ben Dooks wrote:
> [...]
> > > +	const struct spi_device_id *id_table;
> > > +	int			(*probe_id)(struct spi_device *spi,
> > > +					    const struct spi_device_id *id);
> > 
> > how about leaving it at just probe and have either a call or a field
> > in the device that you can look at to see if this was a new style of
> > call?
> 
> There are no technical difficulties with that, but it would be
> inconsitent wrt other "device table"-aware buses (i2c, pci, of).

Btw, I guess there are few reasons why other buses pass id via
probe() call:

- You'll have to store the "id" in device struct forever, while
  in most cases you only need it during probe(), then you don't
  need it at all;

- If you don't store "id" in the device struct, you'll have
  to look up the device table twice (at first during bus->match(),
  and second time in drivers' probe() hook, i.e.
  probe(struct bus_dev *dev) {
  	id = bus_get_devid(dev); /* here */
  }

-- 
Anton Vorontsov
email: cbouatmailru@gmail.com
irc://irc.freenode.net/bd2

^ permalink raw reply	[flat|nested] 68+ messages in thread

* Re: [PATCH 1/7] spi: Add support for device table matching
@ 2009-07-29 22:40         ` Anton Vorontsov
  0 siblings, 0 replies; 68+ messages in thread
From: Anton Vorontsov @ 2009-07-29 22:40 UTC (permalink / raw)
  To: Ben Dooks
  Cc: David Brownell, linux-kernel, lm-sensors, linuxppc-dev,
	linux-mtd, Jean Delvare, Andrew Morton, David Woodhouse

On Thu, Jul 30, 2009 at 02:32:23AM +0400, Anton Vorontsov wrote:
> On Wed, Jul 29, 2009 at 10:44:46PM +0100, Ben Dooks wrote:
> [...]
> > > +	const struct spi_device_id *id_table;
> > > +	int			(*probe_id)(struct spi_device *spi,
> > > +					    const struct spi_device_id *id);
> > 
> > how about leaving it at just probe and have either a call or a field
> > in the device that you can look at to see if this was a new style of
> > call?
> 
> There are no technical difficulties with that, but it would be
> inconsitent wrt other "device table"-aware buses (i2c, pci, of).

Btw, I guess there are few reasons why other buses pass id via
probe() call:

- You'll have to store the "id" in device struct forever, while
  in most cases you only need it during probe(), then you don't
  need it at all;

- If you don't store "id" in the device struct, you'll have
  to look up the device table twice (at first during bus->match(),
  and second time in drivers' probe() hook, i.e.
  probe(struct bus_dev *dev) {
  	id = bus_get_devid(dev); /* here */
  }

-- 
Anton Vorontsov
email: cbouatmailru@gmail.com
irc://irc.freenode.net/bd2

^ permalink raw reply	[flat|nested] 68+ messages in thread

* Re: [PATCH 1/7] spi: Add support for device table matching
@ 2009-07-29 22:40         ` Anton Vorontsov
  0 siblings, 0 replies; 68+ messages in thread
From: Anton Vorontsov @ 2009-07-29 22:40 UTC (permalink / raw)
  To: Ben Dooks
  Cc: David Brownell, linux-kernel, lm-sensors, Grant Likely,
	linuxppc-dev, linux-mtd, Jean Delvare, Andrew Morton,
	David Woodhouse

On Thu, Jul 30, 2009 at 02:32:23AM +0400, Anton Vorontsov wrote:
> On Wed, Jul 29, 2009 at 10:44:46PM +0100, Ben Dooks wrote:
> [...]
> > > +	const struct spi_device_id *id_table;
> > > +	int			(*probe_id)(struct spi_device *spi,
> > > +					    const struct spi_device_id *id);
> > 
> > how about leaving it at just probe and have either a call or a field
> > in the device that you can look at to see if this was a new style of
> > call?
> 
> There are no technical difficulties with that, but it would be
> inconsitent wrt other "device table"-aware buses (i2c, pci, of).

Btw, I guess there are few reasons why other buses pass id via
probe() call:

- You'll have to store the "id" in device struct forever, while
  in most cases you only need it during probe(), then you don't
  need it at all;

- If you don't store "id" in the device struct, you'll have
  to look up the device table twice (at first during bus->match(),
  and second time in drivers' probe() hook, i.e.
  probe(struct bus_dev *dev) {
  	id = bus_get_devid(dev); /* here */
  }

-- 
Anton Vorontsov
email: cbouatmailru@gmail.com
irc://irc.freenode.net/bd2

^ permalink raw reply	[flat|nested] 68+ messages in thread

* Re: [lm-sensors] [PATCH 1/7] spi: Add support for device table
@ 2009-07-29 22:40         ` Anton Vorontsov
  0 siblings, 0 replies; 68+ messages in thread
From: Anton Vorontsov @ 2009-07-29 22:40 UTC (permalink / raw)
  To: Ben Dooks
  Cc: Andrew Morton, David Brownell, David Woodhouse, Grant Likely,
	Jean Delvare, linux-mtd, linux-kernel, lm-sensors, linuxppc-dev

On Thu, Jul 30, 2009 at 02:32:23AM +0400, Anton Vorontsov wrote:
> On Wed, Jul 29, 2009 at 10:44:46PM +0100, Ben Dooks wrote:
> [...]
> > > +	const struct spi_device_id *id_table;
> > > +	int			(*probe_id)(struct spi_device *spi,
> > > +					    const struct spi_device_id *id);
> > 
> > how about leaving it at just probe and have either a call or a field
> > in the device that you can look at to see if this was a new style of
> > call?
> 
> There are no technical difficulties with that, but it would be
> inconsitent wrt other "device table"-aware buses (i2c, pci, of).

Btw, I guess there are few reasons why other buses pass id via
probe() call:

- You'll have to store the "id" in device struct forever, while
  in most cases you only need it during probe(), then you don't
  need it at all;

- If you don't store "id" in the device struct, you'll have
  to look up the device table twice (at first during bus->match(),
  and second time in drivers' probe() hook, i.e.
  probe(struct bus_dev *dev) {
  	id = bus_get_devid(dev); /* here */
  }

-- 
Anton Vorontsov
email: cbouatmailru@gmail.com
irc://irc.freenode.net/bd2

_______________________________________________
lm-sensors mailing list
lm-sensors@lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

^ permalink raw reply	[flat|nested] 68+ messages in thread

* Re: [PATCH 1/7] spi: Add support for device table matching
  2009-07-29 22:40         ` Anton Vorontsov
  (?)
  (?)
@ 2009-07-30  2:12           ` Anton Vorontsov
  -1 siblings, 0 replies; 68+ messages in thread
From: Anton Vorontsov @ 2009-07-30  2:12 UTC (permalink / raw)
  To: Ben Dooks
  Cc: Andrew Morton, David Brownell, David Woodhouse, Grant Likely,
	Jean Delvare, linux-mtd, linux-kernel, lm-sensors, linuxppc-dev

On Thu, Jul 30, 2009 at 02:40:50AM +0400, Anton Vorontsov wrote:
[...]
> - If you don't store "id" in the device struct, you'll have
>   to look up the device table twice (at first during bus->match(),
>   and second time in drivers' probe() hook, i.e.
>   probe(struct bus_dev *dev) {
>   	id = bus_get_devid(dev); /* here */
>   }

Hm... actually, we're doing this anyway, but in spi core.

So, doing something like spi_get_device_id() might be a good
idea.

Thanks,

-- 
Anton Vorontsov
email: cbouatmailru@gmail.com
irc://irc.freenode.net/bd2

^ permalink raw reply	[flat|nested] 68+ messages in thread

* Re: [PATCH 1/7] spi: Add support for device table matching
@ 2009-07-30  2:12           ` Anton Vorontsov
  0 siblings, 0 replies; 68+ messages in thread
From: Anton Vorontsov @ 2009-07-30  2:12 UTC (permalink / raw)
  To: Ben Dooks
  Cc: David Brownell, linux-kernel, lm-sensors, linuxppc-dev,
	linux-mtd, Jean Delvare, Andrew Morton, David Woodhouse

On Thu, Jul 30, 2009 at 02:40:50AM +0400, Anton Vorontsov wrote:
[...]
> - If you don't store "id" in the device struct, you'll have
>   to look up the device table twice (at first during bus->match(),
>   and second time in drivers' probe() hook, i.e.
>   probe(struct bus_dev *dev) {
>   	id = bus_get_devid(dev); /* here */
>   }

Hm... actually, we're doing this anyway, but in spi core.

So, doing something like spi_get_device_id() might be a good
idea.

Thanks,

-- 
Anton Vorontsov
email: cbouatmailru@gmail.com
irc://irc.freenode.net/bd2

^ permalink raw reply	[flat|nested] 68+ messages in thread

* Re: [PATCH 1/7] spi: Add support for device table matching
@ 2009-07-30  2:12           ` Anton Vorontsov
  0 siblings, 0 replies; 68+ messages in thread
From: Anton Vorontsov @ 2009-07-30  2:12 UTC (permalink / raw)
  To: Ben Dooks
  Cc: David Brownell, linux-kernel, lm-sensors, Grant Likely,
	linuxppc-dev, linux-mtd, Jean Delvare, Andrew Morton,
	David Woodhouse

On Thu, Jul 30, 2009 at 02:40:50AM +0400, Anton Vorontsov wrote:
[...]
> - If you don't store "id" in the device struct, you'll have
>   to look up the device table twice (at first during bus->match(),
>   and second time in drivers' probe() hook, i.e.
>   probe(struct bus_dev *dev) {
>   	id = bus_get_devid(dev); /* here */
>   }

Hm... actually, we're doing this anyway, but in spi core.

So, doing something like spi_get_device_id() might be a good
idea.

Thanks,

-- 
Anton Vorontsov
email: cbouatmailru@gmail.com
irc://irc.freenode.net/bd2

^ permalink raw reply	[flat|nested] 68+ messages in thread

* Re: [lm-sensors] [PATCH 1/7] spi: Add support for device table
@ 2009-07-30  2:12           ` Anton Vorontsov
  0 siblings, 0 replies; 68+ messages in thread
From: Anton Vorontsov @ 2009-07-30  2:12 UTC (permalink / raw)
  To: Ben Dooks
  Cc: Andrew Morton, David Brownell, David Woodhouse, Grant Likely,
	Jean Delvare, linux-mtd, linux-kernel, lm-sensors, linuxppc-dev

On Thu, Jul 30, 2009 at 02:40:50AM +0400, Anton Vorontsov wrote:
[...]
> - If you don't store "id" in the device struct, you'll have
>   to look up the device table twice (at first during bus->match(),
>   and second time in drivers' probe() hook, i.e.
>   probe(struct bus_dev *dev) {
>   	id = bus_get_devid(dev); /* here */
>   }

Hm... actually, we're doing this anyway, but in spi core.

So, doing something like spi_get_device_id() might be a good
idea.

Thanks,

-- 
Anton Vorontsov
email: cbouatmailru@gmail.com
irc://irc.freenode.net/bd2

_______________________________________________
lm-sensors mailing list
lm-sensors@lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

^ permalink raw reply	[flat|nested] 68+ messages in thread

* Re: [PATCH 0/7] Device table matching for SPI subsystem
  2009-07-29 17:03 ` Anton Vorontsov
  (?)
  (?)
@ 2009-08-04  2:16   ` David Brownell
  -1 siblings, 0 replies; 68+ messages in thread
From: David Brownell @ 2009-08-04  2:16 UTC (permalink / raw)
  To: avorontsov
  Cc: Andrew Morton, David Brownell, David Woodhouse, Grant Likely,
	Jean Delvare, linux-mtd, linux-kernel, lm-sensors, linuxppc-dev

On Wednesday 29 July 2009, Anton Vorontsov wrote:
> 	platform_data is overkill for m25p80 chips, the
> driver only needs to know exact chip model, and that's what device
> tables are for.

To be fair, the platform_data also supports partitioning
and labeling e.g. for cmdlinepart ... though I'd tend to
agree that most SPI flash chips are kind of small (so
they're mostly just one smallish partition).




^ permalink raw reply	[flat|nested] 68+ messages in thread

* Re: [PATCH 0/7] Device table matching for SPI subsystem
@ 2009-08-04  2:16   ` David Brownell
  0 siblings, 0 replies; 68+ messages in thread
From: David Brownell @ 2009-08-04  2:16 UTC (permalink / raw)
  To: avorontsov
  Cc: David Brownell, linux-kernel, lm-sensors, linuxppc-dev,
	linux-mtd, Jean Delvare, Andrew Morton, David Woodhouse

On Wednesday 29 July 2009, Anton Vorontsov wrote:
> 	platform_data is overkill for m25p80 chips, the
> driver only needs to know exact chip model, and that's what device
> tables are for.

To be fair, the platform_data also supports partitioning
and labeling e.g. for cmdlinepart ... though I'd tend to
agree that most SPI flash chips are kind of small (so
they're mostly just one smallish partition).

^ permalink raw reply	[flat|nested] 68+ messages in thread

* Re: [PATCH 0/7] Device table matching for SPI subsystem
@ 2009-08-04  2:16   ` David Brownell
  0 siblings, 0 replies; 68+ messages in thread
From: David Brownell @ 2009-08-04  2:16 UTC (permalink / raw)
  To: avorontsov
  Cc: David Brownell, linux-kernel, lm-sensors, Grant Likely,
	linuxppc-dev, linux-mtd, Jean Delvare, Andrew Morton,
	David Woodhouse

On Wednesday 29 July 2009, Anton Vorontsov wrote:
> 	platform_data is overkill for m25p80 chips, the
> driver only needs to know exact chip model, and that's what device
> tables are for.

To be fair, the platform_data also supports partitioning
and labeling e.g. for cmdlinepart ... though I'd tend to
agree that most SPI flash chips are kind of small (so
they're mostly just one smallish partition).

^ permalink raw reply	[flat|nested] 68+ messages in thread

* Re: [lm-sensors] [PATCH 0/7] Device table matching for SPI subsystem
@ 2009-08-04  2:16   ` David Brownell
  0 siblings, 0 replies; 68+ messages in thread
From: David Brownell @ 2009-08-04  2:16 UTC (permalink / raw)
  To: avorontsov
  Cc: Andrew Morton, David Brownell, David Woodhouse, Grant Likely,
	Jean Delvare, linux-mtd, linux-kernel, lm-sensors, linuxppc-dev

On Wednesday 29 July 2009, Anton Vorontsov wrote:
> 	platform_data is overkill for m25p80 chips, the
> driver only needs to know exact chip model, and that's what device
> tables are for.

To be fair, the platform_data also supports partitioning
and labeling e.g. for cmdlinepart ... though I'd tend to
agree that most SPI flash chips are kind of small (so
they're mostly just one smallish partition).




_______________________________________________
lm-sensors mailing list
lm-sensors@lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

^ permalink raw reply	[flat|nested] 68+ messages in thread

* Re: [PATCH 1/7] spi: Add support for device table matching
  2009-07-29 21:44     ` Ben Dooks
  (?)
  (?)
@ 2009-08-04  2:21       ` David Brownell
  -1 siblings, 0 replies; 68+ messages in thread
From: David Brownell @ 2009-08-04  2:21 UTC (permalink / raw)
  To: Ben Dooks
  Cc: Anton Vorontsov, Andrew Morton, David Woodhouse, Grant Likely,
	Jean Delvare, linux-mtd, linux-kernel, lm-sensors, linuxppc-dev

On Wednesday 29 July 2009, Ben Dooks wrote:
> >  struct spi_driver {
> > +     const struct spi_device_id *id_table;
> > +     int                     (*probe_id)(struct spi_device *spi,
> > +                                         const struct spi_device_id *id);
> 
> how about leaving it at just probe and have either a call or a field
> in the device that you can look at to see if this was a new style of
> call?
> 
> >       int                     (*probe)(struct spi_device *spi);

For the record, if this is going to happen I think the
appropriate long-term solution is to have probe() take
the device_id just as it does with other busses.

Of course that involves changing *every* SPI driver...
and I'd rather not do that quite yet.





^ permalink raw reply	[flat|nested] 68+ messages in thread

* Re: [PATCH 1/7] spi: Add support for device table matching
@ 2009-08-04  2:21       ` David Brownell
  0 siblings, 0 replies; 68+ messages in thread
From: David Brownell @ 2009-08-04  2:21 UTC (permalink / raw)
  To: Ben Dooks
  Cc: linux-kernel, lm-sensors, linuxppc-dev, linux-mtd, Jean Delvare,
	Andrew Morton, David Woodhouse

On Wednesday 29 July 2009, Ben Dooks wrote:
> >  struct spi_driver {
> > +     const struct spi_device_id *id_table;
> > +     int                     (*probe_id)(struct spi_device *spi,
> > +                                         const struct spi_device_id *id);
> 
> how about leaving it at just probe and have either a call or a field
> in the device that you can look at to see if this was a new style of
> call?
> 
> >       int                     (*probe)(struct spi_device *spi);

For the record, if this is going to happen I think the
appropriate long-term solution is to have probe() take
the device_id just as it does with other busses.

Of course that involves changing *every* SPI driver...
and I'd rather not do that quite yet.

^ permalink raw reply	[flat|nested] 68+ messages in thread

* Re: [PATCH 1/7] spi: Add support for device table matching
@ 2009-08-04  2:21       ` David Brownell
  0 siblings, 0 replies; 68+ messages in thread
From: David Brownell @ 2009-08-04  2:21 UTC (permalink / raw)
  To: Ben Dooks
  Cc: linux-kernel, lm-sensors, Grant Likely, linuxppc-dev, linux-mtd,
	Jean Delvare, Andrew Morton, Anton Vorontsov, David Woodhouse

On Wednesday 29 July 2009, Ben Dooks wrote:
> >  struct spi_driver {
> > +     const struct spi_device_id *id_table;
> > +     int                     (*probe_id)(struct spi_device *spi,
> > +                                         const struct spi_device_id *id);
> 
> how about leaving it at just probe and have either a call or a field
> in the device that you can look at to see if this was a new style of
> call?
> 
> >       int                     (*probe)(struct spi_device *spi);

For the record, if this is going to happen I think the
appropriate long-term solution is to have probe() take
the device_id just as it does with other busses.

Of course that involves changing *every* SPI driver...
and I'd rather not do that quite yet.

^ permalink raw reply	[flat|nested] 68+ messages in thread

* Re: [lm-sensors] [PATCH 1/7] spi: Add support for device table
@ 2009-08-04  2:21       ` David Brownell
  0 siblings, 0 replies; 68+ messages in thread
From: David Brownell @ 2009-08-04  2:21 UTC (permalink / raw)
  To: Ben Dooks
  Cc: Anton Vorontsov, Andrew Morton, David Woodhouse, Grant Likely,
	Jean Delvare, linux-mtd, linux-kernel, lm-sensors, linuxppc-dev

On Wednesday 29 July 2009, Ben Dooks wrote:
> >  struct spi_driver {
> > +     const struct spi_device_id *id_table;
> > +     int                     (*probe_id)(struct spi_device *spi,
> > +                                         const struct spi_device_id *id);
> 
> how about leaving it at just probe and have either a call or a field
> in the device that you can look at to see if this was a new style of
> call?
> 
> >       int                     (*probe)(struct spi_device *spi);

For the record, if this is going to happen I think the
appropriate long-term solution is to have probe() take
the device_id just as it does with other busses.

Of course that involves changing *every* SPI driver...
and I'd rather not do that quite yet.





_______________________________________________
lm-sensors mailing list
lm-sensors@lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

^ permalink raw reply	[flat|nested] 68+ messages in thread

* Re: [PATCH 0/7] Device table matching for SPI subsystem
  2009-08-04  2:16   ` David Brownell
  (?)
  (?)
@ 2009-08-05  0:54     ` Anton Vorontsov
  -1 siblings, 0 replies; 68+ messages in thread
From: Anton Vorontsov @ 2009-08-05  0:54 UTC (permalink / raw)
  To: David Brownell
  Cc: Andrew Morton, David Brownell, David Woodhouse, Grant Likely,
	Jean Delvare, linux-mtd, linux-kernel, lm-sensors, linuxppc-dev

On Mon, Aug 03, 2009 at 07:16:02PM -0700, David Brownell wrote:
> On Wednesday 29 July 2009, Anton Vorontsov wrote:
> > 	platform_data is overkill for m25p80 chips, the
> > driver only needs to know exact chip model, and that's what device
> > tables are for.
> 
> To be fair, the platform_data also supports partitioning
> and labeling e.g. for cmdlinepart ...

With OF we do partitioning and labling via drivers/mtd/ofpart.c.

Though, so far there is no support for OF partitions in the m25p80
driver. I think we'd better put the OF partitions probing into
parse_mtd_partitions(), and avoid calling of_mtd_parse_partitons()
directly...

Thanks,

-- 
Anton Vorontsov
email: cbouatmailru@gmail.com
irc://irc.freenode.net/bd2

^ permalink raw reply	[flat|nested] 68+ messages in thread

* Re: [PATCH 0/7] Device table matching for SPI subsystem
@ 2009-08-05  0:54     ` Anton Vorontsov
  0 siblings, 0 replies; 68+ messages in thread
From: Anton Vorontsov @ 2009-08-05  0:54 UTC (permalink / raw)
  To: David Brownell
  Cc: David Brownell, linux-kernel, lm-sensors, linuxppc-dev,
	linux-mtd, Jean Delvare, Andrew Morton, David Woodhouse

On Mon, Aug 03, 2009 at 07:16:02PM -0700, David Brownell wrote:
> On Wednesday 29 July 2009, Anton Vorontsov wrote:
> > 	platform_data is overkill for m25p80 chips, the
> > driver only needs to know exact chip model, and that's what device
> > tables are for.
> 
> To be fair, the platform_data also supports partitioning
> and labeling e.g. for cmdlinepart ...

With OF we do partitioning and labling via drivers/mtd/ofpart.c.

Though, so far there is no support for OF partitions in the m25p80
driver. I think we'd better put the OF partitions probing into
parse_mtd_partitions(), and avoid calling of_mtd_parse_partitons()
directly...

Thanks,

-- 
Anton Vorontsov
email: cbouatmailru@gmail.com
irc://irc.freenode.net/bd2

^ permalink raw reply	[flat|nested] 68+ messages in thread

* Re: [PATCH 0/7] Device table matching for SPI subsystem
@ 2009-08-05  0:54     ` Anton Vorontsov
  0 siblings, 0 replies; 68+ messages in thread
From: Anton Vorontsov @ 2009-08-05  0:54 UTC (permalink / raw)
  To: David Brownell
  Cc: David Brownell, linux-kernel, lm-sensors, Grant Likely,
	linuxppc-dev, linux-mtd, Jean Delvare, Andrew Morton,
	David Woodhouse

On Mon, Aug 03, 2009 at 07:16:02PM -0700, David Brownell wrote:
> On Wednesday 29 July 2009, Anton Vorontsov wrote:
> > 	platform_data is overkill for m25p80 chips, the
> > driver only needs to know exact chip model, and that's what device
> > tables are for.
> 
> To be fair, the platform_data also supports partitioning
> and labeling e.g. for cmdlinepart ...

With OF we do partitioning and labling via drivers/mtd/ofpart.c.

Though, so far there is no support for OF partitions in the m25p80
driver. I think we'd better put the OF partitions probing into
parse_mtd_partitions(), and avoid calling of_mtd_parse_partitons()
directly...

Thanks,

-- 
Anton Vorontsov
email: cbouatmailru@gmail.com
irc://irc.freenode.net/bd2

^ permalink raw reply	[flat|nested] 68+ messages in thread

* Re: [lm-sensors] [PATCH 0/7] Device table matching for SPI subsystem
@ 2009-08-05  0:54     ` Anton Vorontsov
  0 siblings, 0 replies; 68+ messages in thread
From: Anton Vorontsov @ 2009-08-05  0:54 UTC (permalink / raw)
  To: David Brownell
  Cc: Andrew Morton, David Brownell, David Woodhouse, Grant Likely,
	Jean Delvare, linux-mtd, linux-kernel, lm-sensors, linuxppc-dev

On Mon, Aug 03, 2009 at 07:16:02PM -0700, David Brownell wrote:
> On Wednesday 29 July 2009, Anton Vorontsov wrote:
> > 	platform_data is overkill for m25p80 chips, the
> > driver only needs to know exact chip model, and that's what device
> > tables are for.
> 
> To be fair, the platform_data also supports partitioning
> and labeling e.g. for cmdlinepart ...

With OF we do partitioning and labling via drivers/mtd/ofpart.c.

Though, so far there is no support for OF partitions in the m25p80
driver. I think we'd better put the OF partitions probing into
parse_mtd_partitions(), and avoid calling of_mtd_parse_partitons()
directly...

Thanks,

-- 
Anton Vorontsov
email: cbouatmailru@gmail.com
irc://irc.freenode.net/bd2

_______________________________________________
lm-sensors mailing list
lm-sensors@lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

^ permalink raw reply	[flat|nested] 68+ messages in thread

* Re: [PATCH 1/7] spi: Add support for device table matching
  2009-08-04  2:21       ` David Brownell
  (?)
  (?)
@ 2009-08-05  1:06         ` Anton Vorontsov
  -1 siblings, 0 replies; 68+ messages in thread
From: Anton Vorontsov @ 2009-08-05  1:06 UTC (permalink / raw)
  To: David Brownell
  Cc: Ben Dooks, Andrew Morton, David Woodhouse, Grant Likely,
	Jean Delvare, linux-mtd, linux-kernel, lm-sensors, linuxppc-dev

On Mon, Aug 03, 2009 at 07:21:22PM -0700, David Brownell wrote:
> On Wednesday 29 July 2009, Ben Dooks wrote:
> > >  struct spi_driver {
> > > +     const struct spi_device_id *id_table;
> > > +     int                     (*probe_id)(struct spi_device *spi,
> > > +                                         const struct spi_device_id *id);
> > 
> > how about leaving it at just probe and have either a call or a field
> > in the device that you can look at to see if this was a new style of
> > call?
> > 
> > >       int                     (*probe)(struct spi_device *spi);
> 
> For the record, if this is going to happen I think the
> appropriate long-term solution is to have probe() take
> the device_id just as it does with other busses.

Just curious. Why you prefer another argument in the probe()
instead of calling some helper function? Most drivers don't
need the "id" argument, so why spend memory and cpu cycles
for it?

-- 
Anton Vorontsov
email: cbouatmailru@gmail.com
irc://irc.freenode.net/bd2

^ permalink raw reply	[flat|nested] 68+ messages in thread

* Re: [PATCH 1/7] spi: Add support for device table matching
@ 2009-08-05  1:06         ` Anton Vorontsov
  0 siblings, 0 replies; 68+ messages in thread
From: Anton Vorontsov @ 2009-08-05  1:06 UTC (permalink / raw)
  To: David Brownell
  Cc: linux-kernel, lm-sensors, linuxppc-dev, linux-mtd, Ben Dooks,
	Jean Delvare, Andrew Morton, David Woodhouse

On Mon, Aug 03, 2009 at 07:21:22PM -0700, David Brownell wrote:
> On Wednesday 29 July 2009, Ben Dooks wrote:
> > >  struct spi_driver {
> > > +     const struct spi_device_id *id_table;
> > > +     int                     (*probe_id)(struct spi_device *spi,
> > > +                                         const struct spi_device_id *id);
> > 
> > how about leaving it at just probe and have either a call or a field
> > in the device that you can look at to see if this was a new style of
> > call?
> > 
> > >       int                     (*probe)(struct spi_device *spi);
> 
> For the record, if this is going to happen I think the
> appropriate long-term solution is to have probe() take
> the device_id just as it does with other busses.

Just curious. Why you prefer another argument in the probe()
instead of calling some helper function? Most drivers don't
need the "id" argument, so why spend memory and cpu cycles
for it?

-- 
Anton Vorontsov
email: cbouatmailru@gmail.com
irc://irc.freenode.net/bd2

^ permalink raw reply	[flat|nested] 68+ messages in thread

* Re: [PATCH 1/7] spi: Add support for device table matching
@ 2009-08-05  1:06         ` Anton Vorontsov
  0 siblings, 0 replies; 68+ messages in thread
From: Anton Vorontsov @ 2009-08-05  1:06 UTC (permalink / raw)
  To: David Brownell
  Cc: linux-kernel, lm-sensors, Grant Likely, linuxppc-dev, linux-mtd,
	Ben Dooks, Jean Delvare, Andrew Morton, David Woodhouse

On Mon, Aug 03, 2009 at 07:21:22PM -0700, David Brownell wrote:
> On Wednesday 29 July 2009, Ben Dooks wrote:
> > >  struct spi_driver {
> > > +     const struct spi_device_id *id_table;
> > > +     int                     (*probe_id)(struct spi_device *spi,
> > > +                                         const struct spi_device_id *id);
> > 
> > how about leaving it at just probe and have either a call or a field
> > in the device that you can look at to see if this was a new style of
> > call?
> > 
> > >       int                     (*probe)(struct spi_device *spi);
> 
> For the record, if this is going to happen I think the
> appropriate long-term solution is to have probe() take
> the device_id just as it does with other busses.

Just curious. Why you prefer another argument in the probe()
instead of calling some helper function? Most drivers don't
need the "id" argument, so why spend memory and cpu cycles
for it?

-- 
Anton Vorontsov
email: cbouatmailru@gmail.com
irc://irc.freenode.net/bd2

^ permalink raw reply	[flat|nested] 68+ messages in thread

* Re: [lm-sensors] [PATCH 1/7] spi: Add support for device table
@ 2009-08-05  1:06         ` Anton Vorontsov
  0 siblings, 0 replies; 68+ messages in thread
From: Anton Vorontsov @ 2009-08-05  1:06 UTC (permalink / raw)
  To: David Brownell
  Cc: Ben Dooks, Andrew Morton, David Woodhouse, Grant Likely,
	Jean Delvare, linux-mtd, linux-kernel, lm-sensors, linuxppc-dev

On Mon, Aug 03, 2009 at 07:21:22PM -0700, David Brownell wrote:
> On Wednesday 29 July 2009, Ben Dooks wrote:
> > >  struct spi_driver {
> > > +     const struct spi_device_id *id_table;
> > > +     int                     (*probe_id)(struct spi_device *spi,
> > > +                                         const struct spi_device_id *id);
> > 
> > how about leaving it at just probe and have either a call or a field
> > in the device that you can look at to see if this was a new style of
> > call?
> > 
> > >       int                     (*probe)(struct spi_device *spi);
> 
> For the record, if this is going to happen I think the
> appropriate long-term solution is to have probe() take
> the device_id just as it does with other busses.

Just curious. Why you prefer another argument in the probe()
instead of calling some helper function? Most drivers don't
need the "id" argument, so why spend memory and cpu cycles
for it?

-- 
Anton Vorontsov
email: cbouatmailru@gmail.com
irc://irc.freenode.net/bd2

_______________________________________________
lm-sensors mailing list
lm-sensors@lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

^ permalink raw reply	[flat|nested] 68+ messages in thread

* Re: [PATCH 4/7] spi: Prefix modalias with "spi:"
  2009-07-29 17:05   ` Anton Vorontsov
  (?)
  (?)
@ 2009-08-12  4:12     ` Mike Frysinger
  -1 siblings, 0 replies; 68+ messages in thread
From: Mike Frysinger @ 2009-08-12  4:12 UTC (permalink / raw)
  To: Anton Vorontsov
  Cc: Andrew Morton, David Brownell, David Woodhouse, Grant Likely,
	Jean Delvare, linux-mtd, linux-kernel, lm-sensors, linuxppc-dev

On Wed, Jul 29, 2009 at 13:05, Anton Vorontsov wrote:
> This makes it consistent with other buses (platform, i2c, vio, ...).
> I'm not sure why we use the prefixes, but there must be a reason.
>
> This was easy enough to do it, and I did it.

acked-by-me for misc blackfin/adi drivers, thanks
-mike

^ permalink raw reply	[flat|nested] 68+ messages in thread

* Re: [PATCH 4/7] spi: Prefix modalias with "spi:"
@ 2009-08-12  4:12     ` Mike Frysinger
  0 siblings, 0 replies; 68+ messages in thread
From: Mike Frysinger @ 2009-08-12  4:12 UTC (permalink / raw)
  To: Anton Vorontsov
  Cc: David Brownell, linux-kernel, lm-sensors, linuxppc-dev,
	linux-mtd, Jean Delvare, Andrew Morton, David Woodhouse

On Wed, Jul 29, 2009 at 13:05, Anton Vorontsov wrote:
> This makes it consistent with other buses (platform, i2c, vio, ...).
> I'm not sure why we use the prefixes, but there must be a reason.
>
> This was easy enough to do it, and I did it.

acked-by-me for misc blackfin/adi drivers, thanks
-mike

^ permalink raw reply	[flat|nested] 68+ messages in thread

* Re: [PATCH 4/7] spi: Prefix modalias with "spi:"
@ 2009-08-12  4:12     ` Mike Frysinger
  0 siblings, 0 replies; 68+ messages in thread
From: Mike Frysinger @ 2009-08-12  4:12 UTC (permalink / raw)
  To: Anton Vorontsov
  Cc: David Brownell, linux-kernel, lm-sensors, Grant Likely,
	linuxppc-dev, linux-mtd, Jean Delvare, Andrew Morton,
	David Woodhouse

On Wed, Jul 29, 2009 at 13:05, Anton Vorontsov wrote:
> This makes it consistent with other buses (platform, i2c, vio, ...).
> I'm not sure why we use the prefixes, but there must be a reason.
>
> This was easy enough to do it, and I did it.

acked-by-me for misc blackfin/adi drivers, thanks
-mike

^ permalink raw reply	[flat|nested] 68+ messages in thread

* Re: [lm-sensors] [PATCH 4/7] spi: Prefix modalias with "spi:"
@ 2009-08-12  4:12     ` Mike Frysinger
  0 siblings, 0 replies; 68+ messages in thread
From: Mike Frysinger @ 2009-08-12  4:12 UTC (permalink / raw)
  To: Anton Vorontsov
  Cc: Andrew Morton, David Brownell, David Woodhouse, Grant Likely,
	Jean Delvare, linux-mtd, linux-kernel, lm-sensors, linuxppc-dev

On Wed, Jul 29, 2009 at 13:05, Anton Vorontsov wrote:
> This makes it consistent with other buses (platform, i2c, vio, ...).
> I'm not sure why we use the prefixes, but there must be a reason.
>
> This was easy enough to do it, and I did it.

acked-by-me for misc blackfin/adi drivers, thanks
-mike

_______________________________________________
lm-sensors mailing list
lm-sensors@lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

^ permalink raw reply	[flat|nested] 68+ messages in thread

end of thread, other threads:[~2009-08-12  4:34 UTC | newest]

Thread overview: 68+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-07-29 17:03 [PATCH 0/7] Device table matching for SPI subsystem Anton Vorontsov
2009-07-29 17:03 ` [lm-sensors] " Anton Vorontsov
2009-07-29 17:03 ` Anton Vorontsov
2009-07-29 17:03 ` Anton Vorontsov
2009-07-29 17:04 ` [PATCH 1/7] spi: Add support for device table matching Anton Vorontsov
2009-07-29 17:04   ` [lm-sensors] " Anton Vorontsov
2009-07-29 17:04   ` Anton Vorontsov
2009-07-29 17:04   ` Anton Vorontsov
2009-07-29 21:44   ` Ben Dooks
2009-07-29 21:44     ` [lm-sensors] [PATCH 1/7] spi: Add support for device table Ben Dooks
2009-07-29 21:44     ` [PATCH 1/7] spi: Add support for device table matching Ben Dooks
2009-07-29 21:44     ` Ben Dooks
2009-07-29 22:32     ` Anton Vorontsov
2009-07-29 22:32       ` [lm-sensors] [PATCH 1/7] spi: Add support for device table Anton Vorontsov
2009-07-29 22:32       ` [PATCH 1/7] spi: Add support for device table matching Anton Vorontsov
2009-07-29 22:32       ` Anton Vorontsov
2009-07-29 22:40       ` Anton Vorontsov
2009-07-29 22:40         ` [lm-sensors] [PATCH 1/7] spi: Add support for device table Anton Vorontsov
2009-07-29 22:40         ` [PATCH 1/7] spi: Add support for device table matching Anton Vorontsov
2009-07-29 22:40         ` Anton Vorontsov
2009-07-30  2:12         ` Anton Vorontsov
2009-07-30  2:12           ` [lm-sensors] [PATCH 1/7] spi: Add support for device table Anton Vorontsov
2009-07-30  2:12           ` [PATCH 1/7] spi: Add support for device table matching Anton Vorontsov
2009-07-30  2:12           ` Anton Vorontsov
2009-08-04  2:21     ` David Brownell
2009-08-04  2:21       ` [lm-sensors] [PATCH 1/7] spi: Add support for device table David Brownell
2009-08-04  2:21       ` [PATCH 1/7] spi: Add support for device table matching David Brownell
2009-08-04  2:21       ` David Brownell
2009-08-05  1:06       ` Anton Vorontsov
2009-08-05  1:06         ` [lm-sensors] [PATCH 1/7] spi: Add support for device table Anton Vorontsov
2009-08-05  1:06         ` [PATCH 1/7] spi: Add support for device table matching Anton Vorontsov
2009-08-05  1:06         ` Anton Vorontsov
2009-07-29 17:05 ` [PATCH 2/7] mtd: m25p80: Convert to " Anton Vorontsov
2009-07-29 17:05   ` [lm-sensors] [PATCH 2/7] mtd: m25p80: Convert to device table Anton Vorontsov
2009-07-29 17:05   ` [PATCH 2/7] mtd: m25p80: Convert to device table matching Anton Vorontsov
2009-07-29 17:05   ` Anton Vorontsov
2009-07-29 17:05 ` [PATCH 3/7] of: Remove "stm,m25p40" alias Anton Vorontsov
2009-07-29 17:05   ` [lm-sensors] " Anton Vorontsov
2009-07-29 17:05   ` Anton Vorontsov
2009-07-29 17:05   ` Anton Vorontsov
2009-07-29 17:05 ` [PATCH 4/7] spi: Prefix modalias with "spi:" Anton Vorontsov
2009-07-29 17:05   ` [lm-sensors] " Anton Vorontsov
2009-07-29 17:05   ` Anton Vorontsov
2009-07-29 17:05   ` Anton Vorontsov
2009-08-12  4:12   ` Mike Frysinger
2009-08-12  4:12     ` [lm-sensors] " Mike Frysinger
2009-08-12  4:12     ` Mike Frysinger
2009-08-12  4:12     ` Mike Frysinger
2009-07-29 17:05 ` [PATCH 5/7] spi: Merge probe and probe_id callbacks Anton Vorontsov
2009-07-29 17:05   ` [lm-sensors] " Anton Vorontsov
2009-07-29 17:05   ` Anton Vorontsov
2009-07-29 17:05   ` Anton Vorontsov
2009-07-29 17:05 ` [PATCH 6/7] hwmon: adxx: Convert to device table matching Anton Vorontsov
2009-07-29 17:05   ` [lm-sensors] [PATCH 6/7] hwmon: adxx: Convert to device table Anton Vorontsov
2009-07-29 17:05   ` [PATCH 6/7] hwmon: adxx: Convert to device table matching Anton Vorontsov
2009-07-29 17:05   ` Anton Vorontsov
2009-07-29 17:05 ` [PATCH 7/7] hwmon: lm70: " Anton Vorontsov
2009-07-29 17:05   ` [lm-sensors] [PATCH 7/7] hwmon: lm70: Convert to device table Anton Vorontsov
2009-07-29 17:05   ` [PATCH 7/7] hwmon: lm70: Convert to device table matching Anton Vorontsov
2009-07-29 17:05   ` Anton Vorontsov
2009-08-04  2:16 ` [PATCH 0/7] Device table matching for SPI subsystem David Brownell
2009-08-04  2:16   ` [lm-sensors] " David Brownell
2009-08-04  2:16   ` David Brownell
2009-08-04  2:16   ` David Brownell
2009-08-05  0:54   ` Anton Vorontsov
2009-08-05  0:54     ` [lm-sensors] " Anton Vorontsov
2009-08-05  0:54     ` Anton Vorontsov
2009-08-05  0:54     ` Anton Vorontsov

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.