memstick: convert struct class_device to struct device
struct class_device is going away, struct device should be used instead. Signed-off-by: Tony Jones <tonyj@suse.de> Signed-off-by: Kay Sievers <kay.sievers@vrfy.org> Cc: Alex Dubov <oakad@yahoo.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
This commit is contained in:
@@ -177,16 +177,16 @@ static struct bus_type memstick_bus_type = {
|
|||||||
.resume = memstick_device_resume
|
.resume = memstick_device_resume
|
||||||
};
|
};
|
||||||
|
|
||||||
static void memstick_free(struct class_device *cdev)
|
static void memstick_free(struct device *dev)
|
||||||
{
|
{
|
||||||
struct memstick_host *host = container_of(cdev, struct memstick_host,
|
struct memstick_host *host = container_of(dev, struct memstick_host,
|
||||||
cdev);
|
dev);
|
||||||
kfree(host);
|
kfree(host);
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct class memstick_host_class = {
|
static struct class memstick_host_class = {
|
||||||
.name = "memstick_host",
|
.name = "memstick_host",
|
||||||
.release = memstick_free
|
.dev_release = memstick_free
|
||||||
};
|
};
|
||||||
|
|
||||||
static void memstick_free_card(struct device *dev)
|
static void memstick_free_card(struct device *dev)
|
||||||
@@ -383,8 +383,8 @@ static struct memstick_dev *memstick_alloc_card(struct memstick_host *host)
|
|||||||
if (card) {
|
if (card) {
|
||||||
card->host = host;
|
card->host = host;
|
||||||
snprintf(card->dev.bus_id, sizeof(card->dev.bus_id),
|
snprintf(card->dev.bus_id, sizeof(card->dev.bus_id),
|
||||||
"%s", host->cdev.class_id);
|
"%s", host->dev.bus_id);
|
||||||
card->dev.parent = host->cdev.dev;
|
card->dev.parent = &host->dev;
|
||||||
card->dev.bus = &memstick_bus_type;
|
card->dev.bus = &memstick_bus_type;
|
||||||
card->dev.release = memstick_free_card;
|
card->dev.release = memstick_free_card;
|
||||||
card->check = memstick_dummy_check;
|
card->check = memstick_dummy_check;
|
||||||
@@ -427,7 +427,7 @@ static void memstick_check(struct work_struct *work)
|
|||||||
media_checker);
|
media_checker);
|
||||||
struct memstick_dev *card;
|
struct memstick_dev *card;
|
||||||
|
|
||||||
dev_dbg(host->cdev.dev, "memstick_check started\n");
|
dev_dbg(&host->dev, "memstick_check started\n");
|
||||||
mutex_lock(&host->lock);
|
mutex_lock(&host->lock);
|
||||||
if (!host->card)
|
if (!host->card)
|
||||||
memstick_power_on(host);
|
memstick_power_on(host);
|
||||||
@@ -440,7 +440,7 @@ static void memstick_check(struct work_struct *work)
|
|||||||
host->card = NULL;
|
host->card = NULL;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
dev_dbg(host->cdev.dev, "new card %02x, %02x, %02x\n",
|
dev_dbg(&host->dev, "new card %02x, %02x, %02x\n",
|
||||||
card->id.type, card->id.category, card->id.class);
|
card->id.type, card->id.category, card->id.class);
|
||||||
if (host->card) {
|
if (host->card) {
|
||||||
if (memstick_set_rw_addr(host->card)
|
if (memstick_set_rw_addr(host->card)
|
||||||
@@ -465,7 +465,7 @@ static void memstick_check(struct work_struct *work)
|
|||||||
host->set_param(host, MEMSTICK_POWER, MEMSTICK_POWER_OFF);
|
host->set_param(host, MEMSTICK_POWER, MEMSTICK_POWER_OFF);
|
||||||
|
|
||||||
mutex_unlock(&host->lock);
|
mutex_unlock(&host->lock);
|
||||||
dev_dbg(host->cdev.dev, "memstick_check finished\n");
|
dev_dbg(&host->dev, "memstick_check finished\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -482,9 +482,9 @@ struct memstick_host *memstick_alloc_host(unsigned int extra,
|
|||||||
if (host) {
|
if (host) {
|
||||||
mutex_init(&host->lock);
|
mutex_init(&host->lock);
|
||||||
INIT_WORK(&host->media_checker, memstick_check);
|
INIT_WORK(&host->media_checker, memstick_check);
|
||||||
host->cdev.class = &memstick_host_class;
|
host->dev.class = &memstick_host_class;
|
||||||
host->cdev.dev = dev;
|
host->dev.parent = dev;
|
||||||
class_device_initialize(&host->cdev);
|
device_initialize(&host->dev);
|
||||||
}
|
}
|
||||||
return host;
|
return host;
|
||||||
}
|
}
|
||||||
@@ -507,10 +507,9 @@ int memstick_add_host(struct memstick_host *host)
|
|||||||
if (rc)
|
if (rc)
|
||||||
return rc;
|
return rc;
|
||||||
|
|
||||||
snprintf(host->cdev.class_id, BUS_ID_SIZE,
|
snprintf(host->dev.bus_id, BUS_ID_SIZE, "memstick%u", host->id);
|
||||||
"memstick%u", host->id);
|
|
||||||
|
|
||||||
rc = class_device_add(&host->cdev);
|
rc = device_add(&host->dev);
|
||||||
if (rc) {
|
if (rc) {
|
||||||
spin_lock(&memstick_host_lock);
|
spin_lock(&memstick_host_lock);
|
||||||
idr_remove(&memstick_host_idr, host->id);
|
idr_remove(&memstick_host_idr, host->id);
|
||||||
@@ -541,7 +540,7 @@ void memstick_remove_host(struct memstick_host *host)
|
|||||||
spin_lock(&memstick_host_lock);
|
spin_lock(&memstick_host_lock);
|
||||||
idr_remove(&memstick_host_idr, host->id);
|
idr_remove(&memstick_host_idr, host->id);
|
||||||
spin_unlock(&memstick_host_lock);
|
spin_unlock(&memstick_host_lock);
|
||||||
class_device_del(&host->cdev);
|
device_del(&host->dev);
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL(memstick_remove_host);
|
EXPORT_SYMBOL(memstick_remove_host);
|
||||||
|
|
||||||
@@ -552,7 +551,7 @@ EXPORT_SYMBOL(memstick_remove_host);
|
|||||||
void memstick_free_host(struct memstick_host *host)
|
void memstick_free_host(struct memstick_host *host)
|
||||||
{
|
{
|
||||||
mutex_destroy(&host->lock);
|
mutex_destroy(&host->lock);
|
||||||
class_device_put(&host->cdev);
|
put_device(&host->dev);
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL(memstick_free_host);
|
EXPORT_SYMBOL(memstick_free_host);
|
||||||
|
|
||||||
|
@@ -1127,8 +1127,8 @@ static int mspro_block_init_disk(struct memstick_dev *card)
|
|||||||
u64 limit = BLK_BOUNCE_HIGH;
|
u64 limit = BLK_BOUNCE_HIGH;
|
||||||
unsigned long capacity;
|
unsigned long capacity;
|
||||||
|
|
||||||
if (host->cdev.dev->dma_mask && *(host->cdev.dev->dma_mask))
|
if (host->dev.dma_mask && *(host->dev.dma_mask))
|
||||||
limit = *(host->cdev.dev->dma_mask);
|
limit = *(host->dev.dma_mask);
|
||||||
|
|
||||||
for (rc = 0; msb->attr_group.attrs[rc]; ++rc) {
|
for (rc = 0; msb->attr_group.attrs[rc]; ++rc) {
|
||||||
s_attr = mspro_from_sysfs_attr(msb->attr_group.attrs[rc]);
|
s_attr = mspro_from_sysfs_attr(msb->attr_group.attrs[rc]);
|
||||||
|
@@ -361,15 +361,15 @@ static int jmb38x_ms_issue_cmd(struct memstick_host *msh)
|
|||||||
unsigned int data_len, cmd, t_val;
|
unsigned int data_len, cmd, t_val;
|
||||||
|
|
||||||
if (!(STATUS_HAS_MEDIA & readl(host->addr + STATUS))) {
|
if (!(STATUS_HAS_MEDIA & readl(host->addr + STATUS))) {
|
||||||
dev_dbg(msh->cdev.dev, "no media status\n");
|
dev_dbg(&msh->dev, "no media status\n");
|
||||||
host->req->error = -ETIME;
|
host->req->error = -ETIME;
|
||||||
return host->req->error;
|
return host->req->error;
|
||||||
}
|
}
|
||||||
|
|
||||||
dev_dbg(msh->cdev.dev, "control %08x\n",
|
dev_dbg(&msh->dev, "control %08x\n",
|
||||||
readl(host->addr + HOST_CONTROL));
|
readl(host->addr + HOST_CONTROL));
|
||||||
dev_dbg(msh->cdev.dev, "status %08x\n", readl(host->addr + INT_STATUS));
|
dev_dbg(&msh->dev, "status %08x\n", readl(host->addr + INT_STATUS));
|
||||||
dev_dbg(msh->cdev.dev, "hstatus %08x\n", readl(host->addr + STATUS));
|
dev_dbg(&msh->dev, "hstatus %08x\n", readl(host->addr + STATUS));
|
||||||
|
|
||||||
host->cmd_flags = 0;
|
host->cmd_flags = 0;
|
||||||
host->block_pos = 0;
|
host->block_pos = 0;
|
||||||
@@ -448,7 +448,7 @@ static int jmb38x_ms_issue_cmd(struct memstick_host *msh)
|
|||||||
host->req->error = 0;
|
host->req->error = 0;
|
||||||
|
|
||||||
writel(cmd, host->addr + TPC);
|
writel(cmd, host->addr + TPC);
|
||||||
dev_dbg(msh->cdev.dev, "executing TPC %08x, len %x\n", cmd, data_len);
|
dev_dbg(&msh->dev, "executing TPC %08x, len %x\n", cmd, data_len);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -461,11 +461,11 @@ static void jmb38x_ms_complete_cmd(struct memstick_host *msh, int last)
|
|||||||
|
|
||||||
del_timer(&host->timer);
|
del_timer(&host->timer);
|
||||||
|
|
||||||
dev_dbg(msh->cdev.dev, "c control %08x\n",
|
dev_dbg(&msh->dev, "c control %08x\n",
|
||||||
readl(host->addr + HOST_CONTROL));
|
readl(host->addr + HOST_CONTROL));
|
||||||
dev_dbg(msh->cdev.dev, "c status %08x\n",
|
dev_dbg(&msh->dev, "c status %08x\n",
|
||||||
readl(host->addr + INT_STATUS));
|
readl(host->addr + INT_STATUS));
|
||||||
dev_dbg(msh->cdev.dev, "c hstatus %08x\n", readl(host->addr + STATUS));
|
dev_dbg(&msh->dev, "c hstatus %08x\n", readl(host->addr + STATUS));
|
||||||
|
|
||||||
host->req->int_reg = readl(host->addr + STATUS) & 0xff;
|
host->req->int_reg = readl(host->addr + STATUS) & 0xff;
|
||||||
|
|
||||||
|
@@ -276,7 +276,7 @@ struct memstick_host {
|
|||||||
#define MEMSTICK_CAP_PAR8 4
|
#define MEMSTICK_CAP_PAR8 4
|
||||||
|
|
||||||
struct work_struct media_checker;
|
struct work_struct media_checker;
|
||||||
struct class_device cdev;
|
struct device dev;
|
||||||
|
|
||||||
struct memstick_dev *card;
|
struct memstick_dev *card;
|
||||||
unsigned int retries;
|
unsigned int retries;
|
||||||
|
Reference in New Issue
Block a user