Skip to content

Commit

Permalink
pcmcia: card services header cleanup
Browse files Browse the repository at this point in the history
16-bit PCMCIA device handling function definitions are moved to ds.h,
internal definitions to cs_internal.h.

Signed-off-by: Dominik Brodowski <[email protected]>
  • Loading branch information
Dominik Brodowski committed Aug 31, 2008
1 parent 35200d8 commit 994917f
Show file tree
Hide file tree
Showing 9 changed files with 76 additions and 77 deletions.
2 changes: 1 addition & 1 deletion drivers/char/pcmcia/ipwireless/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ static void signalled_reboot_work(struct work_struct *work_reboot)
struct ipw_dev *ipw = container_of(work_reboot, struct ipw_dev,
work_reboot);
struct pcmcia_device *link = ipw->link;
int ret = pccard_reset_card(link->socket);
int ret = pcmcia_reset_card(link->socket);

if (ret != 0)
cs_error(link, ResetCard, ret);
Expand Down
2 changes: 1 addition & 1 deletion drivers/net/pcmcia/nmclan_cs.c
Original file line number Diff line number Diff line change
Expand Up @@ -925,7 +925,7 @@ static void mace_tx_timeout(struct net_device *dev)
printk(KERN_NOTICE "%s: transmit timed out -- ", dev->name);
#if RESET_ON_TIMEOUT
printk("resetting card\n");
pcmcia_reset_card(link, NULL);
pcmcia_reset_card(link->socket);
#else /* #if RESET_ON_TIMEOUT */
printk("NOT resetting card\n");
#endif /* #if RESET_ON_TIMEOUT */
Expand Down
2 changes: 1 addition & 1 deletion drivers/net/wireless/orinoco_cs.c
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ orinoco_cs_hard_reset(struct orinoco_private *priv)
/* We need atomic ops here, because we're not holding the lock */
set_bit(0, &card->hard_reset_in_progress);

err = pcmcia_reset_card(link, NULL);
err = pcmcia_reset_card(link->socket);
if (err)
return err;

Expand Down
4 changes: 2 additions & 2 deletions drivers/pcmcia/cs.c
Original file line number Diff line number Diff line change
Expand Up @@ -752,7 +752,7 @@ EXPORT_SYMBOL(pccard_register_pcmcia);
* CIS register.
*/

int pccard_reset_card(struct pcmcia_socket *skt)
int pcmcia_reset_card(struct pcmcia_socket *skt)
{
int ret;

Expand Down Expand Up @@ -791,7 +791,7 @@ int pccard_reset_card(struct pcmcia_socket *skt)

return ret;
} /* reset_card */
EXPORT_SYMBOL(pccard_reset_card);
EXPORT_SYMBOL(pcmcia_reset_card);


/* These shut down or wake up a socket. They are sort of user
Expand Down
12 changes: 11 additions & 1 deletion drivers/pcmcia/cs_internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -174,10 +174,18 @@ int pcmcia_get_window(struct pcmcia_socket *s,
window_handle_t *handle,
int idx,
win_req_t *req);
int pccard_reset_card(struct pcmcia_socket *skt);
int pccard_register_pcmcia(struct pcmcia_socket *s, struct pcmcia_callback *c);
struct pcmcia_socket *pcmcia_get_socket_by_nr(unsigned int nr);

int pcmcia_suspend_card(struct pcmcia_socket *skt);
int pcmcia_resume_card(struct pcmcia_socket *skt);

int pcmcia_eject_card(struct pcmcia_socket *skt);
int pcmcia_insert_card(struct pcmcia_socket *skt);

struct pcmcia_socket *pcmcia_get_socket(struct pcmcia_socket *skt);
void pcmcia_put_socket(struct pcmcia_socket *skt);

/* cistpl.c */
int pcmcia_read_cis_mem(struct pcmcia_socket *s, int attr,
u_int addr, u_int len, void *ptr);
Expand All @@ -187,6 +195,8 @@ void release_cis_mem(struct pcmcia_socket *s);
void destroy_cis_cache(struct pcmcia_socket *s);
int pccard_read_tuple(struct pcmcia_socket *s, unsigned int function,
cisdata_t code, void *parse);
int pcmcia_replace_cis(struct pcmcia_socket *s,
const u8 *data, const size_t len);

