Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
This commit is contained in:
Dominik Brodowski 2010-07-11 09:51:14 +02:00
Родитель b37fa16e78
Коммит 5716d415f8
10 изменённых файлов: 7 добавлений и 1383 удалений

Просмотреть файл

@ -116,29 +116,6 @@ Who: Mauro Carvalho Chehab <mchehab@infradead.org>
--------------------------- ---------------------------
What: PCMCIA control ioctl (needed for pcmcia-cs [cardmgr, cardctl])
When: 2.6.35/2.6.36
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 potentially harmful (it does not provide for
proper locking), 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/
For all architectures except ARM, the associated config symbol
has been removed from kernel 2.6.34; for ARM, it will be likely
be removed from kernel 2.6.35. The actual code will then likely
be removed from kernel 2.6.36.
Who: Dominik Brodowski <linux@dominikbrodowski.net>
---------------------------
What: sys_sysctl What: sys_sysctl
When: September 2010 When: September 2010
Option: CONFIG_SYSCTL_SYSCALL Option: CONFIG_SYSCTL_SYSCALL

Просмотреть файл

@ -7,7 +7,6 @@ pcmcia_core-$(CONFIG_CARDBUS) += cardbus.o
obj-$(CONFIG_PCCARD) += pcmcia_core.o obj-$(CONFIG_PCCARD) += pcmcia_core.o
pcmcia-y += ds.o pcmcia_resource.o cistpl.o pcmcia_cis.o pcmcia-y += ds.o pcmcia_resource.o cistpl.o pcmcia_cis.o
pcmcia-$(CONFIG_PCMCIA_IOCTL) += pcmcia_ioctl.o
obj-$(CONFIG_PCMCIA) += pcmcia.o obj-$(CONFIG_PCMCIA) += pcmcia.o
pcmcia_rsrc-y += rsrc_mgr.o pcmcia_rsrc-y += rsrc_mgr.o

Просмотреть файл

@ -60,14 +60,6 @@ struct pccard_resource_ops {
struct resource* (*find_mem) (unsigned long base, unsigned long num, struct resource* (*find_mem) (unsigned long base, unsigned long num,
unsigned long align, int low, unsigned long align, int low,
struct pcmcia_socket *s); struct pcmcia_socket *s);
int (*add_io) (struct pcmcia_socket *s,
unsigned int action,
unsigned long r_start,
unsigned long r_end);
int (*add_mem) (struct pcmcia_socket *s,
unsigned int action,
unsigned long r_start,
unsigned long r_end);
int (*init) (struct pcmcia_socket *s); int (*init) (struct pcmcia_socket *s);
void (*exit) (struct pcmcia_socket *s); void (*exit) (struct pcmcia_socket *s);
}; };
@ -146,6 +138,8 @@ void pcmcia_put_socket(struct pcmcia_socket *skt);
/* ds.c */ /* ds.c */
extern struct bus_type pcmcia_bus_type; extern struct bus_type pcmcia_bus_type;
struct pcmcia_device;
/* pcmcia_resource.c */ /* pcmcia_resource.c */
extern int pcmcia_release_configuration(struct pcmcia_device *p_dev); extern int pcmcia_release_configuration(struct pcmcia_device *p_dev);
extern int pcmcia_validate_mem(struct pcmcia_socket *s); extern int pcmcia_validate_mem(struct pcmcia_socket *s);
@ -188,34 +182,4 @@ int pccard_get_next_tuple(struct pcmcia_socket *s, unsigned int function,
int pccard_get_tuple_data(struct pcmcia_socket *s, tuple_t *tuple); int pccard_get_tuple_data(struct pcmcia_socket *s, tuple_t *tuple);
#ifdef CONFIG_PCMCIA_IOCTL
/* ds.c */
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);
/* pcmcia_ioctl.c */
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 /* CONFIG_PCMCIA_IOCTL */
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 0;
}
#endif /* CONFIG_PCMCIA_IOCTL */
#endif /* _LINUX_CS_INTERNAL_H */ #endif /* _LINUX_CS_INTERNAL_H */

