aboutsummaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorAndy Green <agreen@pads.home.warmcat.com>2008-11-19 17:10:03 +0000
committerAndy Green <agreen@pads.home.warmcat.com>2008-11-19 17:10:03 +0000
commita79a5b55e287dcf73d8acd92089aea1b1d8bf9c3 (patch)
tree68089f6955c965cfff87e3246b3d3f5e95c1de35 /drivers
parent2f004d037ef2c410dc5ad9fd53ed15e4a85f1aba (diff)
Signed-Off-Number: Holger Freyther <zecke@openmoko.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/sdio/function/wlan/ar6000/hif/hif.c2
-rw-r--r--drivers/sdio/hcd/s3c24xx/s3c24xx_hcd.c6
-rw-r--r--drivers/sdio/hcd/s3c24xx/s3c24xx_hcd.h4
-rw-r--r--drivers/sdio/stack/busdriver/sdio_bus_os.c78
4 files changed, 46 insertions, 44 deletions
diff --git a/drivers/sdio/function/wlan/ar6000/hif/hif.c b/drivers/sdio/function/wlan/ar6000/hif/hif.c
index 3d6d792d974..51711574fc9 100644
--- a/drivers/sdio/function/wlan/ar6000/hif/hif.c
+++ b/drivers/sdio/function/wlan/ar6000/hif/hif.c
@@ -782,7 +782,7 @@ delHifDevice(SDDEVICE *handle)
struct device*
HIFGetOSDevice(HIF_DEVICE *device)
{
- return &device->handle->Device.dev;
+ return &device->handle->Device->dev;
}
static void ResetAllCards(void)
diff --git a/drivers/sdio/hcd/s3c24xx/s3c24xx_hcd.c b/drivers/sdio/hcd/s3c24xx/s3c24xx_hcd.c
index edb8523907e..09d81ee2087 100644
--- a/drivers/sdio/hcd/s3c24xx/s3c24xx_hcd.c
+++ b/drivers/sdio/hcd/s3c24xx/s3c24xx_hcd.c
@@ -1296,7 +1296,6 @@ struct s3c24xx_hcd_context hcd_context = {
.hcd.pContext = &hcd_context,
.hcd.pRequest = s3c24xx_hcd_request,
.hcd.pConfigure = s3c24xx_hcd_config,
- .device.pnp_device.name = "sdio_s3c24xx_hcd",
.device.pnp_driver.name = "sdio_s3c24xx_hcd",
.device.pnp_driver.probe = s3c24xx_hcd_pnp_probe,
.device.pnp_driver.remove = s3c24xx_hcd_pnp_remove,
@@ -1348,7 +1347,7 @@ static int s3c24xx_hcd_probe(struct platform_device * pdev)
status = SDIO_BusAddOSDevice(&hcd_context.device.dma,
&hcd_context.device.pnp_driver,
- &hcd_context.device.pnp_device);
+ &hcd_context.device.pnp_device, "sdio_s3c24xx_hcd");
out:
@@ -1360,7 +1359,8 @@ static int s3c24xx_hcd_probe(struct platform_device * pdev)
*/
static int s3c24xx_hcd_remove(struct platform_device * pdev) {
printk("S3C2440 SDIO host controller unloaded\n");
- SDIO_BusRemoveOSDevice(&hcd_context.device.pnp_driver, &hcd_context.device.pnp_device);
+ SDIO_BusRemoveOSDevice(&hcd_context.device.pnp_driver, hcd_context.device.pnp_device);
+ kfree(hcd_context.device.pnp_device);
return 0;
}
diff --git a/drivers/sdio/hcd/s3c24xx/s3c24xx_hcd.h b/drivers/sdio/hcd/s3c24xx/s3c24xx_hcd.h
index 47fdd331d6a..f8b0912ba56 100644
--- a/drivers/sdio/hcd/s3c24xx/s3c24xx_hcd.h
+++ b/drivers/sdio/hcd/s3c24xx/s3c24xx_hcd.h
@@ -8,8 +8,8 @@
#define S3C24XX_HCD_DATA_WRITE 5
struct s3c24xx_hcd_device {
- OS_PNPDEVICE pnp_device; /* the OS device for this HCD */
- OS_PNPDRIVER pnp_driver; /* the OS driver for this HCD */
+ OS_PNPDEVICE *pnp_device; /* the OS device for this HCD */
+ OS_PNPDRIVER pnp_driver; /* the OS driver for this HCD */
SDDMA_DESCRIPTION dma;
struct clk * clock;
unsigned long max_clock_rate;
diff --git a/drivers/sdio/stack/busdriver/sdio_bus_os.c b/drivers/sdio/stack/busdriver/sdio_bus_os.c
index 2650d931040..c6f68e62159 100644
--- a/drivers/sdio/stack/busdriver/sdio_bus_os.c
+++ b/drivers/sdio/stack/busdriver/sdio_bus_os.c
@@ -415,8 +415,8 @@ struct pnp_protocol sdio_protocol = {
*/
static int driver_probe(struct pnp_dev* pOSDevice, const struct pnp_device_id *pId)
{
- PSDDEVICE pDevice = SDDEVICE_FROM_OSDEVICE(pOSDevice);
- PSDFUNCTION pFunction = pDevice->Device.dev.driver_data;
+ PSDDEVICE pDevice = SDDEVICE_FROM_OSDEVICE(&pOSDevice);
+ PSDFUNCTION pFunction = pDevice->Device->dev.driver_data;
if (pFunction == NULL) {
return -1;
@@ -496,34 +496,32 @@ static int UnregisterDriver(PSDFUNCTION pFunction)
*/
SDIO_STATUS OS_InitializeDevice(PSDDEVICE pDevice, PSDFUNCTION pFunction)
{
- char id_name[20];
+ char id_name[20];
- memset(&pDevice->Device, 0, sizeof(pDevice->Device));
- pDevice->Device.dev.driver_data = (PVOID)pFunction;
+ /* set the id as slot number/function number */
+ snprintf(id_name, sizeof(id_name) - 1, "SD_%02X%02X",
+ pDevice->pHcd->SlotNumber, (UINT)SDDEVICE_GET_SDIO_FUNCNO(pDevice));
+
+ pDevice->Device = pnp_alloc_dev(&sdio_protocol, pDevice->pHcd->SlotNumber + 1, id_name);
+ pDevice->Device->dev.driver_data = (PVOID)pFunction;
//?? pDevice->Device.data = (PVOID)pFunction;
//?? pDevice->Device.dev.driver = &pFunction->Driver.driver;
//?? pDevice->Device.driver = &pFunction->Driver;
//?? pDevice->Device.dev.release = release;
/* get a unique device number, must be done with locks held */
spin_lock(&InUseDevicesLock);
- pDevice->Device.number = FirstClearBit(&InUseDevices);
- SetBit(&InUseDevices, pDevice->Device.number);
+ pDevice->Device->number = FirstClearBit(&InUseDevices);
+ SetBit(&InUseDevices, pDevice->Device->number);
spin_unlock(&InUseDevicesLock);
- pDevice->Device.capabilities = PNP_REMOVABLE | PNP_DISABLE;
- pDevice->Device.protocol = &sdio_protocol;
- pDevice->Device.active = 1;
+ pDevice->Device->capabilities = PNP_REMOVABLE | PNP_DISABLE;
+ pDevice->Device->active = 1;
- /* set the id as slot number/function number */
- snprintf(id_name, sizeof(id_name) - 1, "SD_%02X%02X",
- pDevice->pHcd->SlotNumber, (UINT)SDDEVICE_GET_SDIO_FUNCNO(pDevice));
DBG_PRINT(SDDBG_TRACE, ("SDIO BusDriver - OS_InitializeDevice adding id: %s\n",
id_name));
- pnp_add_id(&pDevice->Device, id_name);
-
- /* deal with DMA settings */
+ /* deal with DMA settings */
if (pDevice->pHcd->pDmaDescription != NULL) {
- pDevice->Device.dev.dma_mask = &pDevice->pHcd->pDmaDescription->Mask;
- pDevice->Device.dev.coherent_dma_mask = pDevice->pHcd->pDmaDescription->Mask;
+ pDevice->Device->dev.dma_mask = &pDevice->pHcd->pDmaDescription->Mask;
+ pDevice->Device->dev.coherent_dma_mask = pDevice->pHcd->pDmaDescription->Mask;
}
return SDIO_STATUS_SUCCESS;
@@ -537,13 +535,13 @@ SDIO_STATUS OS_AddDevice(PSDDEVICE pDevice, PSDFUNCTION pFunction)
int error;
DBG_PRINT(SDDBG_TRACE, ("SDIO BusDriver - OS_AddDevice adding function: %s\n",
pFunction->pName));
- error = pnp_add_device(&pDevice->Device);
+ error = pnp_add_device(pDevice->Device);
if (error < 0) {
DBG_PRINT(SDDBG_ERROR, ("SDIO BusDriver - OS_AddDevice failed pnp_add_device: %d\n",
error));
}
/* replace the buggy pnp's release */
- pDevice->Device.dev.release = release;
+ pDevice->Device->dev.release = release;
return OSErrorToSDIOError(error);
}
@@ -554,15 +552,17 @@ SDIO_STATUS OS_AddDevice(PSDDEVICE pDevice, PSDFUNCTION pFunction)
void OS_RemoveDevice(PSDDEVICE pDevice)
{
DBG_PRINT(SDDBG_TRACE, ("SDIO BusDriver - OS_RemoveDevice \n"));
- pnp_remove_card_device(&pDevice->Device);
+ pnp_remove_card_device(pDevice->Device);
spin_lock(&InUseDevicesLock);
- ClearBit(&InUseDevices, pDevice->Device.number);
+ ClearBit(&InUseDevices, pDevice->Device->number);
spin_unlock(&InUseDevicesLock);
- if (pDevice->Device.id != NULL) {
- KernelFree(pDevice->Device.id);
- pDevice->Device.id = NULL;
+ if (pDevice->Device->id != NULL) {
+ KernelFree(pDevice->Device->id);
+ pDevice->Device->id = NULL;
}
+
+ KernelFree(pDevice->Device);
}
/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
@@ -612,20 +612,13 @@ void OS_RemoveDevice(PSDDEVICE pDevice)
@see also: SDIO_BusRemoveOSDevice
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
-SDIO_STATUS SDIO_BusAddOSDevice(PSDDMA_DESCRIPTION pDma, POS_PNPDRIVER pDriver, POS_PNPDEVICE pDevice)
+SDIO_STATUS SDIO_BusAddOSDevice(PSDDMA_DESCRIPTION pDma, POS_PNPDRIVER pDriver, POS_PNPDEVICE *outDevice, const char* name)
{
int err;
struct pnp_device_id *pFdid;
static int slotNumber = 0; /* we just use an increasing count for the slots number */
- char id_name[20];
+ struct pnp_dev* pDevice;
- if (pDma != NULL) {
- pDevice->dev.dma_mask = &pDma->Mask;
- pDevice->dev.coherent_dma_mask = pDma->Mask;
- }
- DBG_PRINT(SDDBG_ERROR,
- ("SDIO BusDriver - SDIO_GetBusOSDevice, registering driver: %s DMAmask: 0x%x\n",
- pDriver->name, (UINT)*pDevice->dev.dma_mask));
pFdid = KernelAlloc(sizeof(struct pnp_device_id)*2);
/* set the id as slot number/function number */
snprintf(pFdid[0].id, sizeof(pFdid[0].id), "SD_%02X08",
@@ -644,14 +637,22 @@ SDIO_STATUS SDIO_BusAddOSDevice(PSDDMA_DESCRIPTION pDma, POS_PNPDRIVER pDriver,
return OSErrorToSDIOError(err);
}
+ pDevice = pnp_alloc_dev(&sdio_protocol, slotNumber - 1, pFdid[0].id);
+ if (!pDevice)
+ return -EINVAL;
+
+ if (pDma != NULL) {
+ pDevice->dev.dma_mask = &pDma->Mask;
+ pDevice->dev.coherent_dma_mask = pDma->Mask;
+ }
+ DBG_PRINT(SDDBG_ERROR,
+ ("SDIO BusDriver - SDIO_GetBusOSDevice, registering driver: %s DMAmask: 0x%x\n",
+ pDriver->name, (UINT)*pDevice->dev.dma_mask));
+
pDevice->protocol = &sdio_protocol;
pDevice->capabilities = PNP_REMOVABLE | PNP_DISABLE;
pDevice->active = 1;
- /* set the id as slot number/function number */
- snprintf(id_name, sizeof(id_name) - 1, "SD_%02X08",
- 0); //??pDevice->pHcd->SlotNumber);//?????fix this, slotnumber isn't vaialble yet
- pnp_add_id(pDevice, id_name);
/* get a unique device number */
spin_lock(&InUseDevicesLock);
@@ -667,6 +668,7 @@ SDIO_STATUS SDIO_BusAddOSDevice(PSDDMA_DESCRIPTION pDma, POS_PNPDRIVER pDriver,
}
/* replace the buggy pnp's release */
pDevice->dev.release = release;
+ *outDevice = pDevice;
return OSErrorToSDIOError(err);
}