linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/3] VME driver fixes
@ 2011-11-04 10:12 Manohar Vanga
  2011-11-04 10:12 ` [PATCH 1/3] staging: vme: fix comment in __vme_register_driver() Manohar Vanga
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Manohar Vanga @ 2011-11-04 10:12 UTC (permalink / raw)
  To: martyn.welch; +Cc: gregkh, cota, devel, linux-kernel, Manohar Vanga

Hi Martyn,

These three patches fix the issues raised by you in the discussion
regarding the removal of the VME driver from the staging tree.

* staging: vme: fix comment in __vme_register_driver()

This patch fixes the comment which doesn't apply as we didn't add the
bridge reference counting functions patch.

The code is still safe as vme_buses_lock is held when registering devices
(and vme_unregister_bridge needs to acquire it in order to remove the
bridge). The only different I can see is that the probe() calls will go
through entirely in this case before remove() is immediately called on
them (whereas with the vme_bridge_get(), a probe in the middle could fail
and we could quickly unregister the bridge).

* staging: vme: remove vme_add_bus() and vme_remove_bus()

These have been renamed to vme_register/unregister_bridge respectively.

Please let me know if you feel any other changes need to be made. Thanks
and best regards.

Manohar Vanga

Manohar Vanga (3):
  staging: vme: fix comment in __vme_register_driver()
  staging: vme: remove vme_add_bus() and vme_remove_bus()
  staging: vme: fix comment for struct vme_dev

 drivers/staging/vme/vme.c |   31 +++++++++----------------------
 drivers/staging/vme/vme.h |    2 +-
 2 files changed, 10 insertions(+), 23 deletions(-)

-- 
1.7.4.1


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

* [PATCH 1/3] staging: vme: fix comment in __vme_register_driver()
  2011-11-04 10:12 [PATCH 0/3] VME driver fixes Manohar Vanga
@ 2011-11-04 10:12 ` Manohar Vanga
  2011-11-04 11:02   ` Martyn Welch
  2011-11-04 10:12 ` [PATCH 2/3] staging: vme: remove vme_add_bus() and vme_remove_bus() Manohar Vanga
  2011-11-04 10:12 ` [PATCH 3/3] staging: vme: fix comment for struct vme_dev Manohar Vanga
  2 siblings, 1 reply; 7+ messages in thread
From: Manohar Vanga @ 2011-11-04 10:12 UTC (permalink / raw)
  To: martyn.welch; +Cc: gregkh, cota, devel, linux-kernel, Manohar Vanga

Signed-off-by: Manohar Vanga <manohar.vanga@cern.ch>
---
 drivers/staging/vme/vme.c |    5 +----
 1 files changed, 1 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/vme/vme.c b/drivers/staging/vme/vme.c
index b04b468..3cbc69c 100644
--- a/drivers/staging/vme/vme.c
+++ b/drivers/staging/vme/vme.c
@@ -1421,10 +1421,7 @@ static int __vme_register_driver(struct vme_driver *drv, unsigned int ndevs)
 		 * and if the bridge is removed, it will have to go through
 		 * vme_unregister_bridge() to do it (which calls remove() on
 		 * the bridge which in turn tries to acquire vme_buses_lock and
-		 * will have to wait). The probe() called after device
-		 * registration in __vme_register_driver below will also fail
-		 * as the bridge is being removed (since the probe() calls
-		 * vme_bridge_get()).
+		 * will have to wait).
 		 */
 		err = __vme_register_driver_bus(drv, bridge, ndevs);
 		if (err)
-- 
1.7.4.1


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

* [PATCH 2/3] staging: vme: remove vme_add_bus() and vme_remove_bus()
  2011-11-04 10:12 [PATCH 0/3] VME driver fixes Manohar Vanga
  2011-11-04 10:12 ` [PATCH 1/3] staging: vme: fix comment in __vme_register_driver() Manohar Vanga
