Skip to content

Commit 7920369

Browse files
mpeJeff Garzik
authored andcommitted
Update ibm_newemac to use dcr_host_t.base
Now that dcr_host_t contains the base address, we can use that in the ibm_newemac code, rather than storing it separately. Signed-off-by: Michael Ellerman <michael@ellerman.id.au> Signed-off-by: Jeff Garzik <jeff@garzik.org>
1 parent bc2618f commit 7920369

2 files changed

Lines changed: 7 additions & 7 deletions

File tree

‎drivers/net/ibm_newemac/mal.c‎

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -461,6 +461,7 @@ static int __devinit mal_probe(struct of_device *ofdev,
461461
struct mal_instance *mal;
462462
int err = 0, i, bd_size;
463463
int index = mal_count++;
464+
unsigned int dcr_base;
464465
const u32 *prop;
465466
u32 cfg;
466467

@@ -497,14 +498,14 @@ static int __devinit mal_probe(struct of_device *ofdev,
497498
}
498499
mal->num_rx_chans = prop[0];
499500

500-
mal->dcr_base = dcr_resource_start(ofdev->node, 0);
501-
if (mal->dcr_base == 0) {
501+
dcr_base = dcr_resource_start(ofdev->node, 0);
502+
if (dcr_base == 0) {
502503
printk(KERN_ERR
503504
"mal%d: can't find DCR resource!\n", index);
504505
err = -ENODEV;
505506
goto fail;
506507
}
507-
mal->dcr_host = dcr_map(ofdev->node, mal->dcr_base, 0x100);
508+
mal->dcr_host = dcr_map(ofdev->node, dcr_base, 0x100);
508509
if (!DCR_MAP_OK(mal->dcr_host)) {
509510
printk(KERN_ERR
510511
"mal%d: failed to map DCRs !\n", index);
@@ -626,7 +627,7 @@ static int __devinit mal_probe(struct of_device *ofdev,
626627
fail2:
627628
dma_free_coherent(&ofdev->dev, bd_size, mal->bd_virt, mal->bd_dma);
628629
fail_unmap:
629-
dcr_unmap(mal->dcr_host, mal->dcr_base, 0x100);
630+
dcr_unmap(mal->dcr_host, dcr_base, 0x100);
630631
fail:
631632
kfree(mal);
632633

‎drivers/net/ibm_newemac/mal.h‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,6 @@ struct mal_commac {
185185

186186
struct mal_instance {
187187
int version;
188-
int dcr_base;
189188
dcr_host_t dcr_host;
190189

191190
int num_tx_chans; /* Number of TX channels */
@@ -213,12 +212,12 @@ struct mal_instance {
213212

214213
static inline u32 get_mal_dcrn(struct mal_instance *mal, int reg)
215214
{
216-
return dcr_read(mal->dcr_host, mal->dcr_base + reg);
215+
return dcr_read(mal->dcr_host, mal->dcr_host.base + reg);
217216
}
218217

219218
static inline void set_mal_dcrn(struct mal_instance *mal, int reg, u32 val)
220219
{
221-
dcr_write(mal->dcr_host, mal->dcr_base + reg, val);
220+
dcr_write(mal->dcr_host, mal->dcr_host.base + reg, val);
222221
}
223222

224223
/* Register MAL devices */

0 commit comments

Comments
 (0)