2006-11-21 21:34:24

by Adrian Bunk

[permalink] [raw]
Subject: [RFC: 2.6 patch] the overdue removal of drivers/pcmcia/pcmcia_ioctl.c

This patch contains the overdue removal of drivers/pcmcia/pcmcia_ioctl.c
plus additional cleanups possible after this removal.

Signed-off-by: Adrian Bunk <[email protected]>

---

Documentation/Changes | 18
Documentation/feature-removal-schedule.txt | 17
arch/m68k/Kconfig | 4
arch/sparc/Kconfig | 4
arch/sparc64/Kconfig | 4
drivers/net/Kconfig | 3
drivers/pcmcia/Kconfig | 16
drivers/pcmcia/Makefile | 1
drivers/pcmcia/cs.c | 17
drivers/pcmcia/cs_internal.h | 3
drivers/pcmcia/ds.c | 32
drivers/pcmcia/ds_internal.h | 19
drivers/pcmcia/pcmcia_ioctl.c | 802 ---------------------
drivers/pcmcia/pcmcia_resource.c | 61 -
drivers/pcmcia/rsrc_mgr.c | 80 --
drivers/pnp/pnpbios/Kconfig | 3
include/pcmcia/cs.h | 1
include/pcmcia/ds.h | 48 -
include/pcmcia/ss.h | 6
scripts/ver_linux | 3
20 files changed, 22 insertions(+), 1120 deletions(-)

--- linux-2.6.14-mm1-full/Documentation/feature-removal-schedule.txt.old 2005-11-07 19:31:51.000000000 +0100
+++ linux-2.6.14-mm1-full/Documentation/feature-removal-schedule.txt 2005-11-07 19:32:09.000000000 +0100
@@ -92,23 +92,6 @@

---------------------------

-What: PCMCIA control ioctl (needed for pcmcia-cs [cardmgr, cardctl])
-When: November 2005
-Files: drivers/pcmcia/: pcmcia_ioctl.c
-Why: With the 16-bit PCMCIA subsystem now behaving (almost) like a
- normal hotpluggable bus, and with it using the default kernel
- infrastructure (hotplug, driver core, sysfs) keeping the PCMCIA
- control ioctl needed by cardmgr and cardctl from pcmcia-cs is
- unnecessary, and makes further cleanups and integration of the
- PCMCIA subsystem into the Linux kernel device driver model more
- difficult. The features provided by cardmgr and cardctl are either
- handled by the kernel itself now or are available in the new
- pcmciautils package available at
- http://kernel.org/pub/linux/utils/kernel/pcmcia/
-Who: Dominik Brodowski <[email protected]>
-
----------------------------
-
What: ip_queue and ip6_queue (old ipv4-only and ipv6-only netfilter queue)
When: December 2005
Why: This interface has been obsoleted by the new layer3-independent
--- linux-2.6.14-mm1-full/drivers/pcmcia/Kconfig.old 2005-11-07 19:33:17.000000000 +0100
+++ linux-2.6.14-mm1-full/drivers/pcmcia/Kconfig 2005-11-07 19:43:18.000000000 +0100
@@ -65,21 +65,7 @@
to be loaded from userspace to work correctly. If you say Y here,
and your userspace is arranged correctly, this will be loaded
automatically using the in-kernel firmware loader and the hotplug
- subsystem, instead of relying on cardmgr from pcmcia-cs to do so.
-
- If unsure, say Y.
-
-config PCMCIA_IOCTL
- bool "PCMCIA control ioctl (obsolete)"
- depends on PCMCIA
- default y
- help
- If you say Y here, the deprecated ioctl interface to the PCMCIA
- subsystem will be built. It is needed by cardmgr and cardctl
- (pcmcia-cs) to function properly.
-
- You should use the new pcmciautils package instead (see
- <file:Documentation/Changes> for location and details).
+ subsystem.

If unsure, say Y.

--- linux-2.6.14-mm1-full/include/pcmcia/ss.h.old 2005-11-07 19:36:04.000000000 +0100
+++ linux-2.6.14-mm1-full/include/pcmcia/ss.h 2005-11-07 19:54:29.000000000 +0100
@@ -272,10 +272,6 @@
struct work_struct device_add; /* for adding further pseudo-multifunction
* devices */

-#ifdef CONFIG_PCMCIA_IOCTL
- struct user_info_t *user;
- wait_queue_head_t queue;
-#endif
#endif

/* cardbus (32-bit) */
@@ -290,8 +286,6 @@

};

-struct pcmcia_socket * pcmcia_get_socket_by_nr(unsigned int nr);
-