@ 2011-11-04 10:12 ` Manohar Vanga
  2011-11-04 11:02   ` Martyn Welch
  2011-11-04 10:12 ` [PATCH 3/3] staging: vme: fix comment for struct vme_dev Manohar Vanga
  2 siblings, 1 reply; 7+ messages in thread
From: Manohar Vanga @ 2011-11-04 10:12 UTC (permalink / raw)
  To: martyn.welch; +Cc: gregkh, cota, devel, linux-kernel, Manohar Vanga

The functions vme_add_bus() and vme_remove_bus() were only being used
in the vme_register_bridge() and vme_unregister_bridge() functions
respectively. This patch gets rid of them and moves their code to
vme_register_bridge() and vme_unregister_bridge().

Signed-off-by: Manohar Vanga <manohar.vanga@cern.ch>
---
 drivers/staging/vme/vme.c |   26 ++++++++------------------
 1 files changed, 8 insertions(+), 18 deletions(-)

diff --git a/drivers/staging/vme/vme.c b/drivers/staging/vme/vme.c
index 3cbc69c..4c6dc69 100644
--- a/drivers/staging/vme/vme.c
+++ b/drivers/staging/vme/vme.c
@@ -1307,7 +1307,12 @@ EXPORT_SYMBOL(vme_slot_get);
 
 /* - Bridge Registration --------------------------------------------------- */
 
-static int vme_add_bus(struct vme_bridge *bridge)
+static void vme_dev_release(struct device *dev)
+{
+	kfree(dev_to_vme_dev(dev));
+}
+
+int vme_register_bridge(struct vme_bridge *bridge)
 {
 	int i;
 	int ret = -1;
@@ -1327,8 +1332,9 @@ static int vme_add_bus(struct vme_bridge *bridge)
 
 	return ret;
 }
+EXPORT_SYMBOL(vme_register_bridge);
 
-static void vme_remove_bus(struct vme_bridge *bridge)
+void vme_unregister_bridge(struct vme_bridge *bridge)
 {
 	struct vme_dev *vdev;
 	struct vme_dev *tmp;
@@ -1343,22 +1349,6 @@ static void vme_remove_bus(struct vme_bridge *bridge)
 	list_del(&bridge->bus_list);
 	mutex_unlock(&vme_buses_lock);
 }
-
-static void vme_dev_release(struct device *dev)
-{
-	kfree(dev_to_vme_dev(dev));
-}
-
-int vme_register_bridge(struct vme_bridge *bridge)
-{
-	return vme_add_bus(bridge);
-}
-EXPORT_SYMBOL(vme_register_bridge);
-
-void vme_unregister_bridge(struct vme_bridge *bridge)
-{
-	vme_remove_bus(bridge);
-}
 EXPORT_SYMBOL(vme_unregister_bridge);
 
 /* - Driver Registration --------------------------------------------------- */
-- 
1.7.4.1


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

* [PATCH 3/3] staging: vme: fix comment for struct vme_dev
  2011-11-04 10:12 [PATCH 0/3] VME driver fixes Manohar Vanga
  2011-11-04 10:12 ` [PATCH 1/3] staging: vme: fix comment in __vme_register_driver() Manohar Vanga
  2011-11-04 10:12 ` [PATCH 2/3] staging: vme: remove vme_add_bus() and vme_remove_bus() Manohar Vanga
@ 2011-11-04 10:12 ` Manohar Vanga
  2011-11-04 11:03   ` Martyn Welch
  2 siblings, 1 reply; 7+ messages in thread
From: Manohar Vanga @ 2011-11-04 10:12 UTC (permalink / raw)
  To: martyn.welch; +Cc: gregkh, cota, devel, linux-kernel, Manohar Vanga

Signed-off-by: Manohar Vanga <manohar.vanga@cern.ch>
---
 drivers/staging/vme/vme.h |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/staging/vme/vme.h b/drivers/staging/vme/vme.h
index e3828ba..e62a323 100644
--- a/drivers/staging/vme/vme.h
+++ b/drivers/staging/vme/vme.h
@@ -97,7 +97,7 @@ extern struct bus_type vme_bus_type;
 
 /**
  * Structure representing a VME device
- * @id: The ID of the device (currently the bus and slot number)
+ * @num: The device number
  * @bridge: Pointer to the bridge device this device is on
  * @dev: Internal device structure
  * @drv_list: List of devices (per driver)
-- 
1.7.4.1


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

* Re: [PATCH 1/3] staging: vme: fix comment in __vme_register_driver()
  2011-11-04 10:12 ` [PATCH 1/3] staging: vme: fix comment in __vme_register_driver() Manohar Vanga
