This patch contains the following possible cleanups:
- make needlessly global code static
- #if 0 the following unused global function:
- core.c: pnp_remove_device
- remove the following unneeded EXPORT_SYMBOL's:
- card.c: pnp_add_card
- card.c: pnp_remove_card
- card.c: pnp_add_card_device
- card.c: pnp_remove_card_device
- card.c: pnp_add_card_id
- core.c: pnp_register_protocol
- core.c: pnp_unregister_protocol
- core.c: pnp_add_device
- core.c: pnp_remove_device
- pnpacpi/core.c: pnpacpi_protocol
- driver.c: pnp_add_id
- isapnp/core.c: isapnp_read_byte
- manager.c: pnp_auto_config_dev
- resource.c: pnp_register_dependent_option
- resource.c: pnp_register_independent_option
- resource.c: pnp_register_irq_resource
- resource.c: pnp_register_dma_resource
- resource.c: pnp_register_port_resource
- resource.c: pnp_register_mem_resource
Signed-off-by: Adrian Bunk <[email protected]>
---
This patch was already sent on:
- 27 Feb 2005
drivers/pnp/card.c | 7 +------
drivers/pnp/core.c | 7 ++-----
drivers/pnp/driver.c | 1 -
drivers/pnp/isapnp/core.c | 1 -
drivers/pnp/manager.c | 1 -
drivers/pnp/pnpacpi/core.c | 5 ++---
drivers/pnp/resource.c | 8 --------
include/linux/pnp.h | 2 --
8 files changed, 5 insertions(+), 27 deletions(-)
--- linux-2.6.11-rc4-mm1-full/drivers/pnp/card.c.old 2005-02-26 15:54:16.000000000 +0100
+++ linux-2.6.11-rc4-mm1-full/drivers/pnp/card.c 2005-02-26 16:16:07.000000000 +0100
@@ -19,7 +19,7 @@
#include "base.h"
LIST_HEAD(pnp_cards);
-LIST_HEAD(pnp_card_drivers);
+static LIST_HEAD(pnp_card_drivers);
static const struct pnp_card_device_id * match_card(struct pnp_card_driver * drv, struct pnp_card * card)
@@ -380,11 +380,6 @@
pnp_unregister_driver(&drv->link);
}
-EXPORT_SYMBOL(pnp_add_card);
-EXPORT_SYMBOL(pnp_remove_card);
-EXPORT_SYMBOL(pnp_add_card_device);
-EXPORT_SYMBOL(pnp_remove_card_device);
-EXPORT_SYMBOL(pnp_add_card_id);
EXPORT_SYMBOL(pnp_request_card_device);
EXPORT_SYMBOL(pnp_release_card_device);
EXPORT_SYMBOL(pnp_register_card_driver);
--- linux-2.6.11-rc4-mm1-full/include/linux/pnp.h.old 2005-02-26 15:54:39.000000000 +0100
+++ linux-2.6.11-rc4-mm1-full/include/linux/pnp.h 2005-02-26 15:54:59.000000000 +0100
@@ -353,7 +353,6 @@
int pnp_register_protocol(struct pnp_protocol *protocol);
void pnp_unregister_protocol(struct pnp_protocol *protocol);
int pnp_add_device(struct pnp_dev *dev);
-void pnp_remove_device(struct pnp_dev *dev);
int pnp_device_attach(struct pnp_dev *pnp_dev);
void pnp_device_detach(struct pnp_dev *pnp_dev);
extern struct list_head pnp_global;
@@ -399,7 +398,6 @@
static inline void pnp_unregister_protocol(struct pnp_protocol *protocol) { }
static inline int pnp_init_device(struct pnp_dev *dev) { return -ENODEV; }
static inline int pnp_add_device(struct pnp_dev *dev) { return -ENODEV; }
-static inline void pnp_remove_device(struct pnp_dev *dev) { }
static inline int pnp_device_attach(struct pnp_dev *pnp_dev) { return -ENODEV; }
static inline void pnp_device_detach(struct pnp_dev *pnp_dev) { ; }
--- linux-2.6.11-rc4-mm1-full/drivers/pnp/core.c.old 2005-02-26 15:55:56.000000000 +0100
+++ linux-2.6.11-rc4-mm1-full/drivers/pnp/core.c 2005-02-26 16:48:31.000000000 +0100
@@ -158,13 +158,14 @@
*
* this function will free all mem used by dev
*/
-
+#if 0
void pnp_remove_device(struct pnp_dev *dev)
{
if (!dev || dev->card)
return;
__pnp_remove_device(dev);
}
+#endif /* 0 */
static int __init pnp_init(void)
{
@@ -174,7 +175,3 @@
subsys_initcall(pnp_init);
-EXPORT_SYMBOL(pnp_register_protocol);
-EXPORT_SYMBOL(pnp_unregister_protocol);
-EXPORT_SYMBOL(pnp_add_device);
-EXPORT_SYMBOL(pnp_remove_device);
--- linux-2.6.11-rc4-mm1-full/drivers/pnp/pnpacpi/core.c.old 2005-02-26 15:57:01.000000000 +0100
+++ linux-2.6.11-rc4-mm1-full/drivers/pnp/pnpacpi/core.c 2005-02-26 15:57:26.000000000 +0100
@@ -124,7 +124,7 @@
return ACPI_FAILURE(status) ? -ENODEV : 0;
}
-struct pnp_protocol pnpacpi_protocol = {
+static struct pnp_protocol pnpacpi_protocol = {
.name = "Plug and Play ACPI",
.get = pnpacpi_get_resources,
.set = pnpacpi_set_resources,
@@ -242,7 +242,7 @@
}
int pnpacpi_disabled __initdata;
-int __init pnpacpi_init(void)
+static int __init pnpacpi_init(void)
{
if (acpi_disabled || pnpacpi_disabled) {
pnp_info("PnP ACPI: disabled");
@@ -266,4 +266,3 @@
}
__setup("pnpacpi=", pnpacpi_setup);
-EXPORT_SYMBOL(pnpacpi_protocol);
--- linux-2.6.11-rc4-mm1-full/drivers/pnp/driver.c.old 2005-02-26 16:09:23.000000000 +0100
+++ linux-2.6.11-rc4-mm1-full/drivers/pnp/driver.c 2005-02-26 16:09:52.000000000 +0100
@@ -217,6 +217,5 @@
EXPORT_SYMBOL(pnp_register_driver);
EXPORT_SYMBOL(pnp_unregister_driver);
-EXPORT_SYMBOL(pnp_add_id);
EXPORT_SYMBOL(pnp_device_attach);
EXPORT_SYMBOL(pnp_device_detach);
--- linux-2.6.11-rc4-mm1-full/drivers/pnp/isapnp/core.c.old 2005-02-26 16:11:16.000000000 +0100
+++ linux-2.6.11-rc4-mm1-full/drivers/pnp/isapnp/core.c 2005-02-26 16:11:39.000000000 +0100
@@ -952,7 +952,6 @@
EXPORT_SYMBOL(isapnp_present);
EXPORT_SYMBOL(isapnp_cfg_begin);
EXPORT_SYMBOL(isapnp_cfg_end);
-EXPORT_SYMBOL(isapnp_read_byte);
EXPORT_SYMBOL(isapnp_write_byte);
static int isapnp_read_resources(struct pnp_dev *dev, struct pnp_resource_table *res)
--- linux-2.6.11-rc4-mm1-full/drivers/pnp/manager.c.old 2005-02-26 16:11:47.000000000 +0100
+++ linux-2.6.11-rc4-mm1-full/drivers/pnp/manager.c 2005-02-26 16:12:11.000000000 +0100
@@ -563,7 +563,6 @@
EXPORT_SYMBOL(pnp_manual_config_dev);
-EXPORT_SYMBOL(pnp_auto_config_dev);
EXPORT_SYMBOL(pnp_activate_dev);
EXPORT_SYMBOL(pnp_disable_dev);
EXPORT_SYMBOL(pnp_resource_change);
--- linux-2.6.11-rc4-mm1-full/drivers/pnp/resource.c.old 2005-02-26 16:12:19.000000000 +0100
+++ linux-2.6.11-rc4-mm1-full/drivers/pnp/resource.c 2005-02-26 16:13:37.000000000 +0100
@@ -478,14 +478,6 @@
}
-EXPORT_SYMBOL(pnp_register_dependent_option);
-EXPORT_SYMBOL(pnp_register_independent_option);
-EXPORT_SYMBOL(pnp_register_irq_resource);
-EXPORT_SYMBOL(pnp_register_dma_resource);
-EXPORT_SYMBOL(pnp_register_port_resource);
-EXPORT_SYMBOL(pnp_register_mem_resource);
-
-
/* format is: pnp_reserve_irq=irq1[,irq2] .... */
static int __init pnp_setup_reserve_irq(char *str)
This patch essential makes it impossible for PnP protocols to be
modules. Currently, they are all in-kernel. If that is acceptable...,
then this patch looks fine to me. Any comments?
Thanks,
Adam
On Fri, 2005-03-11 at 19:16 +0100, Adrian Bunk wrote:
> This patch contains the following possible cleanups:
> - make needlessly global code static
> - #if 0 the following unused global function:
> - core.c: pnp_remove_device
> - remove the following unneeded EXPORT_SYMBOL's:
> - card.c: pnp_add_card
> - card.c: pnp_remove_card
> - card.c: pnp_add_card_device
> - card.c: pnp_remove_card_device
> - card.c: pnp_add_card_id
> - core.c: pnp_register_protocol
> - core.c: pnp_unregister_protocol
> - core.c: pnp_add_device
> - core.c: pnp_remove_device
> - pnpacpi/core.c: pnpacpi_protocol
> - driver.c: pnp_add_id
> - isapnp/core.c: isapnp_read_byte
> - manager.c: pnp_auto_config_dev
> - resource.c: pnp_register_dependent_option
> - resource.c: pnp_register_independent_option
> - resource.c: pnp_register_irq_resource
> - resource.c: pnp_register_dma_resource
> - resource.c: pnp_register_port_resource
> - resource.c: pnp_register_mem_resource
>
> Signed-off-by: Adrian Bunk <[email protected]>
>
Adam Belay <[email protected]> wrote:
>
> This patch essential makes it impossible for PnP protocols to be
> modules. Currently, they are all in-kernel. If that is acceptable...,
> then this patch looks fine to me. Any comments?
You're the maintainer...
If someone converts a protocol to be moduar, presumably they will re-add
the needed exports to support that.
Are there likely to be any out-of-tree modular protocols in existence?
On Fri, 2005-03-11 at 16:23 -0800, Andrew Morton wrote:
> Adam Belay <[email protected]> wrote:
> >
> > This patch essential makes it impossible for PnP protocols to be
> > modules. Currently, they are all in-kernel. If that is acceptable...,
> > then this patch looks fine to me. Any comments?
>
> You're the maintainer...
I've been holding off on making many changes to PnP at the moment,
because I have been considering replacing it with a new (more modern and
ACPI capable) ISA/LPC bridge driver. This work would likely begin after
my PCI bridge driver rewrite is finished and merged (as the PCI work is
in some ways a prerequisite).
http://marc.theaimsgroup.com/?l=linux-kernel&m=111023821617705&w=2
Still, if there are changes to fix actual bugs, then I'm all for them.
Also a few features could be added. Specifically PnPBIOS
hotplug/docking station support. If anyone's interested, I may
implement it (and it would use some functions that were removed by this
patch). Furthermore, ISAPnP could be made a module. PnPBIOS probably
couldn't.
>
> If someone converts a protocol to be moduar, presumably they will re-add
> the needed exports to support that.
Correct.
>
> Are there likely to be any out-of-tree modular protocols in existence?
>
Not that I'm aware of.
So in short, I'd rather not remove them, because they take away from the
original design of the PnP layer.
Thanks,
Adam
> So in short, I'd rather not remove them, because they take away from the
> original design of the PnP layer.
s/they/it would
On Fri, Mar 11, 2005 at 07:44:56PM -0500, Adam Belay wrote:
> On Fri, 2005-03-11 at 16:23 -0800, Andrew Morton wrote:
> > Adam Belay <[email protected]> wrote:
> > >
> > > This patch essential makes it impossible for PnP protocols to be
> > > modules. Currently, they are all in-kernel. If that is acceptable...,
> > > then this patch looks fine to me. Any comments?
> >
> > You're the maintainer...
>
> I've been holding off on making many changes to PnP at the moment,
> because I have been considering replacing it with a new (more modern and
> ACPI capable) ISA/LPC bridge driver. This work would likely begin after
> my PCI bridge driver rewrite is finished and merged (as the PCI work is
> in some ways a prerequisite).
>
> http://marc.theaimsgroup.com/?l=linux-kernel&m=111023821617705&w=2
>
> Still, if there are changes to fix actual bugs, then I'm all for them.
>
> Also a few features could be added. Specifically PnPBIOS
> hotplug/docking station support. If anyone's interested, I may
> implement it (and it would use some functions that were removed by this
> patch). Furthermore, ISAPnP could be made a module. PnPBIOS probably
> couldn't.
>...
Note that my patch #if 0's exactly one functions and removes no
functions. Most it does is the removal of EXPORT_SYMBOL's, so if any
modular code will use any of them, re-adding will be trivial.
Modular ISAPnP might be interesting in some cases, but this is more
legacy code. If someone would work on it to sort all the issues out
(starting with the point that most users of __ISAPNP__ will have to be
fixed) re-adding the required EXPORT_SYMBOL's won't be hard for him.
> Thanks,
> Adam
cu
Adrian
--
"Is there not promise of rain?" Ling Tan asked suddenly out
of the darkness. There had been need of rain for many days.
"Only a promise," Lao Er said.
Pearl S. Buck - Dragon Seed