Skip to contentSkip to conversation

zorro: Miscellaneous cleanups

PATCH Applied Geert Uytterhoeven 1 participant 7 messages Jan 12, 2020 – Feb 10, 2020 m68k architecture

lore
Share & tools
lore

Geert Uytterhoeven

author maintainer
#0 lore raw

cover zorro: Miscellaneous cleanups

Hi all,

This patch series contains miscellaneous cleanups for the Zorro bus code.

Geert Uytterhoeven (5):
zorro: Make zorro_match_device() static
zorro: Fix zorro_bus_match() kerneldoc
zorro: Use zorro_match_device() helper in zorro_bus_match()
zorro: Remove unused zorro_dev_driver()
zorro: Move zorro_bus_type to bus-private header file

 drivers/zorro/zorro-driver.c | 16 +++++-----------
 drivers/zorro/zorro.h        |  7 +++++++
 include/linux/zorro.h        | 12 ------------
 3 files changed, 12 insertions(+), 23 deletions(-)
Signature · 12 lines
2.17.1

Gr{oetje,eeting}s,

						Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
							    -- Linus Torvalds
author maintainer
#1 lore raw

PATCH 1/5 zorro: Make zorro_match_device() static

Unlike its PCI counterpart, zorro_match_device() was never used outside the Zorro bus code.

---
 drivers/zorro/zorro-driver.c | 3 +--
 include/linux/zorro.h        | 1 -
 2 files changed, 1 insertion(+), 3 deletions(-)
drivers/zorro/zorro-driver.c +1 -2
index fa23b7366b98ccbe..84ac94aecb7966b8 100644
@@ -28,7 +28,7 @@
      *  zorro_device_id structure or %NULL if there is no match.
      */
 
-const struct zorro_device_id *
+static const struct zorro_device_id *
 zorro_match_device(const struct zorro_device_id *ids,
 		   const struct zorro_dev *z)
 {
@@ -39,7 +39,6 @@ zorro_match_device(const struct zorro_device_id *ids,
 	}
 	return NULL;
 }
-EXPORT_SYMBOL(zorro_match_device);
 
 
 static int zorro_device_probe(struct device *dev)
include/linux/zorro.h +0 -1
index 63fbba0740c2c2bf..cb72515b0ac17040 100644
@@ -70,7 +70,6 @@ struct zorro_driver {
 /* New-style probing */
 extern int zorro_register_driver(struct zorro_driver *);
 extern void zorro_unregister_driver(struct zorro_driver *);
-extern const struct zorro_device_id *zorro_match_device(const struct zorro_device_id *ids, const struct zorro_dev *z);
 static inline struct zorro_driver *zorro_dev_driver(const struct zorro_dev *z)
 {
     return z->driver;
Signature · 1 line
2.17.1
author maintainer
#2 lore raw

PATCH 2/5 zorro: Fix zorro_bus_match() kerneldoc

In reply to Geert Uytterhoeven

The kerneldoc for zorro_bus_match() was obviously copied from zorro_match_device(), but wasnt't updated for the different calling context and semantics.

---
 drivers/zorro/zorro-driver.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/zorro/zorro-driver.c +3 -3
index 84ac94aecb7966b8..67e68880554245e1 100644
@@ -119,9 +119,9 @@ EXPORT_SYMBOL(zorro_unregister_driver);
      *  @ids: array of Zorro device id structures to search in
      *  @dev: the Zorro device structure to match against
      *
-     *  Used by a driver to check whether a Zorro device present in the
-     *  system is in its list of supported devices.Returns the matching
-     *  zorro_device_id structure or %NULL if there is no match.
+     *  Used by the driver core to check whether a Zorro device present in the
+     *  system is in a driver's list of supported devices.  Returns 1 if
+     *  supported, and 0 if there is no match.
      */
 
 static int zorro_bus_match(struct device *dev, struct device_driver *drv)
Signature · 1 line
2.17.1
author maintainer
#3 lore raw

PATCH 3/5 zorro: Use zorro_match_device() helper in zorro_bus_match()

In reply to Geert Uytterhoeven

Make zorro_bus_match() use the existing zorro_match_device() helper, instead of open-coding the same operation.

---
 drivers/zorro/zorro-driver.c | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)
drivers/zorro/zorro-driver.c +1 -6
index 67e68880554245e1..0dd7cbcec2b0d478 100644
@@ -133,12 +133,7 @@ static int zorro_bus_match(struct device *dev, struct device_driver *drv)
 	if (!ids)
 		return 0;
 
-	while (ids->id) {
-		if (ids->id == ZORRO_WILDCARD || ids->id == z->id)
-			return 1;
-		ids++;
-	}
-	return 0;
+	return !!zorro_match_device(ids, z);
 }
 
 static int zorro_uevent(struct device *dev, struct kobj_uevent_env *env)
Signature · 1 line
2.17.1
author maintainer
#4 lore raw

PATCH 4/5 zorro: Remove unused zorro_dev_driver()

In reply to Geert Uytterhoeven

This function was never used.

---
 include/linux/zorro.h | 4 ----
 1 file changed, 4 deletions(-)
include/linux/zorro.h +0 -4
index cb72515b0ac17040..22f3f80fbcb5afe6 100644
@@ -70,10 +70,6 @@ struct zorro_driver {
 /* New-style probing */
 extern int zorro_register_driver(struct zorro_driver *);
 extern void zorro_unregister_driver(struct zorro_driver *);
-static inline struct zorro_driver *zorro_dev_driver(const struct zorro_dev *z)
-{
-    return z->driver;
-}
 
 
 extern unsigned int zorro_num_autocon;	/* # of autoconfig devices found */
Signature · 1 line
2.17.1
author maintainer
#5 lore raw

PATCH 5/5 zorro: Move zorro_bus_type to bus-private header file

In reply to Geert Uytterhoeven

zorro_bus_type was never used outside the Zorro bus code. Hence move it from the public to the bus-private header file.

---
 drivers/zorro/zorro.h | 7 +++++++
 include/linux/zorro.h | 7 -------
 2 files changed, 7 insertions(+), 7 deletions(-)
drivers/zorro/zorro.h +7 -0
index ac0bab3412d90ddb..f84df9fb4c200ec3 100644
@@ -1,5 +1,12 @@
 /* SPDX-License-Identifier: GPL-2.0 */
 
+    /*
+     *  Zorro bus
+     */
+
+extern struct bus_type zorro_bus_type;
+
+
 #ifdef CONFIG_ZORRO_NAMES
 extern void zorro_name_device(struct zorro_dev *z);
 #else
include/linux/zorro.h +0 -7
index 22f3f80fbcb5afe6..e2e4de188d84a6d9 100644
@@ -40,13 +40,6 @@ struct zorro_dev {
 #define	to_zorro_dev(n)	container_of(n, struct zorro_dev, dev)
 
 
-    /*
-     *  Zorro bus
-     */
-
-extern struct bus_type zorro_bus_type;
-
-
     /*
      *  Zorro device drivers
      */
Signature · 1 line
2.17.1
author maintainer Applied
#6 lore raw
In reply to Geert Uytterhoeven
Quoted 9 lines · Geert Uytterhoeven

This patch series contains miscellaneous cleanups for the Zorro bus code.

Geert Uytterhoeven (5):
zorro: Make zorro_match_device() static
zorro: Fix zorro_bus_match() kerneldoc
zorro: Use zorro_match_device() helper in zorro_bus_match()
zorro: Remove unused zorro_dev_driver()
zorro: Move zorro_bus_type to bus-private header file

Thanks, applied and queued for v5.7.

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds