mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Manohar Vanga <manohar.vanga@cern.ch>
To: <gregkh@suse.de>
Cc: <martyn.welch@ge.com>, <cota@braap.org>,
	<devel@driverdev.osuosl.org>, <linux-kernel@vger.kernel.org>,
	Manohar Vanga <manohar.vanga@cern.ch>
Subject: [PATCH 3/4] staging: vme: get rid of struct vme_device_id and slots
Date: Mon, 26 Sep 2011 11:27:17 +0200	[thread overview]
Message-ID: <1317029238-13357-4-git-send-email-manohar.vanga@cern.ch> (raw)
In-Reply-To: <1317029238-13357-1-git-send-email-manohar.vanga@cern.ch>

Previously, the device-driver matching mechanism depended on the
vme_device_id structure due to the need for a bind table per driver.
This method of matching is no longer used so this patch merges the
fields of struct vme_device_id into struct vme_dev. Since this also
renders the slot field meaningless, it has also been removed in this
patch.

Signed-off-by: Manohar Vanga <manohar.vanga@cern.ch>
---
 drivers/staging/vme/devices/vme_user.c |    2 +-
 drivers/staging/vme/vme.c              |    8 +++-----
 drivers/staging/vme/vme.h              |   14 +-------------
 drivers/staging/vme/vme_api.txt        |   27 +++++++++++----------------
 4 files changed, 16 insertions(+), 35 deletions(-)

diff --git a/drivers/staging/vme/devices/vme_user.c b/drivers/staging/vme/devices/vme_user.c
index c658ce9..9518dda 100644
--- a/drivers/staging/vme/devices/vme_user.c
+++ b/drivers/staging/vme/devices/vme_user.c
@@ -668,7 +668,7 @@ err_nocard:
 
 static int vme_user_match(struct vme_dev *vdev)
 {
-	if (vdev->id.num >= USER_BUS_MAX)
+	if (vdev->num >= USER_BUS_MAX)
 		return 0;
 	return 1;
 }
diff --git a/drivers/staging/vme/vme.c b/drivers/staging/vme/vme.c
index 9cb6938..5715148 100644
--- a/drivers/staging/vme/vme.c
+++ b/drivers/staging/vme/vme.c
@@ -1377,16 +1377,14 @@ static int __vme_register_driver_bus(struct vme_driver *drv,
 			err = -ENOMEM;
 			goto err_devalloc;
 		}
-		vdev->id.num = i;
-		vdev->id.bus = bridge->num;
-		vdev->id.slot = i + 1;
+		vdev->num = i;
 		vdev->bridge = bridge;
 		vdev->dev.platform_data = drv;
 		vdev->dev.release = vme_dev_release;
 		vdev->dev.parent = bridge->parent;
 		vdev->dev.bus = &vme_bus_type;
-		dev_set_name(&vdev->dev, "%s.%u-%u", drv->name, vdev->id.bus,
-			vdev->id.num);
+		dev_set_name(&vdev->dev, "%s.%u-%u", drv->name, bridge->num,
+			vdev->num);
 
 		err = device_register(&vdev->dev);
 		if (err)
diff --git a/drivers/staging/vme/vme.h b/drivers/staging/vme/vme.h
index 95224d7..e3828ba 100644
--- a/drivers/staging/vme/vme.h
+++ b/drivers/staging/vme/vme.h
@@ -96,18 +96,6 @@ extern struct bus_type vme_bus_type;
 #define VME_SLOT_ALL		-2
 
 /**
- * VME device identifier structure
- * @num: The device ID (ranges from 0 to N-1 for N devices)
- * @bus: The bus ID of the bus the device is on
- * @slot: The slot this device is plugged into
- */
-struct vme_device_id {
-	int num;
-	int bus;
-	int slot;
-};
-
-/**
  * Structure representing a VME device
  * @id: The ID of the device (currently the bus and slot number)
  * @bridge: Pointer to the bridge device this device is on
@@ -116,7 +104,7 @@ struct vme_device_id {
  * @bridge_list: List of devices (per bridge)
  */
 struct vme_dev {
-	struct vme_device_id id;
+	int num;
 	struct vme_bridge *bridge;
 	struct device dev;
 	struct list_head drv_list;
diff --git a/drivers/staging/vme/vme_api.txt b/drivers/staging/vme/vme_api.txt
index 53abf7e..e8ff215 100644
--- a/drivers/staging/vme/vme_api.txt
+++ b/drivers/staging/vme/vme_api.txt
@@ -51,23 +51,16 @@ probe routine is passed a 'struct vme_dev' pointer as an argument. The
 'struct vme_dev' structure looks like the following:
 
 	struct vme_dev {
-		struct vme_device_id id;
+		int num;
 		struct vme_bridge *bridge;
 		struct device dev;
+		struct list_head drv_list;
+		struct list_head bridge_list;
 	};
 
-The 'bridge' field contains a pointer to the bridge device. The 'id' field
-contains information useful for the probe function:
-
-	struct vme_device_id {
-		int bus;
-		int slot;
-		int num;
-	};
-
-Here, 'bus' is the number of the bus the device being probed is on. 'slot'
-refers to the specific slot on the VME bus. The 'num' field refers to the
-sequential device ID for this specific driver.
+Here, the 'num' field refers to the sequential device ID for this specific
+driver. The bridge number (or bus number) can be accessed using
+dev->bridge->num.
 
 A function is also provided to unregister the driver from the VME core and is
 usually called from the device driver's exit routine:
@@ -78,9 +71,11 @@ usually called from the device driver's exit routine:
 Resource management
 ===================
 
-Once a driver has registered with the VME core the provided probe routine will
-be called for each of the bus/slot combination that becomes valid as VME buses
-are themselves registered.  The probe routine is passed a pointer to the devices
+Once a driver has registered with the VME core the provided match routine will
+be called the number of times specified during the registration. If a match
+succeeds, a non-zero value should be returned. A zero return value indicates
+failure. For all successful matches, the probe routine of the corresponding
+driver is called. The probe routine is passed a pointer to the devices
 device structure. This pointer should be saved, it will be required for
 requesting VME resources.
 
-- 
1.7.4.1


  parent reply	other threads:[~2011-09-26  9:31 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-09-26  9:27 [PATCH 0/4] [RESEND v6] VME Framework Fixes Manohar Vanga
2011-09-26  9:27 ` [PATCH 1/4] staging: vme: add struct vme_dev for VME devices Manohar Vanga
2011-09-26 22:51   ` Emilio G. Cota
2011-09-26  9:27 ` [PATCH 2/4] staging: vme: make match() driver specific to improve non-VME64x support Manohar Vanga
2011-09-26 23:29   ` Emilio G. Cota
2011-09-27  8:08     ` Manohar Vanga
2011-09-27 16:10       ` Emilio G. Cota
2011-09-26  9:27 ` Manohar Vanga [this message]
2011-09-26  9:27 ` [PATCH 4/4] staging: vme_user: rename USER_BUS_MAX to VME_USER_BUS_MAX Manohar Vanga
2011-09-27  0:51 ` [PATCH 0/4] [RESEND v6] VME Framework Fixes Greg KH
2011-10-03 14:59 ` Manohar Vanga
2011-10-11  0:03   ` Greg KH

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=1317029238-13357-4-git-send-email-manohar.vanga@cern.ch \
    --to=manohar.vanga@cern.ch \
    --cc=cota@braap.org \
    --cc=devel@driverdev.osuosl.org \
    --cc=gregkh@suse.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=martyn.welch@ge.com \
    /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®