extern void pcmcia_parse_events(struct pcmcia_socket *socket, unsigned int events);
--- linux-2.6.14-mm1-full/include/pcmcia/cs.h.old 2005-11-07 19:55:12.000000000 +0100
+++ linux-2.6.14-mm1-full/include/pcmcia/cs.h 2005-11-07 20:02:24.000000000 +0100
@@ -387,7 +387,6 @@
int pcmcia_get_first_window(window_handle_t *win, win_req_t *req);
int pcmcia_get_next_window(window_handle_t *win, win_req_t *req);
int pcmcia_get_status(struct pcmcia_device *p_dev, cs_status_t *status);
-int pcmcia_get_mem_page(window_handle_t win, memreq_t *req);
int pcmcia_map_mem_page(window_handle_t win, memreq_t *req);
int pcmcia_modify_configuration(struct pcmcia_device *p_dev, modconf_t *mod);
int pcmcia_register_client(client_handle_t *handle, client_reg_t *req);
--- linux-2.6.14-mm1-full/arch/m68k/Kconfig.old 2005-11-07 19:37:26.000000000 +0100
+++ linux-2.6.14-mm1-full/arch/m68k/Kconfig 2005-11-07 19:37:32.000000000 +0100
@@ -69,9 +69,7 @@
and the newer 32 bit CardBus cards. If you want to use CardBus
cards, you need to say Y here and also to "CardBus support" below.

- To use your PC-cards, you will need supporting software from David
- Hinds' pcmcia-cs package (see the file <file:Documentation/Changes>
- for location). Please also read the PCMCIA-HOWTO, available from
+ Please also read the PCMCIA-HOWTO, available from
<http://www.tldp.org/docs.html#howto>.

To compile this driver as modules, choose M here: the
--- linux-2.6.14-mm1-full/arch/sparc/Kconfig.old 2005-11-07 19:37:45.000000000 +0100
+++ linux-2.6.14-mm1-full/arch/sparc/Kconfig 2005-11-07 19:37:53.000000000 +0100
@@ -97,9 +97,7 @@
and the newer 32 bit CardBus cards. If you want to use CardBus
cards, you need to say Y here and also to "CardBus support" below.

- To use your PC-cards, you will need supporting software from David
- Hinds' pcmcia-cs package (see the file <file:Documentation/Changes>
- for location). Please also read the PCMCIA-HOWTO, available from
+ Please also read the PCMCIA-HOWTO, available from
<http://www.tldp.org/docs.html#howto>.

To compile this driver as modules, choose M here: the
--- linux-2.6.14-mm1-full/arch/sparc64/Kconfig.old 2005-11-07 19:38:01.000000000 +0100
+++ linux-2.6.14-mm1-full/arch/sparc64/Kconfig 2005-11-07 19:38:07.000000000 +0100
@@ -241,9 +241,7 @@
and the newer 32 bit CardBus cards. If you want to use CardBus
cards, you need to say Y here and also to "CardBus support" below.

- To use your PC-cards, you will need supporting software from David
- Hinds' pcmcia-cs package (see the file <file:Documentation/Changes>
- for location). Please also read the PCMCIA-HOWTO, available from
+ Please also read the PCMCIA-HOWTO, available from
<http://www.tldp.org/docs.html#howto>.

To compile this driver as modules, choose M here: the
--- linux-2.6.14-mm1-full/Documentation/Changes.old 2005-11-07 19:38:28.000000000 +0100
+++ linux-2.6.14-mm1-full/Documentation/Changes 2005-11-07 19:39:30.000000000 +0100
@@ -204,17 +203,9 @@
PCMCIAutils
-----------

-PCMCIAutils replaces pcmcia-cs (see below). It properly sets up
-PCMCIA sockets at system startup and loads the appropriate modules
-for 16-bit PCMCIA devices if the kernel is modularized and the hotplug
-subsystem is used.
-
-Pcmcia-cs
----------
-
-PCMCIA (PC Card) support is now partially implemented in the main
-kernel source. The "pcmciautils" package (see above) replaces pcmcia-cs
-for newest kernels.
+PCMCIAutils replaces pcmcia-cs. It properly sets up PCMCIA sockets at
+system startup and loads the appropriate modules for 16-bit PCMCIA
+devices if the kernel is modularized and the hotplug subsystem is used.

Quota-tools
-----------
@@ -385,10 +376,6 @@
-----------
o <ftp://ftp.kernel.org/pub/linux/utils/kernel/pcmcia/>

