mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Geert Uytterhoeven <geert@linux-m68k.org>
To: linux-m68k@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, Geert Uytterhoeven <geert@linux-m68k.org>
Subject: [PATCH 5/8] zorro: Let the driver core handle device enumeration
Date: Wed, 16 Oct 2013 13:03:22 +0200	[thread overview]
Message-ID: <1381921405-11206-6-git-send-email-geert@linux-m68k.org> (raw)
In-Reply-To: <1381921405-11206-1-git-send-email-geert@linux-m68k.org>

Filling in dev_name of the Zorro bus type and dev.id of each device allows
the driver core to enumerate devices, so we don't have to do that
ourselves.

This changes the names of devices in sysfs from "%02x" to "zorro%u".

Note that filling in dev.id is also needed to support MFD Zorro devices.

Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
---
 drivers/zorro/zorro-driver.c |   11 ++++++-----
 drivers/zorro/zorro.c        |    4 ++--
 2 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/drivers/zorro/zorro-driver.c b/drivers/zorro/zorro-driver.c
index ac1db7f1bcab..eacae1434b73 100644
--- a/drivers/zorro/zorro-driver.c
+++ b/drivers/zorro/zorro-driver.c
@@ -161,11 +161,12 @@ static int zorro_uevent(struct device *dev, struct kobj_uevent_env *env)
 }
 
 struct bus_type zorro_bus_type = {
-	.name	= "zorro",
-	.match	= zorro_bus_match,
-	.uevent	= zorro_uevent,
-	.probe	= zorro_device_probe,
-	.remove	= zorro_device_remove,
+	.name     = "zorro",
+	.dev_name = "zorro",
+	.match    = zorro_bus_match,
+	.uevent   = zorro_uevent,
+	.probe    = zorro_device_probe,
+	.remove   = zorro_device_remove,
 };
 EXPORT_SYMBOL(zorro_bus_type);
 
diff --git a/drivers/zorro/zorro.c b/drivers/zorro/zorro.c
index 10c7f77aec08..450abf100f06 100644
--- a/drivers/zorro/zorro.c
+++ b/drivers/zorro/zorro.c
@@ -142,7 +142,7 @@ static int __init amiga_zorro_probe(struct platform_device *pdev)
 
 	zorro_autocon = bus->devices;
 	bus->dev.parent = &pdev->dev;
-	dev_set_name(&bus->dev, "zorro");
+	dev_set_name(&bus->dev, zorro_bus_type.name);
 	error = device_register(&bus->dev);
 	if (error) {
 		pr_err("Zorro: Error registering zorro_bus\n");
@@ -180,9 +180,9 @@ static int __init amiga_zorro_probe(struct platform_device *pdev)
 			dev_err(&bus->dev,
 				"Address space collision on device %s %pR\n",
 				z->name, &z->resource);
-		dev_set_name(&z->dev, "%02x", i);
 		z->dev.parent = &bus->dev;
 		z->dev.bus = &zorro_bus_type;
+		z->dev.id = i;
 	}
 
 	/* ... then register them */
-- 
1.7.9.5


  parent reply	other threads:[~2013-10-16 11:05 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-16 11:03 [PATCH 0/8] Amiga Zorro updates Geert Uytterhoeven
2013-10-16 11:03 ` [PATCH 1/8] Documentation/zorro.txt: Update path to arch-specific header files Geert Uytterhoeven
2013-10-16 11:03 ` [PATCH 2/8] zorro: Do not allocate zorro_autocon[] statically Geert Uytterhoeven
2013-10-16 11:03 ` [PATCH 3/8] zorro: Don't fill in dummy names in zorro_name_device() Geert Uytterhoeven
2013-10-16 11:03 ` [PATCH 4/8] zorro: Refactor conditional handling of Zorro device name database Geert Uytterhoeven
2013-10-16 11:03 ` Geert Uytterhoeven [this message]
2013-10-16 11:03 ` [PATCH 6/8] zorro: ZTWO_VADDR() should return "void __iomem *" Geert Uytterhoeven
2013-10-16 11:03 ` [PATCH 7/8] zorro/UAPI: Disintegrate include/linux/zorro*.h Geert Uytterhoeven
2013-10-16 11:03 ` [PATCH 8/8] zorro/UAPI: Use proper types (endianness/size) in <linux/zorro.h> Geert Uytterhoeven

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1381921405-11206-6-git-send-email-geert@linux-m68k.org \
    --to=geert@linux-m68k.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-m68k@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®