summaryrefslogtreecommitdiff
path: root/drivers/memstick/host/jmb38x_ms.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/memstick/host/jmb38x_ms.c')
-rw-r--r--drivers/memstick/host/jmb38x_ms.c14
1 files changed, 6 insertions, 8 deletions
diff --git a/drivers/memstick/host/jmb38x_ms.c b/drivers/memstick/host/jmb38x_ms.c
index f9a93b0565e1..79e66e30417c 100644
--- a/drivers/memstick/host/jmb38x_ms.c
+++ b/drivers/memstick/host/jmb38x_ms.c
@@ -66,7 +66,7 @@ struct jmb38x_ms_host {
struct jmb38x_ms {
struct pci_dev *pdev;
int host_cnt;
- struct memstick_host *hosts[];
+ struct memstick_host *hosts[] __counted_by(host_cnt);
};
#define BLOCK_COUNT_MASK 0xffff0000
@@ -317,8 +317,7 @@ static int jmb38x_ms_transfer_data(struct jmb38x_ms_host *host)
unsigned int p_off;
if (host->req->long_data) {
- pg = nth_page(sg_page(&host->req->sg),
- off >> PAGE_SHIFT);
+ pg = sg_page(&host->req->sg) + (off >> PAGE_SHIFT);
p_off = offset_in_page(off);
p_cnt = PAGE_SIZE - p_off;
p_cnt = min(p_cnt, length);
@@ -469,7 +468,7 @@ static void jmb38x_ms_complete_cmd(struct memstick_host *msh, int last)
unsigned int t_val = 0;
int rc;
- del_timer(&host->timer);
+ timer_delete(&host->timer);
dev_dbg(&msh->dev, "c control %08x\n",
readl(host->addr + HOST_CONTROL));
@@ -590,7 +589,7 @@ static irqreturn_t jmb38x_ms_isr(int irq, void *dev_id)
static void jmb38x_ms_abort(struct timer_list *t)
{
- struct jmb38x_ms_host *host = from_timer(host, t, timer);
+ struct jmb38x_ms_host *host = timer_container_of(host, t, timer);
struct memstick_host *msh = host->msh;
unsigned long flags;
@@ -882,7 +881,7 @@ static struct memstick_host *jmb38x_ms_alloc_host(struct jmb38x_ms *jm, int cnt)
iounmap(host->addr);
err_out_free:
- kfree(msh);
+ memstick_free_host(msh);
return NULL;
}
@@ -927,8 +926,7 @@ static int jmb38x_ms_probe(struct pci_dev *pdev,
goto err_out_int;
}
- jm = kzalloc(sizeof(struct jmb38x_ms)
- + cnt * sizeof(struct memstick_host *), GFP_KERNEL);
+ jm = kzalloc(struct_size(jm, hosts, cnt), GFP_KERNEL);
if (!jm) {
rc = -ENOMEM;
goto err_out_int;