@ 2011-11-04 11:02   ` Martyn Welch
  0 siblings, 0 replies; 7+ messages in thread
From: Martyn Welch @ 2011-11-04 11:02 UTC (permalink / raw)
  To: Manohar Vanga; +Cc: gregkh, cota, devel, linux-kernel

On 04/11/11 10:12, Manohar Vanga wrote:
> Signed-off-by: Manohar Vanga <manohar.vanga@cern.ch>

Acked-by: Martyn Welch <martyn.welch@ge.com>

> ---
>  drivers/staging/vme/vme.c |    5 +----
>  1 files changed, 1 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/staging/vme/vme.c b/drivers/staging/vme/vme.c
> index b04b468..3cbc69c 100644
> --- a/drivers/staging/vme/vme.c
> +++ b/drivers/staging/vme/vme.c
> @@ -1421,10 +1421,7 @@ static int __vme_register_driver(struct vme_driver *drv, unsigned int ndevs)
>  		 * and if the bridge is removed, it will have to go through
>  		 * vme_unregister_bridge() to do it (which calls remove() on
>  		 * the bridge which in turn tries to acquire vme_buses_lock and
> -		 * will have to wait). The probe() called after device
> -		 * registration in __vme_register_driver below will also fail
> -		 * as the bridge is being removed (since the probe() calls
> -		 * vme_bridge_get()).
> +		 * will have to wait).
>  		 */
>  		err = __vme_register_driver_bus(drv, bridge, ndevs);
>  		if (err)


-- 
Martyn Welch (Principal Software Engineer) | Registered in England and
GE Intelligent Platforms                   | Wales (3828642) at 100
T +44(0)1327322748                         | Barbirolli Square, Manchester,
E martyn.welch@ge.com                      | M2 3AB  VAT:GB 927559189

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

* Re: [PATCH 2/3] staging: vme: remove vme_add_bus() and vme_remove_bus()
  2011-11-04 10:12 ` [PATCH 2/3] staging: vme: remove vme_add_bus() and vme_remove_bus() Manohar Vanga