-Pcmcia-cs
----------
-o <http://pcmcia-cs.sourceforge.net/>
-
Quota-tools
----------
o <http://sourceforge.net/projects/linuxquota/>
--- linux-2.6.14-mm1-full/drivers/net/Kconfig.old 2005-11-07 19:41:56.000000000 +0100
+++ linux-2.6.14-mm1-full/drivers/net/Kconfig 2005-11-07 19:42:21.000000000 +0100
@@ -1709,8 +1709,7 @@
If you want to plug a network (or some other) card into the PCMCIA
(or PC-card) slot of your laptop instead (PCMCIA is the standard for
credit card size extension cards used by all modern laptops), you
- need the pcmcia-cs package (location contained in the file
- <file:Documentation/Changes>) and you can say N here.
+ can say N here.

Laptop users should read the Linux Laptop home page at
<http://www.linux-on-laptops.com/> or
--- linux-2.6.14-mm1-full/drivers/pnp/pnpbios/Kconfig.old 2005-11-07 19:43:33.000000000 +0100
+++ linux-2.6.14-mm1-full/drivers/pnp/pnpbios/Kconfig 2005-11-07 19:43:40.000000000 +0100
@@ -34,9 +34,6 @@
Also some buggy systems will fault when accessing certain features
in the PNPBIOS /proc interface (e.g. "boot" configs).

- See the latest pcmcia-cs (stand-alone package) for a nice set of
- PNPBIOS /proc interface tools (lspnp and setpnp).
-
Unless you are debugging or have other specific reasons, it is
recommended that you say N here.

--- linux-2.6.14-mm1-full/scripts/ver_linux.old 2005-11-07 19:44:04.000000000 +0100
+++ linux-2.6.14-mm1-full/scripts/ver_linux 2005-11-07 19:44:09.000000000 +0100
@@ -48,9 +48,6 @@
xfs_db -V 2>&1 | grep version | awk \
'NR==1{print "xfsprogs ", $3}'

-cardmgr -V 2>&1| grep version | awk \
-'NR==1{print "pcmcia-cs ", $3}'
-
quota -V 2>&1 | grep version | awk \
'NR==1{print "quota-tools ", $NF}'

--- linux-2.6.16-mm1-full/drivers/pcmcia/Makefile.old 2006-03-24 01:35:01.000000000 +0100
+++ linux-2.6.16-mm1-full/drivers/pcmcia/Makefile 2006-03-24 01:35:35.000000000 +0100
@@ -11,7 +11,6 @@
obj-$(CONFIG_PCCARD) += pcmcia_core.o

pcmcia-y += ds.o pcmcia_resource.o
-pcmcia-$(CONFIG_PCMCIA_IOCTL) += pcmcia_ioctl.o
obj-$(CONFIG_PCMCIA) += pcmcia.o

obj-$(CONFIG_PCCARD_NONSTATIC) += rsrc_nonstatic.o
--- linux-2.6.16-mm1-full/drivers/pcmcia/rsrc_mgr.c.old 2006-03-24 01:37:57.000000000 +0100
+++ linux-2.6.16-mm1-full/drivers/pcmcia/rsrc_mgr.c 2006-03-24 01:38:13.000000000 +0100
@@ -21,86 +21,6 @@
#include "cs_internal.h"


