* [patch 0/2] Add platform_device_del()
@ 2005-12-10 6:36 Dmitry Torokhov
2005-12-10 6:36 ` [patch 1/2] " Dmitry Torokhov
2005-12-10 6:36 ` [patch 2/2] Rearrange exports in platform.c Dmitry Torokhov
0 siblings, 2 replies; 5+ messages in thread
From: Dmitry Torokhov @ 2005-12-10 6:36 UTC (permalink / raw)
To: Greg KH; +Cc: LKML, Russell King, Jean Delvare
Hi,
OK, so here is the patch adding platform_device_del() that we were
discussing. The second patch just moves exports around so we do not
mix two styles in one source file.
Greg, if you are OK with it - are you going to push it or maybe I
should put it in my tree so I can publish pieces depending on this
as they are getting ready?
--
Dmitry
^ permalink raw reply [flat|nested] 5+ messages in thread
* [patch 1/2] Add platform_device_del()
2005-12-10 6:36 [patch 0/2] Add platform_device_del() Dmitry Torokhov
@ 2005-12-10 6:36 ` Dmitry Torokhov
2005-12-10 16:58 ` Jean Delvare
2005-12-10 6:36 ` [patch 2/2] Rearrange exports in platform.c Dmitry Torokhov
1 sibling, 1 reply; 5+ messages in thread
From: Dmitry Torokhov @ 2005-12-10 6:36 UTC (permalink / raw)
To: Greg KH; +Cc: LKML, Russell King, Jean Delvare
[-- Attachment #1: platform-device-del.patch --]
[-- Type: text/plain, Size: 3207 bytes --]
Driver core: add platform_device_del function
Having platform_device_del90 allows more straightforward error
handling code in drivers registering platform devices.
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
---
drivers/base/platform.c | 45 ++++++++++++++++++++++++++--------------
include/linux/platform_device.h | 1
2 files changed, 31 insertions(+), 15 deletions(-)
Index: work/drivers/base/platform.c
===================================================================
--- work.orig/drivers/base/platform.c
+++ work/drivers/base/platform.c
@@ -168,7 +168,7 @@ struct platform_device *platform_device_
pa->pdev.dev.release = platform_device_release;
}
- return pa ? &pa->pdev : NULL;
+ return pa ? &pa->pdev : NULL;
}
EXPORT_SYMBOL_GPL(platform_device_alloc);
@@ -282,24 +282,13 @@ int platform_device_add(struct platform_
EXPORT_SYMBOL_GPL(platform_device_add);
/**
- * platform_device_register - add a platform-level device
- * @pdev: platform device we're adding
- *
- */
-int platform_device_register(struct platform_device * pdev)
-{
- device_initialize(&pdev->dev);
- return platform_device_add(pdev);
-}
-
-/**
- * platform_device_unregister - remove a platform-level device
+ * platform_device_del - remove a platform-level device
* @pdev: platform device we're removing
*
* Note that this function will also release all memory- and port-based
* resources owned by the device (@dev->resource).
*/
-void platform_device_unregister(struct platform_device * pdev)
+void platform_device_del(struct platform_device *pdev)
{
int i;
@@ -310,9 +299,35 @@ void platform_device_unregister(struct p
release_resource(r);
}
- device_unregister(&pdev->dev);
+ device_del(&pdev->dev);
}
}
+EXPORT_SYMBOL_GPL(platform_device_del);
+
+/**
+ * platform_device_register - add a platform-level device
+ * @pdev: platform device we're adding
+ *
+ */
+int platform_device_register(struct platform_device * pdev)
+{
+ device_initialize(&pdev->dev);
+ return platform_device_add(pdev);
+}
+
+/**
+ * platform_device_unregister - unregister a platform-level device
+ * @pdev: platform device we're unregistering
+ *
+ * Unregistration is done in 2 steps. Fisrt we release all resources
+ * and remove it from the sybsystem, then we drop reference count by
+ * calling platform_device_put().
+ */
+void platform_device_unregister(struct platform_device * pdev)
+{
+ platform_device_del(pdev);
+ platform_device_put(pdev);
+}
/**
* platform_device_register_simple
Index: work/include/linux/platform_device.h
===================================================================
--- work.orig/include/linux/platform_device.h
+++ work/include/linux/platform_device.h
@@ -41,6 +41,7 @@ extern struct platform_device *platform_
extern int platform_device_add_resources(struct platform_device *pdev, struct resource *res, unsigned int num);
extern int platform_device_add_data(struct platform_device *pdev, void *data, size_t size);
extern int platform_device_add(struct platform_device *pdev);
+extern void platform_device_del(struct platform_device *pdev);
extern void platform_device_put(struct platform_device *pdev);
struct platform_driver {
^ permalink raw reply [flat|nested] 5+ messages in thread
* [patch 2/2] Rearrange exports in platform.c
2005-12-10 6:36 [patch 0/2] Add platform_device_del() Dmitry Torokhov
2005-12-10 6:36 ` [patch 1/2] " Dmitry Torokhov
@ 2005-12-10 6:36 ` Dmitry Torokhov
1 sibling, 0 replies; 5+ messages in thread
From: Dmitry Torokhov @ 2005-12-10 6:36 UTC (permalink / raw)
To: Greg KH; +Cc: LKML, Russell King, Jean Delvare
[-- Attachment #1: platform-rearange-exports.patch --]
[-- Type: text/plain, Size: 3076 bytes --]
Driver core: rearrange exports in platform.c
The new way is to specify export right after symbol definition.
Rearrange exports to follow new style to avoid mixing two styles
in one file.
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
---
drivers/base/platform.c | 21 ++++++++++-----------
1 files changed, 10 insertions(+), 11 deletions(-)
Index: work/drivers/base/platform.c
===================================================================
--- work.orig/drivers/base/platform.c
+++ work/drivers/base/platform.c
@@ -25,6 +25,7 @@
struct device platform_bus = {
.bus_id = "platform",
};
+EXPORT_SYMBOL_GPL(platform_bus);
/**
* platform_get_resource - get a resource for a device
@@ -49,6 +50,7 @@ platform_get_resource(struct platform_de
}
return NULL;
}
+EXPORT_SYMBOL_GPL(platform_get_resource);
/**
* platform_get_irq - get an IRQ for a device
@@ -61,6 +63,7 @@ int platform_get_irq(struct platform_dev
return r ? r->start : 0;
}
+EXPORT_SYMBOL_GPL(platform_get_irq);
/**
* platform_get_resource_byname - get a resource for a device by name
@@ -84,6 +87,7 @@ platform_get_resource_byname(struct plat
}
return NULL;
}
+EXPORT_SYMBOL_GPL(platform_get_resource_byname);
/**
* platform_get_irq - get an IRQ for a device
@@ -96,6 +100,7 @@ int platform_get_irq_byname(struct platf
return r ? r->start : 0;
}
+EXPORT_SYMBOL_GPL(platform_get_irq_byname);
/**
* platform_add_devices - add a numbers of platform devices
@@ -117,6 +122,7 @@ int platform_add_devices(struct platform
return ret;
}
+EXPORT_SYMBOL_GPL(platform_add_devices);
struct platform_object {
struct platform_device pdev;
@@ -314,6 +320,7 @@ int platform_device_register(struct plat
device_initialize(&pdev->dev);
return platform_device_add(pdev);
}
+EXPORT_SYMBOL_GPL(platform_device_register);
/**
* platform_device_unregister - unregister a platform-level device
@@ -328,6 +335,7 @@ void platform_device_unregister(struct p
platform_device_del(pdev);
platform_device_put(pdev);
}
+EXPORT_SYMBOL_GPL(platform_device_unregister);
/**
* platform_device_register_simple
@@ -370,6 +378,7 @@ error:
platform_device_put(pdev);
return ERR_PTR(retval);
}
+EXPORT_SYMBOL_GPL(platform_device_register_simple);
static int platform_drv_probe(struct device *_dev)
{
@@ -491,6 +500,7 @@ struct bus_type platform_bus_type = {
.suspend = platform_suspend,
.resume = platform_resume,
};
+EXPORT_SYMBOL_GPL(platform_bus_type);
int __init platform_bus_init(void)
{
@@ -519,14 +529,3 @@ u64 dma_get_required_mask(struct device
}
EXPORT_SYMBOL_GPL(dma_get_required_mask);
#endif
-
-EXPORT_SYMBOL_GPL(platform_bus);
-EXPORT_SYMBOL_GPL(platform_bus_type);
-EXPORT_SYMBOL_GPL(platform_add_devices);
-EXPORT_SYMBOL_GPL(platform_device_register);
-EXPORT_SYMBOL_GPL(platform_device_register_simple);
-EXPORT_SYMBOL_GPL(platform_device_unregister);
-EXPORT_SYMBOL_GPL(platform_get_irq);
-EXPORT_SYMBOL_GPL(platform_get_resource);
-EXPORT_SYMBOL_GPL(platform_get_irq_byname);
-EXPORT_SYMBOL_GPL(platform_get_resource_byname);
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [patch 1/2] Add platform_device_del()
2005-12-10 6:36 ` [patch 1/2] " Dmitry Torokhov
@ 2005-12-10 16:58 ` Jean Delvare
2005-12-10 17:47 ` Dmitry Torokhov
0 siblings, 1 reply; 5+ messages in thread
From: Jean Delvare @ 2005-12-10 16:58 UTC (permalink / raw)
To: Dmitry Torokhov; +Cc: Greg KH, LKML, Russell King
Hi Dmirty,
> Driver core: add platform_device_del function
>
> Having platform_device_del90 allows more straightforward error
> handling code in drivers registering platform devices.
> (...)
> +/**
> + * platform_device_unregister - unregister a platform-level device
> + * @pdev: platform device we're unregistering
> + *
> + * Unregistration is done in 2 steps. Fisrt we release all resources
> + * and remove it from the sybsystem, then we drop reference count by
Typo: subsystem.
> + * calling platform_device_put().
> + */
Other than that, and let alone the fact that I prefer code cleanups as
separate patches, and the fact that I don't think moving
platform_device_register() around adds much value, this patch looks
good to me.
Thanks,
--
Jean Delvare
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [patch 1/2] Add platform_device_del()
2005-12-10 16:58 ` Jean Delvare
@ 2005-12-10 17:47 ` Dmitry Torokhov
0 siblings, 0 replies; 5+ messages in thread
From: Dmitry Torokhov @ 2005-12-10 17:47 UTC (permalink / raw)
To: Jean Delvare; +Cc: Greg KH, LKML, Russell King
Hi Jean,
On Saturday 10 December 2005 11:58, Jean Delvare wrote:
> Hi Dmirty,
>
> > Driver core: add platform_device_del function
> >
> > Having platform_device_del90 allows more straightforward error
> > handling code in drivers registering platform devices.
> > (...)
> > +/**
> > + * platform_device_unregister - unregister a platform-level device
> > + * @pdev: platform device we're unregistering
> > + *
> > + * Unregistration is done in 2 steps. Fisrt we release all resources
> > + * and remove it from the sybsystem, then we drop reference count by
>
> Typo: subsystem.
Will fix, thank you for noticing.
>
> > + * calling platform_device_put().
> > + */
>
> Other than that, and let alone the fact that I prefer code cleanups as
> separate patches, and the fact that I don't think moving
> platform_device_register() around adds much value, this patch looks
> good to me.
>
It was not moved ;) platform_device_register() is and was in front of
platform_device_unregister. But because the new platform_device_del()
reused most of the platform_device_unregister() body patch plays a trick
on you making you believe that some code was moved around.
--
Dmitry
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2005-12-10 17:47 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-12-10 6:36 [patch 0/2] Add platform_device_del() Dmitry Torokhov
2005-12-10 6:36 ` [patch 1/2] " Dmitry Torokhov
2005-12-10 16:58 ` Jean Delvare
2005-12-10 17:47 ` Dmitry Torokhov
2005-12-10 6:36 ` [patch 2/2] Rearrange exports in platform.c Dmitry Torokhov
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.