/* rsrc_mgr.c */
int pcmcia_validate_mem(struct pcmcia_socket *s);
Expand Down
2 changes: 1 addition & 1 deletion drivers/pcmcia/pcmcia_ioctl.c
Original file line number Diff line number Diff line change
Expand Up @@ -861,7 +861,7 @@ static int ds_ioctl(struct inode * inode, struct file * file,
ret = pccard_parse_tuple(&buf->tuple, &buf->tuple_parse.parse);
break;
case DS_RESET_CARD:
ret = pccard_reset_card(s);
ret = pcmcia_reset_card(s);
break;
case DS_GET_STATUS:
if (buf->status.Function &&
Expand Down
6 changes: 4 additions & 2 deletions include/pcmcia/cistpl.h
Original file line number Diff line number Diff line change
Expand Up @@ -580,8 +580,8 @@ typedef struct cisinfo_t {

#define CISTPL_MAX_CIS_SIZE 0x200

int pcmcia_replace_cis(struct pcmcia_socket *s,
const u8 *data, const size_t len);
#ifdef __KERNEL__
struct pcmcia_socket;

/* don't use outside of PCMCIA core yet */
int pccard_get_next_tuple(struct pcmcia_socket *s, unsigned int func, tuple_t *tuple);
Expand Down Expand Up @@ -615,4 +615,6 @@ int pcmcia_loop_config(struct pcmcia_device *p_dev,
void *priv_data),
void *priv_data);

#endif /* __KERNEL__ */

#endif /* LINUX_CISTPL_H */
67 changes: 0 additions & 67 deletions include/pcmcia/cs.h
Original file line number Diff line number Diff line change
Expand Up @@ -201,16 +201,6 @@ typedef struct win_req_t {
#define WIN_BAR_MASK 0xe000
#define WIN_BAR_SHIFT 13

/* Attributes for RegisterClient -- UNUSED -- */
#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

typedef struct cs_status_t {
u_char Function;
event_t CardState;
Expand Down Expand Up @@ -252,61 +242,4 @@ typedef struct error_info_t {
#define CS_EVENT_3VCARD 0x200000
#define CS_EVENT_XVCARD 0x400000


#ifdef __KERNEL__

/*
* The main Card Services entry point
*/

enum service {
AccessConfigurationRegister, AddSocketServices,
AdjustResourceInfo, CheckEraseQueue, CloseMemory, CopyMemory,
DeregisterClient, DeregisterEraseQueue, GetCardServicesInfo,
GetClientInfo, GetConfigurationInfo, GetEventMask,
GetFirstClient, GetFirstPartion, GetFirstRegion, GetFirstTuple,
GetNextClient, GetNextPartition, GetNextRegion, GetNextTuple,
GetStatus, GetTupleData, MapLogSocket, MapLogWindow, MapMemPage,
MapPhySocket, MapPhyWindow, ModifyConfiguration, ModifyWindow,
OpenMemory, ParseTuple, ReadMemory, RegisterClient,
RegisterEraseQueue, RegisterMTD, RegisterTimer,
ReleaseConfiguration, ReleaseExclusive, ReleaseIO, ReleaseIRQ,
ReleaseSocketMask, ReleaseWindow, ReplaceSocketServices,
RequestConfiguration, RequestExclusive, RequestIO, RequestIRQ,
RequestSocketMask, RequestWindow, ResetCard, ReturnSSEntry,
SetEventMask, SetRegion, ValidateCIS, VendorSpecific,
WriteMemory, BindDevice, BindMTD, ReportError,
SuspendCard, ResumeCard, EjectCard, InsertCard, ReplaceCIS,
GetFirstWindow, GetNextWindow, GetMemPage
};

struct pcmcia_socket;

int pcmcia_access_configuration_register(struct pcmcia_device *p_dev, conf_reg_t *reg);
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_release_window(window_handle_t win);
int pcmcia_request_configuration(struct pcmcia_device *p_dev, config_req_t *req);
int pcmcia_request_io(struct pcmcia_device *p_dev, io_req_t *req);
int pcmcia_request_irq(struct pcmcia_device *p_dev, irq_req_t *req);
int pcmcia_request_window(struct pcmcia_device **p_dev, win_req_t *req, window_handle_t *wh);
int pcmcia_suspend_card(struct pcmcia_socket *skt);
int pcmcia_resume_card(struct pcmcia_socket *skt);
int pcmcia_eject_card(struct pcmcia_socket *skt);
int pcmcia_insert_card(struct pcmcia_socket *skt);
int pccard_reset_card(struct pcmcia_socket *skt);

struct pcmcia_device * pcmcia_dev_present(struct pcmcia_device *p_dev);
void pcmcia_disable_device(struct pcmcia_device *p_dev);

struct pcmcia_socket * pcmcia_get_socket(struct pcmcia_socket *skt);
void pcmcia_put_socket(struct pcmcia_socket *skt);

/* compatibility functions */
#define pcmcia_reset_card(p_dev, req) \
pccard_reset_card(p_dev->socket)

#endif /* __KERNEL__ */

#endif /* _LINUX_CS_H */
56 changes: 55 additions & 1 deletion include/pcmcia/ds.h
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,26 @@ struct pcmcia_device {
* or dev_dbg() directly in the driver, without referring to pcmcia_error_func()
* and/or pcmcia_error_ret() for those functions will go away soon.
*/

enum service {
AccessConfigurationRegister, AddSocketServices,
AdjustResourceInfo, CheckEraseQueue, CloseMemory, CopyMemory,
DeregisterClient, DeregisterEraseQueue, GetCardServicesInfo,
GetClientInfo, GetConfigurationInfo, GetEventMask,
GetFirstClient, GetFirstPartion, GetFirstRegion, GetFirstTuple,
GetNextClient, GetNextPartition, GetNextRegion, GetNextTuple,
GetStatus, GetTupleData, MapLogSocket, MapLogWindow, MapMemPage,
MapPhySocket, MapPhyWindow, ModifyConfiguration, ModifyWindow,
OpenMemory, ParseTuple, ReadMemory, RegisterClient,
RegisterEraseQueue, RegisterMTD, RegisterTimer,
ReleaseConfiguration, ReleaseExclusive, ReleaseIO, ReleaseIRQ,
ReleaseSocketMask, ReleaseWindow, ReplaceSocketServices,
RequestConfiguration, RequestExclusive, RequestIO, RequestIRQ,
RequestSocketMask, RequestWindow, ResetCard, ReturnSSEntry,
SetEventMask, SetRegion, ValidateCIS, VendorSpecific,
WriteMemory, BindDevice, BindMTD, ReportError,
SuspendCard, ResumeCard, EjectCard, InsertCard, ReplaceCIS,
GetFirstWindow, GetNextWindow, GetMemPage
};
const char *pcmcia_error_func(int func);
const char *pcmcia_error_ret(int ret);

Expand All @@ -158,6 +177,32 @@ const char *pcmcia_error_ret(int ret);
}


/* is the device still there? */
struct pcmcia_device *pcmcia_dev_present(struct pcmcia_device *p_dev);

/* low-level interface reset */
int pcmcia_reset_card(struct pcmcia_socket *skt);

/* CIS config */
int pcmcia_access_configuration_register(struct pcmcia_device *p_dev,
conf_reg_t *reg);

/* device configuration */
int pcmcia_request_io(struct pcmcia_device *p_dev, io_req_t *req);
int pcmcia_request_irq(struct pcmcia_device *p_dev, irq_req_t *req);
int pcmcia_request_configuration(struct pcmcia_device *p_dev,
config_req_t *req);

int pcmcia_request_window(struct pcmcia_device **p_dev, win_req_t *req,
window_handle_t *wh);
int pcmcia_release_window(window_handle_t win);

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);
void pcmcia_disable_device(struct pcmcia_device *p_dev);

#endif /* __KERNEL__ */


Expand Down Expand Up @@ -341,6 +386,15 @@ typedef union ds_ioctl_arg_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) */

Expand Down

0 comments on commit 994917f

Please sign in to comment.