-#ifdef CONFIG_PCMCIA_IOCTL
-
-#ifdef CONFIG_PCMCIA_PROBE
-
-static int adjust_irq(struct pcmcia_socket *s, adjust_t *adj)
-{
- int irq;
- u32 mask;
-
- irq = adj->resource.irq.IRQ;
- if ((irq < 0) || (irq > 15))
- return CS_BAD_IRQ;
-
- if (adj->Action != REMOVE_MANAGED_RESOURCE)
- return 0;
-
- mask = 1 << irq;
-
- if (!(s->irq_mask & mask))
- return 0;
-
- s->irq_mask &= ~mask;
-
- return 0;
-}
-
-#else
-
-static inline int adjust_irq(struct pcmcia_socket *s, adjust_t *adj) {
- return CS_SUCCESS;
-}
-
-#endif
-
-
-int pcmcia_adjust_resource_info(adjust_t *adj)
-{
- struct pcmcia_socket *s;
- int ret = CS_UNSUPPORTED_FUNCTION;
- unsigned long flags;
-
- down_read(&pcmcia_socket_list_rwsem);
- list_for_each_entry(s, &pcmcia_socket_list, socket_list) {
-
- if (adj->Resource == RES_IRQ)
- ret = adjust_irq(s, adj);
-
- else if (s->resource_ops->adjust_resource) {
-
- /* you can't use the old interface if the new
- * one was used before */
- spin_lock_irqsave(&s->lock, flags);
- if ((s->resource_setup_new) &&
- !(s->resource_setup_old)) {
- spin_unlock_irqrestore(&s->lock, flags);
- continue;
- } else if (!(s->resource_setup_old))
- s->resource_setup_old = 1;
- spin_unlock_irqrestore(&s->lock, flags);
-
- ret = s->resource_ops->adjust_resource(s, adj);
- if (!ret) {
- /* as there's no way we know this is the
- * last call to adjust_resource_info, we
- * always need to assume this is the latest
- * one... */
- spin_lock_irqsave(&s->lock, flags);
- s->resource_setup_done = 1;
- spin_unlock_irqrestore(&s->lock, flags);
- }
- }
- }
- up_read(&pcmcia_socket_list_rwsem);
-
- return (ret);
-}
-EXPORT_SYMBOL(pcmcia_adjust_resource_info);
-
-#endif
-
int pcmcia_validate_mem(struct pcmcia_socket *s)
{
if (s->resource_ops->validate_mem)
--- linux-2.6.16-mm1-full/drivers/pcmcia/cs_internal.h.old 2006-03-24 01:38:44.000000000 +0100
+++ linux-2.6.16-mm1-full/drivers/pcmcia/cs_internal.h 2006-03-24 01:39:19.000000000 +0100
@@ -126,10 +126,7 @@
/* In cs.c */
extern struct rw_semaphore pcmcia_socket_list_rwsem;
extern struct list_head pcmcia_socket_list;
-int pcmcia_get_window(struct pcmcia_socket *s, window_handle_t *handle, int idx, win_req_t *req);
-int pccard_get_configuration_info(struct pcmcia_socket *s, struct pcmcia_device *p_dev, config_info_t *config);
int pccard_reset_card(struct pcmcia_socket *skt);
-int pccard_get_status(struct pcmcia_socket *s, struct pcmcia_device *p_dev, cs_status_t *status);


struct pcmcia_callback{
--- linux-2.6.16-mm1-full/drivers/pcmcia/cs.c.old 2006-03-24 01:41:04.000000000 +0100
+++ linux-2.6.16-mm1-full/drivers/pcmcia/cs.c 2006-03-24 01:43:39.000000000 +0100
@@ -291,23 +291,6 @@
EXPORT_SYMBOL(pcmcia_unregister_socket);


-struct pcmcia_socket * pcmcia_get_socket_by_nr(unsigned int nr)
-{
- struct pcmcia_socket *s;
-
- down_read(&pcmcia_socket_list_rwsem);
- list_for_each_entry(s, &pcmcia_socket_list, socket_list)
- if (s->sock == nr) {
- up_read(&pcmcia_socket_list_rwsem);
- return s;
- }
- up_read(&pcmcia_socket_list_rwsem);
-
- return NULL;
-
-}
-EXPORT_SYMBOL(pcmcia_get_socket_by_nr);
-
/**
* The central event handler. Send_event() sends an event to the
* 16-bit subsystem, which then calls the relevant device drivers.
--- linux-2.6.16-mm1-full/drivers/pcmcia/pcmcia_resource.c.old 2006-03-24 01:45:21.000000000 +0100
+++ linux-2.6.16-mm1-full/drivers/pcmcia/pcmcia_resource.c 2006-03-24 01:45:59.000000000 +0100
@@ -200,9 +199,9 @@
EXPORT_SYMBOL(pcmcia_access_configuration_register);


-int pccard_get_configuration_info(struct pcmcia_socket *s,
- struct pcmcia_device *p_dev,
- config_info_t *config)
+static int pccard_get_configuration_info(struct pcmcia_socket *s,
+ struct pcmcia_device *p_dev,
+ config_info_t *config)
{
config_t *c;

@@ -265,40 +264,6 @@
EXPORT_SYMBOL(pcmcia_get_configuration_info);


-/** pcmcia_get_window
- */
-int pcmcia_get_window(struct pcmcia_socket *s, window_handle_t *handle,
- int idx, win_req_t *req)
-{
- window_t *win;
- int w;
-
- if (!s || !(s->state & SOCKET_PRESENT))
- return CS_NO_CARD;
- for (w = idx; w < MAX_WIN; w++)
- if (s->state & SOCKET_WIN_REQ(w))
- break;
- if (w == MAX_WIN)
- return CS_NO_MORE_ITEMS;
- win = &s->win[w];
- req->Base = win->ctl.res->start;
- req->Size = win->ctl.res->end - win->ctl.res->start + 1;
- req->AccessSpeed = win->ctl.speed;
- req->Attributes = 0;
- if (win->ctl.flags & MAP_ATTRIB)
- req->Attributes |= WIN_MEMORY_TYPE_AM;
- if (win->ctl.flags & MAP_ACTIVE)
- req->Attributes |= WIN_ENABLE;
- if (win->ctl.flags & MAP_16BIT)
- req->Attributes |= WIN_DATA_WIDTH_16;
- if (win->ctl.flags & MAP_USE_WAIT)
- req->Attributes |= WIN_USE_WAIT;
- *handle = win;
- return CS_SUCCESS;
-} /* pcmcia_get_window */
-EXPORT_SYMBOL(pcmcia_get_window);
-
-
/** pccard_get_status
*
* Get the current socket state bits. We don't support the latched
@@ -367,21 +332,6 @@



-/** pcmcia_get_mem_page
- *
- * Change the card address of an already open memory window.
- */
-int pcmcia_get_mem_page(window_handle_t win, memreq_t *req)
-{
- if ((win == NULL) || (win->magic != WINDOW_MAGIC))
- return CS_BAD_HANDLE;
- req->Page = 0;
- req->CardOffset = win->ctl.card_start;
- return CS_SUCCESS;
-} /* pcmcia_get_mem_page */
-EXPORT_SYMBOL(pcmcia_get_mem_page);
-
-
int pcmcia_map_mem_page(window_handle_t win, memreq_t *req)
{
struct pcmcia_socket *s;
--- linux-2.6.16-mm1-full/drivers/pcmcia/ds_internal.h.old 2006-03-24 02:06:28.000000000 +0100
+++ linux-2.6.16-mm1-full/drivers/pcmcia/ds_internal.h 2006-03-24 02:06:41.000000000 +0100
@@ -1,23 +1,4 @@
/* ds_internal.h - internal header for 16-bit PCMCIA devices management */

-extern spinlock_t pcmcia_dev_list_lock;
-extern struct bus_type pcmcia_bus_type;
-
-extern struct pcmcia_device * pcmcia_get_dev(struct pcmcia_device *p_dev);
-extern void pcmcia_put_dev(struct pcmcia_device *p_dev);
-
-struct pcmcia_device * pcmcia_device_add(struct pcmcia_socket *s, unsigned int function);
-
extern int pcmcia_release_configuration(struct pcmcia_device *p_dev);

-#ifdef CONFIG_PCMCIA_IOCTL
-extern void __init pcmcia_setup_ioctl(void);
-extern void __exit pcmcia_cleanup_ioctl(void);
-extern void handle_event(struct pcmcia_socket *s, event_t event);
-extern int handle_request(struct pcmcia_socket *s, event_t event);
-#else
-static inline void __init pcmcia_setup_ioctl(void) { return; }
-static inline void __exit pcmcia_cleanup_ioctl(void) { return; }
-static inline void handle_event(struct pcmcia_socket *s, event_t event) { return; }
-static inline int handle_request(struct pcmcia_socket *s, event_t event) { return CS_SUCCESS; }
-#endif
--- linux-2.6.16-mm1-full/drivers/pcmcia/pcmcia_resource.c.old 2006-03-24 02:14:23.000000000 +0100
+++ linux-2.6.16-mm1-full/drivers/pcmcia/pcmcia_resource.c 2006-03-24 02:14:51.000000000 +0100
@@ -271,8 +271,9 @@
* SocketState yet: I haven't seen any point for it.
*/

-int pccard_get_status(struct pcmcia_socket *s, struct pcmcia_device *p_dev,
- cs_status_t *status)
+static int pccard_get_status(struct pcmcia_socket *s,
+ struct pcmcia_device *p_dev,
+ cs_status_t *status)
{
config_t *c;
int val;


2006-11-21 21:46:25

by Russell King

[permalink] [raw]
Subject: Re: [RFC: 2.6 patch] the overdue removal of drivers/pcmcia/pcmcia_ioctl.c

On Tue, Nov 21, 2006 at 10:34:19PM +0100, Adrian Bunk wrote:
> This patch contains the overdue removal of drivers/pcmcia/pcmcia_ioctl.c
> plus additional cleanups possible after this removal.

There are still systems around which (a) use cardmgr rather than the new
pcmcia utils, and (b) applications make direct ioctl calls to the kernel
PCMCIA layer external to the pcmcia-cs packages.

Like it or not, the PCMCIA ioctls are a well-established API.

--
Russell King
Linux kernel 2.6 ARM Linux - http://www.arm.linux.org.uk/
maintainer of: 2.6 Serial core