Skip to content

Commit

Permalink
icside: don't use hwif->hwif_data
Browse files Browse the repository at this point in the history
* Move ecard_set_drvdata() from icside_probe() to icside_register_v{5,6}(),
  then use state->ioc_base instead of hwif->hwif_data in icside_maskproc()
  and icside_dma_test_irq().

While at it:

* Add sel field to struct icside_state, then use state->{sel,ioc_base}
  instead of ->{select,config}_data in icside_dma_setup().

There should be no functional changes caused by this patch.

Cc: Russell King <rmk@arm.linux.org.uk>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
  • Loading branch information
Bartlomiej Zolnierkiewicz committed Jul 16, 2008
1 parent dccdf52 commit 26839f0
Showing 1 changed file with 12 additions and 13 deletions.
25 changes: 12 additions & 13 deletions drivers/ide/arm/icside.c
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ struct icside_state {
unsigned int enabled;
void __iomem *irq_port;
void __iomem *ioc_base;
unsigned int sel;
unsigned int type;
ide_hwif_t *hwif[2];
};
Expand Down Expand Up @@ -165,7 +166,8 @@ static const expansioncard_ops_t icside_ops_arcin_v6 = {
static void icside_maskproc(ide_drive_t *drive, int mask)
{
ide_hwif_t *hwif = HWIF(drive);
struct icside_state *state = hwif->hwif_data;
struct expansion_card *ec = ECARD_DEV(hwif->dev);
struct icside_state *state = ecard_get_drvdata(ec);
unsigned long flags;

local_irq_save(flags);
Expand Down Expand Up @@ -308,6 +310,7 @@ static int icside_dma_setup(ide_drive_t *drive)
{
ide_hwif_t *hwif = HWIF(drive);
struct expansion_card *ec = ECARD_DEV(hwif->dev);
struct icside_state *state = ecard_get_drvdata(ec);
struct request *rq = hwif->hwgroup->rq;
unsigned int dma_mode;

Expand All @@ -331,7 +334,7 @@ static int icside_dma_setup(ide_drive_t *drive)
/*
* Route the DMA signals to the correct interface.
*/
writeb(hwif->select_data, hwif->config_data);
writeb(state->sel | hwif->channel, state->ioc_base);

/*
* Select the correct timing for this drive.
Expand Down Expand Up @@ -359,7 +362,8 @@ static void icside_dma_exec_cmd(ide_drive_t *drive, u8 cmd)
static int icside_dma_test_irq(ide_drive_t *drive)
{
ide_hwif_t *hwif = HWIF(drive);
struct icside_state *state = hwif->hwif_data;
struct expansion_card *ec = ECARD_DEV(hwif->dev);
struct icside_state *state = ecard_get_drvdata(ec);

return readb(state->irq_port +
(hwif->channel ?
Expand Down Expand Up @@ -472,6 +476,8 @@ icside_register_v5(struct icside_state *state, struct expansion_card *ec)

state->hwif[0] = hwif;

ecard_set_drvdata(ec, state);

idx[0] = hwif->index;

ide_device_add(idx, NULL);
Expand Down Expand Up @@ -525,6 +531,7 @@ icside_register_v6(struct icside_state *state, struct expansion_card *ec)

state->irq_port = easi_base;
state->ioc_base = ioc_base;
state->sel = sel;

/*
* Be on the safe side - disable interrupts
Expand All @@ -545,13 +552,7 @@ icside_register_v6(struct icside_state *state, struct expansion_card *ec)
state->hwif[0] = hwif;
state->hwif[1] = mate;

hwif->hwif_data = state;
hwif->config_data = (unsigned long)ioc_base;
hwif->select_data = sel;

mate->hwif_data = state;
mate->config_data = (unsigned long)ioc_base;
mate->select_data = sel | 1;
ecard_set_drvdata(ec, state);

if (ec->dma != NO_DMA && !request_dma(ec->dma, hwif->name)) {
d.init_dma = icside_dma_init;
Expand Down Expand Up @@ -627,10 +628,8 @@ icside_probe(struct expansion_card *ec, const struct ecard_id *id)
break;
}

if (ret == 0) {
ecard_set_drvdata(ec, state);
if (ret == 0)
goto out;
}

kfree(state);
release:
Expand Down

0 comments on commit 26839f0

Please sign in to comment.