@ 2011-11-04 11:02   ` Martyn Welch
  0 siblings, 0 replies; 7+ messages in thread
From: Martyn Welch @ 2011-11-04 11:02 UTC (permalink / raw)
  To: Manohar Vanga; +Cc: gregkh, cota, devel, linux-kernel

On 04/11/11 10:12, Manohar Vanga wrote:
> The functions vme_add_bus() and vme_remove_bus() were only being used
> in the vme_register_bridge() and vme_unregister_bridge() functions
> respectively. This patch gets rid of them and moves their code to
> vme_register_bridge() and vme_unregister_bridge().
> 
> Signed-off-by: Manohar Vanga <manohar.vanga@cern.ch>

Acked-by: Martyn Welch <martyn.welch@ge.com>

> ---
>  drivers/staging/vme/vme.c |   26 ++++++++------------------
>  1 files changed, 8 insertions(+), 18 deletions(-)
> 
> diff --git a/drivers/staging/vme/vme.c b/drivers/staging/vme/vme.c
> index 3cbc69c..4c6dc69 100644
> --- a/drivers/staging/vme/vme.c
> +++ b/drivers/staging/vme/vme.c
> @@ -1307,7 +1307,12 @@ EXPORT_SYMBOL(vme_slot_get);
>  
>  /* - Bridge Registration --------------------------------------------------- */
>  
> -static int vme_add_bus(struct vme_bridge *bridge)
> +static void vme_dev_release(struct device *dev)
> +{
> +	kfree(dev_to_vme_dev(dev));
> +}
> +
> +int vme_register_bridge(struct vme_bridge *bridge)
>  {
>  	int i;
>  	int ret = -1;
> @@ -1327,8 +1332,9 @@ static int vme_add_bus(struct vme_bridge *bridge)
>  
>  	return ret;
>  }
> +EXPORT_SYMBOL(vme_register_bridge);
>  
> -static void vme_remove_bus(struct vme_bridge *bridge)
> +void vme_unregister_bridge(struct vme_bridge *bridge)
>  {
>  	struct vme_dev *vdev;
>  	struct vme_dev *tmp;
> @@ -1343,22 +1349,6 @@ static void vme_remove_bus(struct vme_bridge *bridge)
>  	list_del(&bridge->bus_list);
>  	mutex_unlock(&vme_buses_lock);
>  }
> -
> -static void vme_dev_release(struct device *dev)
> -{
> -	kfree(dev_to_vme_dev(dev));
> -}
> -
> -int vme_register_bridge(struct vme_bridge *bridge)
> -{
> -	return vme_add_bus(bridge);
> -}
> -EXPORT_SYMBOL(vme_register_bridge);
> -
> -void vme_unregister_bridge(struct vme_bridge *bridge)
> -{
> -	vme_remove_bus(bridge);
> -}
>  EXPORT_SYMBOL(vme_unregister_bridge);
>  
>  /* - Driver Registration --------------------------------------------------- */


-- 
Martyn Welch (Principal Software Engineer) | Registered in England and
GE Intelligent Platforms                   | Wales (3828642) at 100
T +44(0)1327322748                         | Barbirolli Square, Manchester,
E martyn.welch@ge.com                      | M2 3AB  VAT:GB 927559189

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

* Re: [PATCH 3/3] staging: vme: fix comment for struct vme_dev
  2011-11-04 10:12 ` [PATCH 3/3] staging: vme: fix comment for struct vme_dev Manohar Vanga
@ 2011-11-04 11:03   ` Martyn Welch
  0 siblings, 0 replies; 7+ messages in thread
From: Martyn Welch @ 2011-11-04 11:03 UTC (permalink / raw)
  To: Manohar Vanga; +Cc: gregkh, cota, devel, linux-kernel

On 04/11/11 10:12, Manohar Vanga wrote:
> Signed-off-by: Manohar Vanga <manohar.vanga@cern.ch>

Acked-by: Martyn Welch <martyn.welch@ge.com>

> ---
>  drivers/staging/vme/vme.h |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/drivers/staging/vme/vme.h b/drivers/staging/vme/vme.h
> index e3828ba..e62a323 100644
> --- a/drivers/staging/vme/vme.h
> +++ b/drivers/staging/vme/vme.h
> @@ -97,7 +97,7 @@ extern struct bus_type vme_bus_type;
>  
>  /**
>   * Structure representing a VME device
> - * @id: The ID of the device (currently the bus and slot number)
> + * @num: The device number
>   * @bridge: Pointer to the bridge device this device is on
>   * @dev: Internal device structure
>   * @drv_list: List of devices (per driver)


-- 
Martyn Welch (Principal Software Engineer) | Registered in England and
GE Intelligent Platforms                   | Wales (3828642) at 100
T +44(0)1327322748                         | Barbirolli Square, Manchester,
E martyn.welch@ge.com                      | M2 3AB  VAT:GB 927559189

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

end of thread, other threads:[~2011-11-04 11:09 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-11-04 10:12 [PATCH 0/3] VME driver fixes Manohar Vanga
2011-11-04 10:12 ` [PATCH 1/3] staging: vme: fix comment in __vme_register_driver() Manohar Vanga
2011-11-04 11:02   ` Martyn Welch
2011-11-04 10:12 ` [PATCH 2/3] staging: vme: remove vme_add_bus() and vme_remove_bus() Manohar Vanga
2011-11-04 11:02   ` Martyn Welch
2011-11-04 10:12 ` [PATCH 3/3] staging: vme: fix comment for struct vme_dev Manohar Vanga
2011-11-04 11:03   ` Martyn Welch

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).