Просмотреть файл

@ -213,7 +213,7 @@ EXPORT_SYMBOL(pcmcia_unregister_driver);
/* pcmcia_device handling */ /* pcmcia_device handling */
struct pcmcia_device *pcmcia_get_dev(struct pcmcia_device *p_dev) static struct pcmcia_device *pcmcia_get_dev(struct pcmcia_device *p_dev)
{ {
struct device *tmp_dev; struct device *tmp_dev;
tmp_dev = get_device(&p_dev->dev); tmp_dev = get_device(&p_dev->dev);
@ -222,7 +222,7 @@ struct pcmcia_device *pcmcia_get_dev(struct pcmcia_device *p_dev)
return to_pcmcia_dev(tmp_dev); return to_pcmcia_dev(tmp_dev);
} }
void pcmcia_put_dev(struct pcmcia_device *p_dev) static void pcmcia_put_dev(struct pcmcia_device *p_dev)
{ {
if (p_dev) if (p_dev)
put_device(&p_dev->dev); put_device(&p_dev->dev);
@ -477,7 +477,8 @@ static int pcmcia_device_query(struct pcmcia_device *p_dev)
} }
struct pcmcia_device *pcmcia_device_add(struct pcmcia_socket *s, unsigned int function) static struct pcmcia_device *pcmcia_device_add(struct pcmcia_socket *s,
unsigned int function)
{ {
struct pcmcia_device *p_dev, *tmp_dev; struct pcmcia_device *p_dev, *tmp_dev;
int i; int i;
@ -885,14 +886,6 @@ static int pcmcia_bus_match(struct device *dev, struct device_driver *drv)
} }
mutex_unlock(&p_drv->dynids.lock); mutex_unlock(&p_drv->dynids.lock);
#ifdef CONFIG_PCMCIA_IOCTL
/* matching by cardmgr */
if (p_dev->cardmgr == p_drv) {
dev_dbg(dev, "cardmgr matched to %s\n", drv->name);
return 1;
}
#endif
while (did && did->match_flags) { while (did && did->match_flags) {
dev_dbg(dev, "trying to match to %s\n", drv->name); dev_dbg(dev, "trying to match to %s\n", drv->name);
if (pcmcia_devmatch(p_dev, did)) { if (pcmcia_devmatch(p_dev, did)) {
@ -1245,7 +1238,6 @@ static int ds_event(struct pcmcia_socket *skt, event_t event, int priority)
case CS_EVENT_CARD_REMOVAL: case CS_EVENT_CARD_REMOVAL:
atomic_set(&skt->present, 0); atomic_set(&skt->present, 0);
pcmcia_card_remove(skt, NULL); pcmcia_card_remove(skt, NULL);
handle_event(skt, event);
mutex_lock(&s->ops_mutex); mutex_lock(&s->ops_mutex);
destroy_cis_cache(s); destroy_cis_cache(s);
pcmcia_cleanup_irq(s); pcmcia_cleanup_irq(s);
@ -1259,7 +1251,6 @@ static int ds_event(struct pcmcia_socket *skt, event_t event, int priority)
destroy_cis_cache(s); /* to be on the safe side... */ destroy_cis_cache(s); /* to be on the safe side... */
mutex_unlock(&s->ops_mutex); mutex_unlock(&s->ops_mutex);
pcmcia_card_add(skt); pcmcia_card_add(skt);
handle_event(skt, event);
break; break;
case CS_EVENT_EJECTION_REQUEST: case CS_EVENT_EJECTION_REQUEST:
@ -1280,14 +1271,12 @@ static int ds_event(struct pcmcia_socket *skt, event_t event, int priority)
ds_event(skt, CS_EVENT_CARD_INSERTION, ds_event(skt, CS_EVENT_CARD_INSERTION,
CS_EVENT_PRI_LOW); CS_EVENT_PRI_LOW);
} }
handle_event(skt, event);
break; break;
case CS_EVENT_PM_SUSPEND: case CS_EVENT_PM_SUSPEND:
case CS_EVENT_RESET_PHYSICAL: case CS_EVENT_RESET_PHYSICAL:
case CS_EVENT_CARD_RESET: case CS_EVENT_CARD_RESET:
default: default:
handle_event(skt, event);
break; break;
} }
@ -1350,9 +1339,6 @@ static int __devinit pcmcia_bus_add_socket(struct device *dev,
return ret; return ret;
} }
#ifdef CONFIG_PCMCIA_IOCTL
init_waitqueue_head(&socket->queue);
#endif
INIT_LIST_HEAD(&socket->devices_list); INIT_LIST_HEAD(&socket->devices_list);
memset(&socket->pcmcia_state, 0, sizeof(u8)); memset(&socket->pcmcia_state, 0, sizeof(u8));
socket->device_count = 0; socket->device_count = 0;
@ -1429,8 +1415,6 @@ static int __init init_pcmcia_bus(void)
return ret; return ret;
} }
pcmcia_setup_ioctl();
return 0; return 0;
} }
fs_initcall(init_pcmcia_bus); /* one level after subsys_initcall so that fs_initcall(init_pcmcia_bus); /* one level after subsys_initcall so that
@ -1439,8 +1423,6 @@ fs_initcall(init_pcmcia_bus); /* one level after subsys_initcall so that
static void __exit exit_pcmcia_bus(void) static void __exit exit_pcmcia_bus(void)
{ {
pcmcia_cleanup_ioctl();
class_interface_unregister(&pcmcia_bus_interface); class_interface_unregister(&pcmcia_bus_interface);
bus_unregister(&pcmcia_bus_type); bus_unregister(&pcmcia_bus_type);

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -164,8 +164,6 @@ struct pccard_resource_ops pccard_iodyn_ops = {
.validate_mem = NULL, .validate_mem = NULL,
.find_io = iodyn_find_io, .find_io = iodyn_find_io,
.find_mem = NULL, .find_mem = NULL,
.add_io = NULL,
.add_mem = NULL,
.init = static_init, .init = static_init,
.exit = NULL, .exit = NULL,
}; };

Просмотреть файл

@ -62,8 +62,6 @@ struct pccard_resource_ops pccard_static_ops = {
.validate_mem = NULL, .validate_mem = NULL,
.find_io = static_find_io, .find_io = static_find_io,
.find_mem = NULL, .find_mem = NULL,
.add_io = NULL,
.add_mem = NULL,
.init = static_init, .init = static_init,
.exit = NULL, .exit = NULL,
}; };

Просмотреть файл

@ -1055,8 +1055,6 @@ struct pccard_resource_ops pccard_nonstatic_ops = {
.validate_mem = pcmcia_nonstatic_validate_mem, .validate_mem = pcmcia_nonstatic_validate_mem,
.find_io = nonstatic_find_io, .find_io = nonstatic_find_io,
.find_mem = nonstatic_find_mem_region, .find_mem = nonstatic_find_mem_region,
.add_io = adjust_io,
.add_mem = adjust_memory,
.init = nonstatic_init, .init = nonstatic_init,
.exit = nonstatic_release_resource_db, .exit = nonstatic_release_resource_db,
}; };

Просмотреть файл

@ -117,11 +117,6 @@ struct pcmcia_device {
u64 dma_mask; u64 dma_mask;
struct device dev; struct device dev;
#ifdef CONFIG_PCMCIA_IOCTL
/* device driver wanted by cardmgr */
struct pcmcia_driver *cardmgr;
#endif
/* data private to drivers */ /* data private to drivers */
void *priv; void *priv;
}; };
@ -211,208 +206,4 @@ void pcmcia_disable_device(struct pcmcia_device *p_dev);
#endif /* __KERNEL__ */ #endif /* __KERNEL__ */
/* Below, there are only definitions which are used by
* - the PCMCIA ioctl
* - deprecated PCMCIA userspace tools only
*
* here be dragons ... here be dragons ... here be dragons ... here be drag
*/
#if defined(CONFIG_PCMCIA_IOCTL) || !defined(__KERNEL__)
#if defined(__arm__) || defined(__mips__) || defined(__avr32__) || \
defined(__bfin__)
/* This (ioaddr_t) is exposed to userspace & hence cannot be changed. */
typedef u_int ioaddr_t;
#else
typedef u_short ioaddr_t;
#endif
/* for AdjustResourceInfo */
typedef struct adjust_t {
u_int Action;
u_int Resource;
u_int Attributes;
union {
struct memory {
u_long Base;
u_long Size;
} memory;
struct io {
ioaddr_t BasePort;
ioaddr_t NumPorts;
u_int IOAddrLines;
} io;
struct irq {
u_int IRQ;
} irq;
} resource;
} adjust_t;
/* Action field */
#define REMOVE_MANAGED_RESOURCE 1
#define ADD_MANAGED_RESOURCE 2
#define GET_FIRST_MANAGED_RESOURCE 3
#define GET_NEXT_MANAGED_RESOURCE 4
/* Resource field */
#define RES_MEMORY_RANGE 1
#define RES_IO_RANGE 2
#define RES_IRQ 3
/* Attribute field */
#define RES_IRQ_TYPE 0x03
#define RES_IRQ_TYPE_EXCLUSIVE 0
#define RES_IRQ_TYPE_TIME 1
#define RES_IRQ_TYPE_DYNAMIC 2
#define RES_IRQ_CSC 0x04
#define RES_SHARED 0x08
#define RES_RESERVED 0x10
#define RES_ALLOCATED 0x20
#define RES_REMOVED 0x40
typedef struct tuple_parse_t {
tuple_t tuple;
cisdata_t data[255];
cisparse_t parse;
} tuple_parse_t;
typedef struct win_info_t {
window_handle_t handle;
win_req_t window;
memreq_t map;
} win_info_t;
typedef struct bind_info_t {
dev_info_t dev_info;
u_char function;
struct pcmcia_device *instance;
char name[DEV_NAME_LEN];
u_short major, minor;
void *next;
} bind_info_t;
typedef struct mtd_info_t {
dev_info_t dev_info;
u_int Attributes;
u_int CardOffset;
} mtd_info_t;
typedef struct region_info_t {
u_int Attributes;
u_int CardOffset;
u_int RegionSize;
u_int AccessSpeed;
u_int BlockSize;
u_int PartMultiple;
u_char JedecMfr, JedecInfo;
memory_handle_t next;
} region_info_t;
#define REGION_TYPE 0x0001
#define REGION_TYPE_CM 0x0000
#define REGION_TYPE_AM 0x0001
#define REGION_PREFETCH 0x0008
#define REGION_CACHEABLE 0x0010
#define REGION_BAR_MASK 0xe000
#define REGION_BAR_SHIFT 13
/* For ReplaceCIS */
typedef struct cisdump_t {
u_int Length;
cisdata_t Data[CISTPL_MAX_CIS_SIZE];
} cisdump_t;
/* for GetConfigurationInfo */
typedef struct config_info_t {
u_char Function;
u_int Attributes;
u_int Vcc, Vpp1, Vpp2;
u_int IntType;
u_int ConfigBase;
u_char Status, Pin, Copy, Option, ExtStatus;
u_int Present;
u_int CardValues;
u_int AssignedIRQ;
u_int IRQAttributes;
ioaddr_t BasePort1;
ioaddr_t NumPorts1;
u_int Attributes1;
ioaddr_t BasePort2;
ioaddr_t NumPorts2;
u_int Attributes2;
u_int IOAddrLines;
} config_info_t;
/* For ValidateCIS */
typedef struct cisinfo_t {
u_int Chains;
} cisinfo_t;
typedef struct cs_status_t {
u_char Function;
event_t CardState;
event_t SocketState;
} cs_status_t;
typedef union ds_ioctl_arg_t {
adjust_t adjust;
config_info_t config;
tuple_t tuple;
tuple_parse_t tuple_parse;
client_req_t client_req;
cs_status_t status;
conf_reg_t conf_reg;
cisinfo_t cisinfo;
region_info_t region;
bind_info_t bind_info;
mtd_info_t mtd_info;
win_info_t win_info;
cisdump_t cisdump;
} ds_ioctl_arg_t;
#define DS_ADJUST_RESOURCE_INFO _IOWR('d', 2, adjust_t)
#define DS_GET_CONFIGURATION_INFO _IOWR('d', 3, config_info_t)
#define DS_GET_FIRST_TUPLE _IOWR('d', 4, tuple_t)
#define DS_GET_NEXT_TUPLE _IOWR('d', 5, tuple_t)
#define DS_GET_TUPLE_DATA _IOWR('d', 6, tuple_parse_t)
#define DS_PARSE_TUPLE _IOWR('d', 7, tuple_parse_t)
#define DS_RESET_CARD _IO ('d', 8)
#define DS_GET_STATUS _IOWR('d', 9, cs_status_t)
#define DS_ACCESS_CONFIGURATION_REGISTER _IOWR('d', 10, conf_reg_t)
#define DS_VALIDATE_CIS _IOR ('d', 11, cisinfo_t)
#define DS_SUSPEND_CARD _IO ('d', 12)
#define DS_RESUME_CARD _IO ('d', 13)
#define DS_EJECT_CARD _IO ('d', 14)
#define DS_INSERT_CARD _IO ('d', 15)
#define DS_GET_FIRST_REGION _IOWR('d', 16, region_info_t)
#define DS_GET_NEXT_REGION _IOWR('d', 17, region_info_t)
#define DS_REPLACE_CIS _IOWR('d', 18, cisdump_t)
#define DS_GET_FIRST_WINDOW _IOR ('d', 19, win_info_t)
#define DS_GET_NEXT_WINDOW _IOWR('d', 20, win_info_t)
#define DS_GET_MEM_PAGE _IOWR('d', 21, win_info_t)
#define DS_BIND_REQUEST _IOWR('d', 60, bind_info_t)
#define DS_GET_DEVICE_INFO _IOWR('d', 61, bind_info_t)
#define DS_GET_NEXT_DEVICE _IOWR('d', 62, bind_info_t)
#define DS_UNBIND_REQUEST _IOW ('d', 63, bind_info_t)
#define DS_BIND_MTD _IOWR('d', 64, mtd_info_t)
/* used in userspace only */
#define CS_IN_USE 0x1e
#define INFO_MASTER_CLIENT 0x01
#define INFO_IO_CLIENT 0x02
#define INFO_MTD_CLIENT 0x04
#define INFO_MEM_CLIENT 0x08
#define MAX_NUM_CLIENTS 3
#define INFO_CARD_SHARE 0x10
#define INFO_CARD_EXCL 0x20
#endif /* !defined(__KERNEL__) || defined(CONFIG_PCMCIA_IOCTL) */
#endif /* _LINUX_DS_H */ #endif /* _LINUX_DS_H */

Просмотреть файл

@ -220,12 +220,10 @@ struct pcmcia_socket {
/* 16-bit state: */ /* 16-bit state: */
struct { struct {
/* "master" ioctl is used */
u8 busy:1;
/* the PCMCIA card consists of two pseudo devices */ /* the PCMCIA card consists of two pseudo devices */
u8 has_pfc:1; u8 has_pfc:1;
u8 reserved:6; u8 reserved:7;
} pcmcia_state; } pcmcia_state;
/* non-zero if PCMCIA card is present */ /* non-zero if PCMCIA card is present */
@ -234,10 +232,6 @@ struct pcmcia_socket {
/* IRQ to be used by PCMCIA devices. May not be IRQ 0. */ /* IRQ to be used by PCMCIA devices. May not be IRQ 0. */
unsigned int pcmcia_irq; unsigned int pcmcia_irq;
#ifdef CONFIG_PCMCIA_IOCTL
struct user_info_t *user;
wait_queue_head_t queue;
#endif /* CONFIG_PCMCIA_IOCTL */
#endif /* CONFIG_PCMCIA */ #endif /* CONFIG_PCMCIA */
/* socket device */ /* socket device */