9
0
Fork 0

driver: replace dev_request_mem_region with dev_request_mem_resource

dev_request_mem_region doesn't work properly one some SoCs on which
PTR_ERR() values clash with valid return values from dev_request_mem_region.
Replace them with dev_request_mem_resource where possible.

This patch has been generated with the following semantic patch:

// <smpl>
@@
expression d;
expression n;
expression io;
identifier func;
@@
func(...) {
+struct resource *iores;
<+...
-io = dev_request_mem_region(d, n);
-if (IS_ERR(io)) {
+iores = dev_request_mem_resource(d, n);
+if (IS_ERR(iores)) {
...
-	return PTR_ERR(io);
-}
+	return PTR_ERR(iores);
+}
+io = IOMEM(iores->start);
...+>
}

@@
expression d;
expression n;
expression io;
identifier func;
@@
func(...) {
+struct resource *iores;
<+...
-io = dev_request_mem_region(d, n);
-if (IS_ERR(io)) {
+iores = dev_request_mem_resource(d, n);
+if (IS_ERR(iores))
-	return PTR_ERR(io);
-}
+	return PTR_ERR(iores);
+io = IOMEM(iores->start);
...+>
}

@@
expression d;
expression n;
expression io;
identifier func;
@@
func(...) {
+struct resource *iores;
<+...
-io = dev_request_mem_region(d, n);
-if (IS_ERR(io)) {
-	ret = PTR_ERR(io);
+iores = dev_request_mem_resource(d, n);
+if (IS_ERR(iores)) {
+	ret = PTR_ERR(iores);
...
}
+io = IOMEM(iores->start);
...+>
}

@@
expression d;
expression n;
expression io;
identifier func;
@@
func(...) {
+struct resource *iores;
<+...
-io = dev_request_mem_region(d, n);
+iores = dev_request_mem_resource(d, n);
+if (IS_ERR(iores))
+	return PTR_ERR(iores);
+io = IOMEM(iores->start);
...+>
}

@@
identifier func;
@@
func(...) {
<+...
struct resource *iores;
-struct resource *iores;
...+>
}
// </smpl>

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
This commit is contained in:
Sascha Hauer 2016-02-18 11:38:58 +01:00
parent fe7855bb4f
commit 3bd69ad077
163 changed files with 945 additions and 479 deletions

View File

@ -173,6 +173,7 @@ void sama5_smc_configure(int id, int cs, struct sam9_smc_config *config)
static int at91sam9_smc_probe(struct device_d *dev)
{
struct resource *iores;
int id = dev->id;
if (id < 0) {
@ -182,11 +183,12 @@ static int at91sam9_smc_probe(struct device_d *dev)
return -EIO;
}
smc_base_addr[id] = dev_request_mem_region(dev, 0);
if (IS_ERR(smc_base_addr[id])) {
iores = dev_request_mem_resource(dev, 0);
if (IS_ERR(iores)) {
dev_err(dev, "Impossible to request smc.%d\n", id);
return PTR_ERR(smc_base_addr[id]);
return PTR_ERR(iores);
}
smc_base_addr[id] = IOMEM(iores->start);
return 0;
}

View File

@ -87,11 +87,13 @@ int __init mx1_clocks_init(void __iomem *regs, unsigned long fref)
static int imx1_ccm_probe(struct device_d *dev)
{
struct resource *iores;
void __iomem *regs;
regs = dev_request_mem_region(dev, 0);
if (IS_ERR(regs))
return PTR_ERR(regs);
iores = dev_request_mem_resource(dev, 0);
if (IS_ERR(iores))
return PTR_ERR(iores);
regs = IOMEM(iores->start);
mx1_clocks_init(regs, 32000);

View File

@ -107,13 +107,15 @@ static const char *spll_sel_clks[] = {
static int imx21_ccm_probe(struct device_d *dev)
{
struct resource *iores;
void __iomem *base;
unsigned long lref = 32768;
unsigned long href = 26000000;
base = dev_request_mem_region(dev, 0);
if (IS_ERR(base))
return PTR_ERR(base);
iores = dev_request_mem_resource(dev, 0);
if (IS_ERR(iores))
return PTR_ERR(iores);
base = IOMEM(iores->start);
writel(PCCR0_UART1_EN | PCCR0_UART2_EN | PCCR0_UART3_EN | PCCR0_UART4_EN |
PCCR0_CSPI1_EN | PCCR0_CSPI2_EN | PCCR0_SDHC1_EN |

View File

@ -85,11 +85,13 @@ static const char *per_sel_clks[] = {
static int imx25_ccm_probe(struct device_d *dev)
{
struct resource *iores;
void __iomem *base;
base = dev_request_mem_region(dev, 0);
if (IS_ERR(base))
return PTR_ERR(base);
iores = dev_request_mem_resource(dev, 0);
if (IS_ERR(iores))
return PTR_ERR(iores);
base = IOMEM(iores->start);
writel((1 << 3) | (1 << 4) | (1 << 5) | (1 << 6) | (1 << 8) | (1 << 9) |
(1 << 10) | (1 << 15) | (1 << 19) | (1 << 21) | (1 << 22) |

View File

@ -156,11 +156,13 @@ static const char *clko_sel_clks[] = {
static int imx27_ccm_probe(struct device_d *dev)
{
struct resource *iores;
void __iomem *base;
base = dev_request_mem_region(dev, 0);
if (IS_ERR(base))
return PTR_ERR(base);
iores = dev_request_mem_resource(dev, 0);
if (IS_ERR(iores))
return PTR_ERR(iores);
base = IOMEM(iores->start);
writel(PCCR0_SDHC3_EN | PCCR0_SDHC2_EN | PCCR0_SDHC1_EN |
PCCR0_PWM_EN | PCCR0_KPP_EN | PCCR0_IIM_EN |

View File

@ -80,11 +80,13 @@ static const char *per_sel[] = {
static int imx31_ccm_probe(struct device_d *dev)
{
struct resource *iores;
void __iomem *base;
base = dev_request_mem_region(dev, 0);
if (IS_ERR(base))
return PTR_ERR(base);
iores = dev_request_mem_resource(dev, 0);
if (IS_ERR(iores))
return PTR_ERR(iores);
base = IOMEM(iores->start);
writel(0xffffffff, base + CCM_CGR0);
writel(0xffffffff, base + CCM_CGR1);

View File

@ -90,14 +90,16 @@ static const char *ipg_per_sel[] = {
static int imx35_ccm_probe(struct device_d *dev)
{
struct resource *iores;
u32 pdr0, consumer_sel, hsp_sel;
struct arm_ahb_div *aad;
unsigned char *hsp_div;
void __iomem *base;
base = dev_request_mem_region(dev, 0);
if (IS_ERR(base))
return PTR_ERR(base);
iores = dev_request_mem_resource(dev, 0);
if (IS_ERR(iores))
return PTR_ERR(iores);
base = IOMEM(iores->start);
writel(0xffffffff, base + CCM_CGR0);
writel(0xffffffff, base + CCM_CGR1);

View File

@ -304,11 +304,13 @@ int __init mx51_clocks_init(struct device_d *dev, void __iomem *regs)
static int imx51_ccm_probe(struct device_d *dev)
{
struct resource *iores;
void __iomem *regs;
regs = dev_request_mem_region(dev, 0);
if (IS_ERR(regs))
return PTR_ERR(regs);
iores = dev_request_mem_resource(dev, 0);
if (IS_ERR(iores))
return PTR_ERR(iores);
regs = IOMEM(iores->start);
mx51_clocks_init(dev, regs);
@ -392,9 +394,13 @@ int __init mx53_clocks_init(struct device_d *dev, void __iomem *regs)
static int imx53_ccm_probe(struct device_d *dev)
{
struct resource *iores;
void __iomem *regs;
regs = dev_request_mem_region(dev, 0);
iores = dev_request_mem_resource(dev, 0);
if (IS_ERR(iores))
return PTR_ERR(iores);
regs = IOMEM(iores->start);
mx53_clocks_init(dev, regs);

View File

@ -337,12 +337,14 @@ static void imx6_add_video_clks(void __iomem *anab, void __iomem *cb)
static int imx6_ccm_probe(struct device_d *dev)
{
struct resource *iores;
void __iomem *base, *anatop_base, *ccm_base;
anatop_base = (void *)MX6_ANATOP_BASE_ADDR;
ccm_base = dev_request_mem_region(dev, 0);
if (IS_ERR(ccm_base))
return PTR_ERR(ccm_base);
iores = dev_request_mem_resource(dev, 0);
if (IS_ERR(iores))
return PTR_ERR(iores);
ccm_base = IOMEM(iores->start);
base = anatop_base;

View File

@ -118,15 +118,17 @@ static struct clk_div_table video_div_table[] = {
static int imx6sx_ccm_probe(struct device_d *dev)
{
struct resource *iores;
void __iomem *base, *anatop_base, *ccm_base;
struct device_node *ccm_node = dev->device_node;
clks[IMX6SX_CLK_DUMMY] = clk_fixed("dummy", 0);
anatop_base = (void *)MX6_ANATOP_BASE_ADDR;
ccm_base = dev_request_mem_region(dev, 0);
if (IS_ERR(ccm_base))
return PTR_ERR(ccm_base);
iores = dev_request_mem_resource(dev, 0);
if (IS_ERR(iores))
return PTR_ERR(iores);
ccm_base = IOMEM(iores->start);
base = anatop_base;

View File

@ -91,6 +91,7 @@ static struct notifier_block imx_clock_notifier = {
static int imx_gpt_probe(struct device_d *dev)
{
struct resource *iores;
int i;
int ret;
unsigned long rate;
@ -103,9 +104,10 @@ static int imx_gpt_probe(struct device_d *dev)
if (ret)
return ret;
timer_base = dev_request_mem_region(dev, 0);
if (IS_ERR(timer_base))
return PTR_ERR(timer_base);
iores = dev_request_mem_resource(dev, 0);
if (IS_ERR(iores))
return PTR_ERR(iores);
timer_base = IOMEM(iores->start);
/* setup GP Timer 1 */
writel(TCTL_SWR, timer_base + GPT_TCTL);

View File

@ -308,6 +308,7 @@ static void imx6_mmdc_add_mem(void *mmdcbase, struct imx_esdctl_data *data)
static int imx_esdctl_probe(struct device_d *dev)
{
struct resource *iores;
struct imx_esdctl_data *data;
int ret;
void *base;
@ -316,9 +317,10 @@ static int imx_esdctl_probe(struct device_d *dev)
if (ret)
return ret;
base = dev_request_mem_region(dev, 0);
if (IS_ERR(base))
return PTR_ERR(base);
iores = dev_request_mem_resource(dev, 0);
if (IS_ERR(iores))
return PTR_ERR(iores);
base = IOMEM(iores->start);
if (imx_esdctl_disabled)
return 0;

View File

@ -389,6 +389,7 @@ static inline void imx_iim_init_dt(struct device_d *dev, struct iim_priv *iim)
static int imx_iim_probe(struct device_d *dev)
{
struct resource *iores;
struct iim_priv *iim;
int i, ret;
struct imx_iim_drvdata *drvdata = NULL;
@ -414,9 +415,10 @@ static int imx_iim_probe(struct device_d *dev)
iim->fuse_supply = ERR_PTR(-ENODEV);
iim->base = dev_request_mem_region(dev, 0);
if (IS_ERR(iim->base))
return PTR_ERR(iim->base);
iores = dev_request_mem_resource(dev, 0);
if (IS_ERR(iores))
return PTR_ERR(iores);
iim->base = IOMEM(iores->start);
for (i = 0; i < IIM_NUM_BANKS; i++) {
ret = imx_iim_add_bank(iim, i);

View File

@ -371,6 +371,7 @@ static struct regmap_bus imx_ocotp_regmap_bus = {
static int imx_ocotp_probe(struct device_d *dev)
{
struct resource *iores;
void __iomem *base;
struct ocotp_priv *priv;
int ret = 0;
@ -380,9 +381,10 @@ static int imx_ocotp_probe(struct device_d *dev)
if (ret)
return ret;
base = dev_request_mem_region(dev, 0);
if (IS_ERR(base))
return PTR_ERR(base);
iores = dev_request_mem_resource(dev, 0);
if (IS_ERR(iores))
return PTR_ERR(iores);
base = IOMEM(iores->start);
imx_ocotp_init_dt(dev, base);

View File

@ -179,12 +179,14 @@ static struct file_operations mxs_ocotp_ops = {
static int mxs_ocotp_probe(struct device_d *dev)
{
struct resource *iores;
int err;
struct ocotp_priv *priv = xzalloc(sizeof (*priv));
priv->base = dev_request_mem_region(dev, 0);
if (IS_ERR(priv->base))
return PTR_ERR(priv->base);
iores = dev_request_mem_resource(dev, 0);
if (IS_ERR(iores))
return PTR_ERR(iores);
priv->base = IOMEM(iores->start);
priv->clk = clk_get(dev, NULL);
if (IS_ERR(priv->clk))

View File

@ -202,11 +202,13 @@ static void tegra20_pmc_detect_reset_cause(void)
static int tegra20_pmc_probe(struct device_d *dev)
{
pmc_base = dev_request_mem_region(dev, 0);
if (IS_ERR(pmc_base)) {
struct resource *iores;
iores = dev_request_mem_resource(dev, 0);
if (IS_ERR(iores)) {
dev_err(dev, "could not get memory region\n");
return PTR_ERR(pmc_base);
return PTR_ERR(iores);
}
pmc_base = IOMEM(iores->start);
tegra_powergate_init();

View File

@ -45,17 +45,19 @@ static struct clocksource cs = {
static int tegra20_timer_probe(struct device_d *dev)
{
struct resource *iores;
u32 reg;
/* use only one timer */
if (timer_base)
return -EBUSY;
timer_base = dev_request_mem_region(dev, 0);
if (IS_ERR(timer_base)) {
iores = dev_request_mem_resource(dev, 0);
if (IS_ERR(iores)) {
dev_err(dev, "could not get memory region\n");
return PTR_ERR(timer_base);
return PTR_ERR(iores);
}
timer_base = IOMEM(iores->start);
/*
* calibrate timer to run at 1MHz

View File

@ -359,12 +359,14 @@ static struct clk *zynq_cpu_subclk(const char *name,
static int zynq_clock_probe(struct device_d *dev)
{
struct resource *iores;
void __iomem *slcr_base;
unsigned long ps_clk_rate = 33333330;
slcr_base = dev_request_mem_region(dev, 0);
if (IS_ERR(slcr_base))
return PTR_ERR(slcr_base);
iores = dev_request_mem_resource(dev, 0);
if (IS_ERR(iores))
return PTR_ERR(iores);
slcr_base = IOMEM(iores->start);
clks[ps_clk] = clk_fixed("ps_clk", ps_clk_rate);

View File

@ -54,11 +54,13 @@ EXPORT_SYMBOL(ar231x_reset_bit);
static int ar231x_reset_probe(struct device_d *dev)
{
reset_base = dev_request_mem_region(dev, 0);
if (IS_ERR(reset_base)) {
struct resource *iores;
iores = dev_request_mem_resource(dev, 0);
if (IS_ERR(iores)) {
dev_err(dev, "could not get memory region\n");
return PTR_ERR(reset_base);
return PTR_ERR(iores);
}
reset_base = IOMEM(iores->start);
return 0;
}

View File

@ -659,15 +659,17 @@ int ahci_add_host(struct ahci_device *ahci)
static int ahci_probe(struct device_d *dev)
{
struct resource *iores;
struct ahci_device *ahci;
void __iomem *regs;
int ret;
ahci = xzalloc(sizeof(*ahci));
regs = dev_request_mem_region(dev, 0);
if (IS_ERR(regs))
return PTR_ERR(regs);
iores = dev_request_mem_resource(dev, 0);
if (IS_ERR(iores))
return PTR_ERR(iores);
regs = IOMEM(iores->start);
ahci->dev = dev;
ahci->mmio_base = regs;

View File

@ -80,6 +80,7 @@ static void platform_ide_setup_port(void *reg_base, void *alt_base,
static int platform_ide_probe(struct device_d *dev)
{
struct resource *iores;
int rc;
struct ide_port_info *pdata = dev->platform_data;
struct ide_port *ide;
@ -102,11 +103,17 @@ static int platform_ide_probe(struct device_d *dev)
return -EINVAL;
}
reg_base = dev_request_mem_region(dev, 0);
iores = dev_request_mem_resource(dev, 0);
if (IS_ERR(iores))
return PTR_ERR(iores);
reg_base = IOMEM(iores->start);
if (!IS_ERR(reg_base)) {
mmio = 1;
alt_base = dev_request_mem_region(dev, 1);
iores = dev_request_mem_resource(dev, 1);
if (IS_ERR(iores))
return PTR_ERR(iores);
alt_base = IOMEM(iores->start);
if (IS_ERR(alt_base))
alt_base = NULL;
} else {

View File

@ -153,6 +153,7 @@ static int pata_imx_detect(struct device_d *dev)
static int imx_pata_probe(struct device_d *dev)
{
struct resource *iores;
struct ide_port *ide;
struct clk *clk;
void __iomem *base;
@ -160,9 +161,10 @@ static int imx_pata_probe(struct device_d *dev)
const char *devname = NULL;
ide = xzalloc(sizeof(*ide));
base = dev_request_mem_region(dev, 0);
if (IS_ERR(base))
return PTR_ERR(base);
iores = dev_request_mem_resource(dev, 0);
if (IS_ERR(iores))
return PTR_ERR(iores);
base = IOMEM(iores->start);
clk = clk_get(dev, NULL);
if (IS_ERR(clk)) {

View File

@ -84,6 +84,7 @@ static int imx_sata_init_1ms(struct imx_ahci *imx_ahci)
static int imx_sata_probe(struct device_d *dev)
{
struct resource *iores;
struct imx_ahci *imx_ahci;
struct imx_sata_data *data;
int ret;
@ -100,9 +101,10 @@ static int imx_sata_probe(struct device_d *dev)
goto err_free;
}
imx_ahci->ahci.mmio_base = dev_request_mem_region(dev, 0);
if (IS_ERR(imx_ahci->ahci.mmio_base))
return PTR_ERR(imx_ahci->ahci.mmio_base);
iores = dev_request_mem_resource(dev, 0);
if (IS_ERR(iores))
return PTR_ERR(iores);
imx_ahci->ahci.mmio_base = IOMEM(iores->start);
data->init(imx_ahci);

View File

@ -130,6 +130,7 @@ static int weim_parse_dt(struct imx_weim *weim)
static int weim_probe(struct device_d *dev)
{
struct resource *iores;
struct imx_weim_devtype *devtype;
struct imx_weim *weim;
int ret;
@ -144,11 +145,12 @@ static int weim_probe(struct device_d *dev)
weim->devtype = devtype;
/* get the resource */
weim->base = dev_request_mem_region(dev, 0);
if (IS_ERR(weim->base)) {
ret = PTR_ERR(weim->base);
iores = dev_request_mem_resource(dev, 0);
if (IS_ERR(iores)) {
ret = PTR_ERR(iores);
goto weim_err;
}
weim->base = IOMEM(iores->start);
/* parse the device node */
ret = weim_parse_dt(weim);

View File

@ -137,11 +137,13 @@ static void ar933x_pll_init(void __iomem *base)
static int ar933x_clk_probe(struct device_d *dev)
{
struct resource *iores;
void __iomem *base;
base = dev_request_mem_region(dev, 0);
if (IS_ERR(base))
return PTR_ERR(base);
iores = dev_request_mem_resource(dev, 0);
if (IS_ERR(iores))
return PTR_ERR(iores);
base = IOMEM(iores->start);
ar933x_ref_clk_init(base);
ar933x_pll_init(base);

View File

@ -42,6 +42,7 @@ static struct of_device_id mvebu_coreclk_ids[] = {
int mvebu_coreclk_probe(struct device_d *dev)
{
struct resource *iores;
struct device_node *np = dev->device_node;
const struct of_device_id *match;
const struct coreclk_soc_desc *desc;
@ -57,9 +58,10 @@ int mvebu_coreclk_probe(struct device_d *dev)
desc = (const struct coreclk_soc_desc *)match->data;
/* Get SAR base address */
base = dev_request_mem_region(dev, 0);
if (IS_ERR(base))
return PTR_ERR(base);
iores = dev_request_mem_resource(dev, 0);
if (IS_ERR(iores))
return PTR_ERR(iores);
base = IOMEM(iores->start);
/* Allocate struct for TCLK, cpu clk, and core ratio clocks */
clk_data.clk_num = 2 + desc->num_ratios;
@ -151,6 +153,7 @@ static struct of_device_id mvebu_clk_gating_ids[] = {
int mvebu_clk_gating_probe(struct device_d *dev)
{
struct resource *iores;
struct device_node *np = dev->device_node;
const struct of_device_id *match;
const struct clk_gating_soc_desc *desc;
@ -166,9 +169,10 @@ int mvebu_clk_gating_probe(struct device_d *dev)
return -EINVAL;
desc = (const struct clk_gating_soc_desc *)match->data;
base = dev_request_mem_region(dev, 0);
if (IS_ERR(base))
return PTR_ERR(base);
iores = dev_request_mem_resource(dev, 0);
if (IS_ERR(iores))
return PTR_ERR(iores);
base = IOMEM(iores->start);
clk = of_clk_get(np, 0);
if (IS_ERR(clk))

View File

@ -199,6 +199,7 @@ static struct of_device_id mvebu_corediv_clk_ids[] = {
static int mvebu_corediv_clk_probe(struct device_d *dev)
{
struct resource *iores;
struct device_node *np = dev->device_node;
const struct of_device_id *match;
const struct clk_corediv_soc_desc *soc_desc;
@ -212,9 +213,10 @@ static int mvebu_corediv_clk_probe(struct device_d *dev)
return -EINVAL;
soc_desc = (const struct clk_corediv_soc_desc *)match->data;
base = dev_request_mem_region(dev, 0);
if (IS_ERR(base))
return PTR_ERR(base);
iores = dev_request_mem_resource(dev, 0);
if (IS_ERR(iores))
return PTR_ERR(iores);
base = IOMEM(iores->start);
parent = of_clk_get(np, 0);
if (IS_ERR(parent))

View File

@ -126,11 +126,13 @@ int __init mx23_clocks_init(void __iomem *regs)
static int imx23_ccm_probe(struct device_d *dev)
{
struct resource *iores;
void __iomem *regs;
regs = dev_request_mem_region(dev, 0);
if (IS_ERR(regs))
return PTR_ERR(regs);
iores = dev_request_mem_resource(dev, 0);
if (IS_ERR(iores))
return PTR_ERR(iores);
regs = IOMEM(iores->start);
mx23_clocks_init(regs);

View File

@ -167,11 +167,13 @@ int __init mx28_clocks_init(void __iomem *regs)
static int imx28_ccm_probe(struct device_d *dev)
{
struct resource *iores;
void __iomem *regs;
regs = dev_request_mem_region(dev, 0);
if (IS_ERR(regs))
return PTR_ERR(regs);
iores = dev_request_mem_resource(dev, 0);
if (IS_ERR(iores))
return PTR_ERR(iores);
regs = IOMEM(iores->start);
mx28_clocks_init(regs);

View File

@ -374,12 +374,14 @@ static void socfpga_register_clocks(struct device_d *dev, struct device_node *no
static int socfpga_ccm_probe(struct device_d *dev)
{
struct resource *iores;
void __iomem *regs;
struct device_node *clknode;
regs = dev_request_mem_region(dev, 0);
if (IS_ERR(regs))
return PTR_ERR(regs);
iores = dev_request_mem_resource(dev, 0);
if (IS_ERR(iores))
return PTR_ERR(iores);
regs = IOMEM(iores->start);
clk_mgr_base_addr = regs;

View File

@ -335,9 +335,11 @@ static struct tegra_clk_init_table init_table[] = {
static int tegra124_car_probe(struct device_d *dev)
{
car_base = dev_request_mem_region(dev, 0);
if (IS_ERR(car_base))
return PTR_ERR(car_base);
struct resource *iores;
iores = dev_request_mem_resource(dev, 0);
if (IS_ERR(iores))
return PTR_ERR(iores);
car_base = IOMEM(iores->start);
tegra124_osc_clk_init();
tegra124_pll_init();

View File

@ -338,9 +338,11 @@ static struct tegra_clk_init_table init_table[] = {
static int tegra20_car_probe(struct device_d *dev)
{
car_base = dev_request_mem_region(dev, 0);
if (IS_ERR(car_base))
return PTR_ERR(car_base);
struct resource *iores;
iores = dev_request_mem_resource(dev, 0);
if (IS_ERR(iores))
return PTR_ERR(iores);
car_base = IOMEM(iores->start);
tegra20_osc_clk_init();
tegra20_pll_init();

View File

@ -366,9 +366,11 @@ static struct tegra_clk_init_table init_table[] = {
static int tegra30_car_probe(struct device_d *dev)
{
car_base = dev_request_mem_region(dev, 0);
if (IS_ERR(car_base))
return PTR_ERR(car_base);
struct resource *iores;
iores = dev_request_mem_resource(dev, 0);
if (IS_ERR(iores))
return PTR_ERR(iores);
car_base = IOMEM(iores->start);
tegra30_osc_clk_init();
tegra30_pll_init();

View File

@ -42,6 +42,7 @@ static struct clocksource smp_twd_clksrc = {
static int smp_twd_probe(struct device_d *dev)
{
struct resource *iores;
u32 tick_rate;
u32 val;
int ret;
@ -61,9 +62,10 @@ static int smp_twd_probe(struct device_d *dev)
return ret;
}
twd_base = dev_request_mem_region(dev, 0);
if (IS_ERR(twd_base))
return PTR_ERR(twd_base);
iores = dev_request_mem_resource(dev, 0);
if (IS_ERR(iores))
return PTR_ERR(iores);
twd_base = IOMEM(iores->start);
tick_rate = clk_get_rate(twd_clk);
if (tick_rate > SMP_TWD_MAX_FREQ) {

View File

@ -42,6 +42,7 @@ static struct clocksource bcm2835_stc = {
static int bcm2835_cs_probe(struct device_d *dev)
{
struct resource *iores;
static struct clk *stc_clk;
u32 rate;
int ret;
@ -61,9 +62,10 @@ static int bcm2835_cs_probe(struct device_d *dev)
}
rate = clk_get_rate(stc_clk);
stc_base = dev_request_mem_region(dev, 0);
if (IS_ERR(stc_base))
return PTR_ERR(stc_base);
iores = dev_request_mem_resource(dev, 0);
if (IS_ERR(iores))
return PTR_ERR(iores);
stc_base = IOMEM(iores->start);
clocks_calc_mult_shift(&bcm2835_stc.mult, &bcm2835_stc.shift, rate, NSEC_PER_SEC, 60);

View File

@ -29,6 +29,7 @@ static struct clocksource clps711x_cs = {
static int clps711x_cs_probe(struct device_d *dev)
{
struct resource *iores;
u32 rate;
struct clk *timer_clk;
@ -37,11 +38,12 @@ static int clps711x_cs_probe(struct device_d *dev)
return PTR_ERR(timer_clk);
rate = clk_get_rate(timer_clk);
clps711x_timer_base = dev_request_mem_region(dev, 0);
if (IS_ERR(clps711x_timer_base)) {
iores = dev_request_mem_resource(dev, 0);
if (IS_ERR(iores)) {
clk_put(timer_clk);
return PTR_ERR(clps711x_timer_base);
return PTR_ERR(iores);
}
clps711x_timer_base = IOMEM(iores->start);
clocks_calc_mult_shift(&clps711x_cs.mult, &clps711x_cs.shift, rate,
NSEC_PER_SEC, 10);

View File

@ -40,15 +40,17 @@ static struct clocksource digic_cs = {
static int digic_timer_probe(struct device_d *dev)
{
struct resource *iores;
/* use only one timer */
if (timer_base)
return -EBUSY;
timer_base = dev_request_mem_region(dev, 0);
if (IS_ERR(timer_base)) {
iores = dev_request_mem_resource(dev, 0);
if (IS_ERR(iores)) {
dev_err(dev, "could not get memory region\n");
return PTR_ERR(timer_base);
return PTR_ERR(iores);
}
timer_base = IOMEM(iores->start);
clocks_calc_mult_shift(&digic_cs.mult, &digic_cs.shift,
DIGIC_TIMER_CLOCK, NSEC_PER_SEC, 1);

View File

@ -56,12 +56,14 @@ static struct clocksource cs = {
static int mvebu_timer_probe(struct device_d *dev)
{
struct resource *iores;
struct clk *clk;
u32 rate, div, val;
timer_base = dev_request_mem_region(dev, 0);
if (IS_ERR(timer_base))
return PTR_ERR(timer_base);
iores = dev_request_mem_resource(dev, 0);
if (IS_ERR(iores))
return PTR_ERR(iores);
timer_base = IOMEM(iores->start);
val = __raw_readl(timer_base + TIMER_CTRL_OFF);
val &= ~(TIMER0_25MHZ | TIMER0_DIV_MASK);

View File

@ -94,6 +94,7 @@ static void nmdk_timer_reset(void)
static int nmdk_mtu_probe(struct device_d *dev)
{
struct resource *iores;
static struct clk *mtu_clk;
u32 rate;
int ret;
@ -123,9 +124,10 @@ static int nmdk_mtu_probe(struct device_d *dev)
nmdk_cycle = (rate + 1000 / 2) / 1000;
/* Save global pointer to mtu, used by functions above */
mtu_base = dev_request_mem_region(dev, 0);
if (IS_ERR(mtu_base))
return PTR_ERR(mtu_base);
iores = dev_request_mem_resource(dev, 0);
if (IS_ERR(iores))
return PTR_ERR(iores);
mtu_base = IOMEM(iores->start);
/* Init the timer and register clocksource */
nmdk_timer_reset();

View File

@ -45,12 +45,14 @@ static struct clocksource clksrc = {
static int orion_timer_probe(struct device_d *dev)
{
struct resource *iores;
struct clk *tclk;
uint32_t val;
timer_base = dev_request_mem_region(dev, 0);
if (IS_ERR(timer_base))
return PTR_ERR(timer_base);
iores = dev_request_mem_resource(dev, 0);
if (IS_ERR(iores))
return PTR_ERR(iores);
timer_base = IOMEM(iores->start);
tclk = clk_get(dev, NULL);

View File

@ -66,6 +66,7 @@ static struct clocksource uemd_cs = {
static int uemd_timer_probe(struct device_d *dev)
{
struct resource *iores;
int mode;
struct clk *timer_clk;
@ -73,11 +74,12 @@ static int uemd_timer_probe(struct device_d *dev)
if (timer_base)
return -EBUSY;
timer_base = dev_request_mem_region(dev, 0);
if (IS_ERR(timer_base)) {
iores = dev_request_mem_resource(dev, 0);
if (IS_ERR(iores)) {
dev_err(dev, "could not get memory region\n");
return PTR_ERR(timer_base);
return PTR_ERR(iores);
}
timer_base = IOMEM(iores->start);
timer_clk = clk_get(dev, NULL);
if (IS_ERR(timer_clk)) {

View File

@ -588,6 +588,7 @@ int mxs_dma_go(int chan)
*/
static int apbh_dma_probe(struct device_d *dev)
{
struct resource *iores;
struct apbh_dma *apbh;
struct mxs_dma_chan *pchan;
enum mxs_dma_id id;
@ -598,9 +599,10 @@ static int apbh_dma_probe(struct device_d *dev)
return ret;
apbh_dma = apbh = xzalloc(sizeof(*apbh));
apbh->regs = dev_request_mem_region(dev, 0);
if (IS_ERR(apbh->regs))
return PTR_ERR(apbh->regs);
iores = dev_request_mem_resource(dev, 0);
if (IS_ERR(iores))
return PTR_ERR(iores);
apbh->regs = IOMEM(iores->start);
apbh->id = id;

View File

@ -395,6 +395,7 @@ static int programmed_get(struct param_d *p, void *priv)
static int fpgamgr_probe(struct device_d *dev)
{
struct resource *iores;
struct fpgamgr *mgr;
struct firmware_handler *fh;
const char *alias = of_alias_get(dev->device_node);
@ -407,17 +408,19 @@ static int fpgamgr_probe(struct device_d *dev)
mgr = xzalloc(sizeof(*mgr));
fh = &mgr->fh;
mgr->regs = dev_request_mem_region(dev, 0);
if (IS_ERR(mgr->regs)) {
ret = PTR_ERR(mgr->regs);
iores = dev_request_mem_resource(dev, 0);
if (IS_ERR(iores)) {
ret = PTR_ERR(iores);
goto out;
}
mgr->regs = IOMEM(iores->start);
mgr->regs_data = dev_request_mem_region(dev, 1);
if (IS_ERR(mgr->regs_data)) {
ret = PTR_ERR(mgr->regs_data);
iores = dev_request_mem_resource(dev, 1);
if (IS_ERR(iores)) {
ret = PTR_ERR(iores);
goto out;
}
mgr->regs_data = IOMEM(iores->start);
if (alias)
fh->id = xstrdup(alias);

View File

@ -107,6 +107,7 @@ static const struct of_device_id ath79_gpio_of_match[] = {
static int ath79_gpio_probe(struct device_d *dev)
{
struct resource *iores;
struct device_node *np = dev->device_node;
int err;
@ -125,11 +126,12 @@ static int ath79_gpio_probe(struct device_d *dev)
return -EINVAL;
}
ath79_gpio_base = dev_request_mem_region(dev, 0);
if (IS_ERR(ath79_gpio_base)) {
iores = dev_request_mem_resource(dev, 0);
if (IS_ERR(iores)) {
dev_err(dev, "could not get memory region\n");
return PTR_ERR(ath79_gpio_base);
return PTR_ERR(iores);
}
ath79_gpio_base = IOMEM(iores->start);
ath79_gpio_chip.dev = dev;
ath79_gpio_chip.ngpio = ath79_gpio_count;

View File

@ -112,11 +112,15 @@ static struct gpio_ops bcm2835_gpio_ops = {
static int bcm2835_gpio_probe(struct device_d *dev)
{
struct resource *iores;
struct bcm2835_gpio_chip *bcmgpio;
int ret;
bcmgpio = xzalloc(sizeof(*bcmgpio));
bcmgpio->base = dev_request_mem_region(dev, 0);
iores = dev_request_mem_resource(dev, 0);
if (IS_ERR(iores))
return PTR_ERR(iores);
bcmgpio->base = IOMEM(iores->start);
bcmgpio->chip.ops = &bcm2835_gpio_ops;
bcmgpio->chip.base = 0;
bcmgpio->chip.ngpio = 54;

View File

@ -15,6 +15,7 @@
static int clps711x_gpio_probe(struct device_d *dev)
{
struct resource *iores;
int err, id = dev->id;
void __iomem *dat, *dir = NULL, *dir_inv = NULL;
struct bgpio_chip *bgc;
@ -25,20 +26,23 @@ static int clps711x_gpio_probe(struct device_d *dev)
if (id < 0 || id > 4)
return -ENODEV;
dat = dev_request_mem_region(dev, 0);
if (IS_ERR(dat))
return PTR_ERR(dat);
iores = dev_request_mem_resource(dev, 0);
if (IS_ERR(iores))
return PTR_ERR(iores);
dat = IOMEM(iores->start);
switch (id) {
case 3:
dir_inv = dev_request_mem_region(dev, 1);
if (IS_ERR(dir_inv))
return PTR_ERR(dir_inv);
iores = dev_request_mem_resource(dev, 1);
if (IS_ERR(iores))
return PTR_ERR(iores);
dir_inv = IOMEM(iores->start);
break;
default:
dir = dev_request_mem_region(dev, 1);
if (IS_ERR(dir))
return PTR_ERR(dir);
iores = dev_request_mem_resource(dev, 1);
if (IS_ERR(iores))
return PTR_ERR(iores);
dir = IOMEM(iores->start);
break;
}

View File

@ -142,6 +142,7 @@ static struct gpio_ops davinci_gpio_ops = {
static int davinci_gpio_probe(struct device_d *dev)
{
struct resource *iores;
void __iomem *gpio_base;
int ret;
u32 val;
@ -162,11 +163,12 @@ static int davinci_gpio_probe(struct device_d *dev)
chips = xzalloc((ngpio / 32 + 1) * sizeof(*chips));
gpio_base = dev_request_mem_region(dev, 0);
if (IS_ERR(gpio_base)) {
iores = dev_request_mem_resource(dev, 0);
if (IS_ERR(iores)) {
dev_err(dev, "could not get memory region\n");
return PTR_ERR(gpio_base);
return PTR_ERR(iores);
}
gpio_base = IOMEM(iores->start);
for (i = 0, base = 0; base < ngpio; i++, base += 32) {
struct davinci_gpio_regs __iomem *regs;

View File

@ -122,6 +122,7 @@ static struct gpio_ops digic_gpio_ops = {
static int digic_gpio_probe(struct device_d *dev)
{
struct resource *iores;
struct digic_gpio_chip *chip;
struct resource *res;
resource_size_t rsize;
@ -136,7 +137,10 @@ static int digic_gpio_probe(struct device_d *dev)
rsize = resource_size(res);
chip->gc.ngpio = rsize / sizeof(int32_t);
chip->base = dev_request_mem_region(dev, 0);
iores = dev_request_mem_resource(dev, 0);
if (IS_ERR(iores))
return PTR_ERR(iores);
chip->base = IOMEM(iores->start);
chip->gc.ops = &digic_gpio_ops;
chip->gc.base = 0;

View File

@ -164,14 +164,16 @@ static int dw_gpio_add_port(struct device_d *dev, struct device_node *node,
static int dw_gpio_probe(struct device_d *dev)
{
struct resource *iores;
struct dw_gpio *gpio;
struct device_node *node;
gpio = xzalloc(sizeof(*gpio));
gpio->regs = dev_request_mem_region(dev, 0);
if (IS_ERR(gpio->regs))
return PTR_ERR(gpio->regs);
iores = dev_request_mem_resource(dev, 0);
if (IS_ERR(iores))
return PTR_ERR(iores);
gpio->regs = IOMEM(iores->start);
for_each_child_of_node(dev->device_node, node)
dw_gpio_add_port(dev, node, gpio);

View File

@ -132,6 +132,7 @@ static struct gpio_ops imx_gpio_ops = {
static int imx_gpio_probe(struct device_d *dev)
{
struct resource *iores;
struct imx_gpio_chip *imxgpio;
struct imx_gpio_regs *regs;
int ret;
@ -141,7 +142,10 @@ static int imx_gpio_probe(struct device_d *dev)
return ret;
imxgpio = xzalloc(sizeof(*imxgpio));
imxgpio->base = dev_request_mem_region(dev, 0);
iores = dev_request_mem_resource(dev, 0);
if (IS_ERR(iores))
return PTR_ERR(iores);
imxgpio->base = IOMEM(iores->start);
imxgpio->chip.ops = &imx_gpio_ops;
if (dev->id < 0) {
imxgpio->chip.base = of_alias_get_id(dev->device_node, "gpio");

View File

@ -90,15 +90,17 @@ static struct gpio_ops jz4740_gpio_ops = {
static int jz4740_gpio_probe(struct device_d *dev)
{
struct resource *iores;
void __iomem *base;
struct jz4740_gpio_chip *jz4740_gpio;
int ret;
base = dev_request_mem_region(dev, 0);
if (IS_ERR(base)) {
iores = dev_request_mem_resource(dev, 0);
if (IS_ERR(iores)) {
dev_err(dev, "could not get memory region\n");
return PTR_ERR(base);
return PTR_ERR(iores);
}
base = IOMEM(iores->start);
jz4740_gpio = xzalloc(sizeof(*jz4740_gpio));
jz4740_gpio->base = base;

View File

@ -133,15 +133,17 @@ static struct gpio_ops malta_i2c_gpio_ops = {
static int malta_i2c_gpio_probe(struct device_d *dev)
{
struct resource *iores;
void __iomem *gpio_base;
struct malta_i2c_gpio *sc;
int ret;
gpio_base = dev_request_mem_region(dev, 0);
if (IS_ERR(gpio_base)) {
iores = dev_request_mem_resource(dev, 0);
if (IS_ERR(iores)) {
dev_err(dev, "could not get memory region\n");
return PTR_ERR(gpio_base);
return PTR_ERR(iores);
}
gpio_base = IOMEM(iores->start);
sc = xzalloc(sizeof(*sc));
sc->base = gpio_base;

View File

@ -141,15 +141,17 @@ static struct gpio_ops omap_gpio_ops = {
static int omap_gpio_probe(struct device_d *dev)
{
struct resource *iores;
struct omap_gpio_chip *omapgpio;
struct omap_gpio_drvdata *drvdata = NULL;
dev_get_drvdata(dev, (const void **)&drvdata);
omapgpio = xzalloc(sizeof(*omapgpio));
omapgpio->base = dev_request_mem_region(dev, 0);
if (IS_ERR(omapgpio->base))
return PTR_ERR(omapgpio->base);
iores = dev_request_mem_resource(dev, 0);
if (IS_ERR(iores))
return PTR_ERR(iores);
omapgpio->base = IOMEM(iores->start);
if (drvdata)
omapgpio->base += drvdata->regofs;

View File

@ -89,6 +89,7 @@ static struct gpio_ops orion_gpio_ops = {
static int orion_gpio_probe(struct device_d *dev)
{
struct resource *iores;
struct orion_gpio_chip *gpio;
dev->id = of_alias_get_id(dev->device_node, "gpio");
@ -96,11 +97,12 @@ static int orion_gpio_probe(struct device_d *dev)
return dev->id;
gpio = xzalloc(sizeof(*gpio));
gpio->regs = dev_request_mem_region(dev, 0);
if (IS_ERR(gpio->regs)) {
iores = dev_request_mem_resource(dev, 0);
if (IS_ERR(iores)) {
free(gpio);
return PTR_ERR(gpio->regs);
return PTR_ERR(iores);
}
gpio->regs = IOMEM(iores->start);
gpio->chip.dev = dev;
gpio->chip.ops = &orion_gpio_ops;
gpio->chip.base = dev->id * 32;

View File

@ -140,6 +140,7 @@ static struct gpio_chip tegra_gpio_chip = {
static int tegra_gpio_probe(struct device_d *dev)
{
struct resource *iores;
int i, j, ret;
ret = dev_get_drvdata(dev, (const void **)&config);
@ -148,11 +149,12 @@ static int tegra_gpio_probe(struct device_d *dev)
return ret;
}
gpio_base = dev_request_mem_region(dev, 0);
if (IS_ERR(gpio_base)) {
iores = dev_request_mem_resource(dev, 0);
if (IS_ERR(iores)) {
dev_err(dev, "could not get memory region\n");
return PTR_ERR(gpio_base);
return PTR_ERR(iores);
}
gpio_base = IOMEM(iores->start);
for (i = 0; i < config->bank_count; i++) {
for (j = 0; j < 4; j++) {

View File

@ -410,6 +410,7 @@ static struct of_device_id at91_twi_dt_ids[] = {
static int at91_twi_probe(struct device_d *dev)
{
struct resource *iores;
struct at91_twi_dev *i2c_at91;
struct at91_twi_pdata *i2c_data;
int rc = 0;
@ -425,7 +426,10 @@ static int at91_twi_probe(struct device_d *dev)
i2c_at91->pdata = i2c_data;
i2c_at91->base = dev_request_mem_region(dev, 0);
iores = dev_request_mem_resource(dev, 0);
if (IS_ERR(iores))
return PTR_ERR(iores);
i2c_at91->base = IOMEM(iores->start);
if (IS_ERR(i2c_at91->base)) {
dev_err(dev, "could not get memory region\n");
rc = PTR_ERR(i2c_at91->base);

View File

@ -472,6 +472,7 @@ static int i2c_dw_xfer(struct i2c_adapter *adapter,
static int i2c_dw_probe(struct device_d *pdev)
{
struct resource *iores;
struct dw_i2c_dev *dw;
struct i2c_platform_data *pdata;
int ret, bitrate;
@ -494,11 +495,12 @@ static int i2c_dw_probe(struct device_d *pdev)
dw->adapter.dev.parent = pdev;
dw->adapter.dev.device_node = pdev->device_node;
dw->base = dev_request_mem_region(pdev, 0);
if (IS_ERR(dw->base)) {
ret = PTR_ERR(dw->base);
iores = dev_request_mem_resource(pdev, 0);
if (IS_ERR(iores)) {
ret = PTR_ERR(iores);
goto fail;
}
dw->base = IOMEM(iores->start);
ic_comp_type_value = readl(dw->base + DW_IC_COMP_TYPE);
if (ic_comp_type_value != DW_IC_COMP_TYPE_VALUE) {

View File

@ -584,6 +584,7 @@ static void i2c_fsl_init_recovery(struct fsl_i2c_struct *i2c_fsl, struct device_
static int __init i2c_fsl_probe(struct device_d *pdev)
{
struct resource *iores;
struct fsl_i2c_struct *i2c_fsl;
struct i2c_platform_data *pdata;
int ret;
@ -604,11 +605,12 @@ static int __init i2c_fsl_probe(struct device_d *pdev)
i2c_fsl->adapter.nr = pdev->id;
i2c_fsl->adapter.dev.parent = pdev;
i2c_fsl->adapter.dev.device_node = pdev->device_node;
i2c_fsl->base = dev_request_mem_region(pdev, 0);
if (IS_ERR(i2c_fsl->base)) {
ret = PTR_ERR(i2c_fsl->base);
iores = dev_request_mem_resource(pdev, 0);
if (IS_ERR(iores)) {
ret = PTR_ERR(iores);
goto fail;
}
i2c_fsl->base = IOMEM(iores->start);
i2c_fsl_init_recovery(i2c_fsl, pdev);

View File

@ -595,6 +595,7 @@ out:
static int
mv64xxx_i2c_probe(struct device_d *pd)
{
struct resource *iores;
struct mv64xxx_i2c_data *drv_data;
int rc;
@ -603,9 +604,10 @@ mv64xxx_i2c_probe(struct device_d *pd)
drv_data = xzalloc(sizeof(*drv_data));
drv_data->reg_base = dev_request_mem_region(pd, 0);
if (IS_ERR(drv_data->reg_base))
return PTR_ERR(drv_data->reg_base);
iores = dev_request_mem_resource(pd, 0);
if (IS_ERR(iores))
return PTR_ERR(iores);
drv_data->reg_base = IOMEM(iores->start);
drv_data->clk = clk_get(pd, NULL);
if (IS_ERR(drv_data->clk))

View File

@ -1070,6 +1070,7 @@ static struct i2c_bus_recovery_info omap_i2c_bus_recovery_info = {
static int __init
i2c_omap_probe(struct device_d *pdev)
{
struct resource *iores;
struct omap_i2c_struct *i2c_omap;
struct omap_i2c_driver_data *i2c_data;
int r;
@ -1109,9 +1110,10 @@ i2c_omap_probe(struct device_d *pdev)
speed = 100; /* Default speed */
i2c_omap->speed = speed;
i2c_omap->base = dev_request_mem_region(pdev, 0);
if (IS_ERR(i2c_omap->base))
return PTR_ERR(i2c_omap->base);
iores = dev_request_mem_resource(pdev, 0);
if (IS_ERR(iores))
return PTR_ERR(iores);
i2c_omap->base = IOMEM(iores->start);
/*
* Read the Rev hi bit-[15:14] ie scheme this is 1 indicates ver2.

View File

@ -605,16 +605,18 @@ static const struct tegra_i2c_hw_feature tegra114_i2c_hw = {
static int tegra_i2c_probe(struct device_d *dev)
{
struct resource *iores;
struct tegra_i2c_dev *i2c_dev;
struct clk *div_clk, *fast_clk;
void __iomem *base;
int ret = 0;
base = dev_request_mem_region(dev, 0);
if (IS_ERR(base)) {
iores = dev_request_mem_resource(dev, 0);
if (IS_ERR(iores)) {
dev_err(dev, "could not get iomem region\n");
return PTR_ERR(base);
return PTR_ERR(iores);
}
base = IOMEM(iores->start);
div_clk = clk_get(dev, "div-clk");
if (IS_ERR(div_clk)) {

View File

@ -66,6 +66,7 @@ static struct i2c_algo_bit_data i2c_versatile_algo = {
static int i2c_versatile_probe(struct device_d *dev)
{
struct resource *iores;
struct i2c_versatile *i2c;
int ret;
@ -75,11 +76,12 @@ static int i2c_versatile_probe(struct device_d *dev)
goto err_release;
}
i2c->base = dev_request_mem_region(dev, 0);
if (IS_ERR(i2c->base)) {
ret = PTR_ERR(i2c->base);
iores = dev_request_mem_resource(dev, 0);
if (IS_ERR(iores)) {
ret = PTR_ERR(iores);
goto err_free;
}
i2c->base = IOMEM(iores->start);
writel(SCL | SDA, i2c->base + I2C_CONTROLS);

View File

@ -364,6 +364,7 @@ static void imx_keypad_inhibit(struct imx_keypad *keypad)
static int __init imx_keypad_probe(struct device_d *dev)
{
struct resource *iores;
struct imx_keypad *keypad;
const struct matrix_keymap_data *keymap_data = dev->platform_data;
int i, ret, row, col;
@ -371,9 +372,10 @@ static int __init imx_keypad_probe(struct device_d *dev)
keypad = xzalloc(sizeof(struct imx_keypad));
keypad->dev = dev;
keypad->mmio_base = dev_request_mem_region(dev, 0);
if (IS_ERR(keypad->mmio_base))
return PTR_ERR(keypad->mmio_base);
iores = dev_request_mem_resource(dev, 0);
if (IS_ERR(iores))
return PTR_ERR(iores);
keypad->mmio_base = IOMEM(iores->start);
ret = matrix_keypad_build_keymap(dev, keymap_data, MATRIX_ROW_SHIFT,
keypad->keycodes);

View File

@ -533,6 +533,7 @@ static void atmci_get_cap(struct atmel_mci *host)
static int atmci_probe(struct device_d *hw_dev)
{
struct resource *iores;
struct atmel_mci *host;
struct atmel_mci_platform_data *pd = hw_dev->platform_data;
int ret;
@ -572,9 +573,10 @@ static int atmci_probe(struct device_d *hw_dev)
host->mci.host_caps |= MMC_CAP_8_BIT_DATA;
host->slot_b = pd->slot_b;
host->regs = dev_request_mem_region(hw_dev, 0);
if (IS_ERR(host->regs))
return PTR_ERR(host->regs);
iores = dev_request_mem_resource(hw_dev, 0);
if (IS_ERR(iores))
return PTR_ERR(iores);
host->regs = IOMEM(iores->start);
host->hw_dev = hw_dev;
hw_dev->priv = host;
host->clk = clk_get(hw_dev, "mci_clk");

View File

@ -675,6 +675,7 @@ static int dw_mmc_detect(struct device_d *dev)
static int dw_mmc_probe(struct device_d *dev)
{
struct resource *iores;
struct dwmci_host *host;
struct dw_mmc_platform_data *pdata = dev->platform_data;
@ -692,9 +693,10 @@ static int dw_mmc_probe(struct device_d *dev)
clk_enable(host->clk_ciu);
host->dev = dev;
host->ioaddr = dev_request_mem_region(dev, 0);
if (IS_ERR(host->ioaddr))
return PTR_ERR(host->ioaddr);
iores = dev_request_mem_resource(dev, 0);
if (IS_ERR(iores))
return PTR_ERR(iores);
host->ioaddr = IOMEM(iores->start);
host->idmac = dma_alloc_coherent(sizeof(*host->idmac) * DW_MMC_NUM_IDMACS,
DMA_ADDRESS_BROKEN);

View File

@ -545,6 +545,7 @@ static int fsl_esdhc_detect(struct device_d *dev)
static int fsl_esdhc_probe(struct device_d *dev)
{
struct resource *iores;
struct fsl_esdhc_host *host;
struct mci_host *mci;
u32 caps;
@ -560,9 +561,10 @@ static int fsl_esdhc_probe(struct device_d *dev)
return PTR_ERR(host->clk);
host->dev = dev;
host->regs = dev_request_mem_region(dev, 0);
if (IS_ERR(host->regs))
return PTR_ERR(host->regs);
iores = dev_request_mem_resource(dev, 0);
if (IS_ERR(iores))
return PTR_ERR(iores);
host->regs = IOMEM(iores->start);
/* First reset the eSDHC controller */
ret = esdhc_reset(host);

View File

@ -492,6 +492,7 @@ static int mxcmci_init(struct mci_host *mci, struct device_d *dev)
static int mxcmci_probe(struct device_d *dev)
{
struct resource *iores;
struct mxcmci_host *host;
unsigned long rate;
@ -507,9 +508,10 @@ static int mxcmci_probe(struct device_d *dev)
host->mci.host_caps = MMC_CAP_4_BIT_DATA;
host->mci.hw_dev = dev;
host->base = dev_request_mem_region(dev, 0);
if (IS_ERR(host->base))
return PTR_ERR(host->base);
iores = dev_request_mem_resource(dev, 0);
if (IS_ERR(iores))
return PTR_ERR(iores);
host->base = IOMEM(iores->start);
host->mci.voltages = MMC_VDD_32_33 | MMC_VDD_33_34;

View File

@ -480,6 +480,7 @@ static int bcm2835_mci_detect(struct device_d *dev)
static int bcm2835_mci_probe(struct device_d *hw_dev)
{
struct resource *iores;
struct bcm2835_mci_host *host;
static struct clk *clk;
int ret;
@ -505,11 +506,12 @@ static int bcm2835_mci_probe(struct device_d *hw_dev)
host->mci.hw_dev = hw_dev;
host->hw_dev = hw_dev;
host->max_clock = clk_get_rate(clk);
host->regs = dev_request_mem_region(hw_dev, 0);
if (IS_ERR(host->regs)) {
iores = dev_request_mem_resource(hw_dev, 0);
if (IS_ERR(iores)) {
dev_err(host->hw_dev, "Failed request mem region, aborting...\n");
return PTR_ERR(host->regs);
return PTR_ERR(iores);
}
host->regs = IOMEM(iores->start);
host->mci.host_caps |= MMC_CAP_4_BIT_DATA | MMC_CAP_SD_HIGHSPEED |
MMC_CAP_MMC_HIGHSPEED;

View File

@ -544,6 +544,7 @@ static void mxs_mci_info(struct device_d *hw_dev)
static int mxs_mci_probe(struct device_d *hw_dev)
{
struct resource *iores;
struct mxs_mci_platform_data *pd = hw_dev->platform_data;
struct mxs_mci_host *mxs_mci;
struct mci_host *host;
@ -557,9 +558,10 @@ static int mxs_mci_probe(struct device_d *hw_dev)
host->send_cmd = mxs_mci_request;
host->set_ios = mxs_mci_set_ios;
host->init = mxs_mci_initialize;
mxs_mci->regs = dev_request_mem_region(hw_dev, 0);
if (IS_ERR(mxs_mci->regs))
return PTR_ERR(mxs_mci->regs);
iores = dev_request_mem_resource(hw_dev, 0);
if (IS_ERR(iores))
return PTR_ERR(iores);
mxs_mci->regs = IOMEM(iores->start);
/* feed forward the platform specific values */
if (pd) {

View File

@ -584,6 +584,7 @@ static int omap_mmc_detect(struct device_d *dev)
static int omap_mmc_probe(struct device_d *dev)
{
struct resource *iores;
struct omap_hsmmc *hsmmc;
struct omap_hsmmc_platform_data *pdata;
struct omap_mmc_driver_data *drvdata;
@ -604,9 +605,10 @@ static int omap_mmc_probe(struct device_d *dev)
MMC_CAP_MMC_HIGHSPEED | MMC_CAP_8_BIT_DATA;
hsmmc->mci.hw_dev = dev;
hsmmc->iobase = dev_request_mem_region(dev, 0);
if (IS_ERR(hsmmc->iobase))
return PTR_ERR(hsmmc->iobase);
iores = dev_request_mem_resource(dev, 0);
if (IS_ERR(iores))
return PTR_ERR(iores);
hsmmc->iobase = IOMEM(iores->start);
hsmmc->base = hsmmc->iobase + reg_ofs;
hsmmc->mci.voltages = MMC_VDD_32_33 | MMC_VDD_33_34;

View File

@ -334,14 +334,16 @@ static int pxamci_init(struct mci_host *mci, struct device_d *dev)
static int pxamci_probe(struct device_d *dev)
{
struct resource *iores;
struct pxamci_host *host;
int gpio_power = -1;
clk_enable();
host = xzalloc(sizeof(*host));
host->base = dev_request_mem_region(dev, 0);
if (IS_ERR(host->base))
return PTR_ERR(host->base);
iores = dev_request_mem_resource(dev, 0);
if (IS_ERR(iores))
return PTR_ERR(iores);
host->base = IOMEM(iores->start);
host->mci.init = pxamci_init;
host->mci.send_cmd = pxamci_request;

View File

@ -723,6 +723,7 @@ static void s3c_info(struct device_d *hw_dev)
static int s3c_mci_probe(struct device_d *hw_dev)
{
struct resource *iores;
struct s3c_mci_host *s3c_host;
struct s3c_mci_platform_data *pd = hw_dev->platform_data;
@ -741,9 +742,10 @@ static int s3c_mci_probe(struct device_d *hw_dev)
}
hw_dev->priv = s3c_host;
s3c_host->base = dev_request_mem_region(hw_dev, 0);
if (IS_ERR(s3c_host->base))
return PTR_ERR(s3c_host->base);
iores = dev_request_mem_resource(hw_dev, 0);
if (IS_ERR(iores))
return PTR_ERR(iores);
s3c_host->base = IOMEM(iores->start);
s3c_host->host.hw_dev = hw_dev;

View File

@ -422,6 +422,7 @@ static void tegra_sdmmc_parse_dt(struct tegra_sdmmc_host *host)
static int tegra_sdmmc_probe(struct device_d *dev)
{
struct resource *iores;
struct tegra_sdmmc_host *host;
struct mci_host *mci;
int ret;
@ -437,11 +438,12 @@ static int tegra_sdmmc_probe(struct device_d *dev)
if (IS_ERR(host->reset))
return PTR_ERR(host->reset);
host->regs = dev_request_mem_region(dev, 0);
if (IS_ERR(host->regs)) {
iores = dev_request_mem_resource(dev, 0);
if (IS_ERR(iores)) {
dev_err(dev, "could not get iomem region\n");
return PTR_ERR(host->regs);
return PTR_ERR(iores);
}
host->regs = IOMEM(iores->start);
mci->hw_dev = dev;
mci->f_max = 48000000;

View File

@ -34,14 +34,16 @@ static struct file_operations memops = {
static int sram_probe(struct device_d *dev)
{
struct resource *iores;
struct sram *sram;
struct resource *res;
void __iomem *base;
int ret;
base = dev_request_mem_region(dev, 0);
if (IS_ERR(base))
return PTR_ERR(base);
iores = dev_request_mem_resource(dev, 0);
if (IS_ERR(iores))
return PTR_ERR(iores);
base = IOMEM(iores->start);
sram = xzalloc(sizeof(*sram));

View File

@ -1146,11 +1146,15 @@ nomem1:
static int __init docg3_probe(struct device_d *dev)
{
struct resource *iores;
struct mtd_info *mtd;
void __iomem *base;
int ret, floor, found = 0;
base = dev_request_mem_region(dev, 0);
iores = dev_request_mem_resource(dev, 0);
if (IS_ERR(iores))
return PTR_ERR(iores);
base = IOMEM(iores->start);
ret = -ENOMEM;
docg3_bch = init_bch(DOC_ECC_BCH_M, DOC_ECC_BCH_T,

View File

@ -49,6 +49,7 @@ static int ram_read(struct mtd_info *mtd, loff_t from, size_t len, size_t *retle
static int mtdram_probe(struct device_d *dev)
{
struct resource *iores;
void __iomem *base;
int device_id;
struct mtd_info *mtd;
@ -70,11 +71,12 @@ static int mtdram_probe(struct device_d *dev)
mtd->name = "mtdram";
}
base = dev_request_mem_region(dev, 0);
if (IS_ERR(base)) {
ret = PTR_ERR(base);
iores = dev_request_mem_resource(dev, 0);
if (IS_ERR(iores)) {
ret = PTR_ERR(iores);
goto nobase;
}
base = IOMEM(iores->start);
res = dev_get_resource(dev, IORESOURCE_MEM, 0);
size = (unsigned long) resource_size(res);

View File

@ -862,6 +862,7 @@ static int pmecc_build_galois_table(unsigned int mm, int16_t *index_of,
static int __init atmel_pmecc_nand_init_params(struct device_d *dev,
struct atmel_nand_host *host)
{
struct resource *iores;
struct mtd_info *mtd = &host->mtd;
struct nand_chip *nand_chip = &host->nand_chip;
int cap, sector_size, err_no;
@ -872,20 +873,27 @@ static int __init atmel_pmecc_nand_init_params(struct device_d *dev,
dev_info(host->dev, "Initialize PMECC params, cap: %d, sector: %d\n",
cap, sector_size);
host->ecc = dev_request_mem_region(dev, 1);
iores = dev_request_mem_resource(dev, 1);
if (IS_ERR(iores))
return PTR_ERR(iores);
host->ecc = IOMEM(iores->start);
if (IS_ERR(host->ecc)) {
dev_err(host->dev, "ioremap failed\n");
return -EIO;
}
host->pmerrloc_base = dev_request_mem_region(dev, 2);
if (IS_ERR(host->pmerrloc_base)) {
iores = dev_request_mem_resource(dev, 2);
if (IS_ERR(iores)) {
dev_err(host->dev,
"Can not get I/O resource for PMECC ERRLOC controller!\n");
return PTR_ERR(host->pmerrloc_base);
return PTR_ERR(iores);
}
host->pmerrloc_base = IOMEM(iores->start);
host->pmecc_rom_base = dev_request_mem_region(dev, 3);
iores = dev_request_mem_resource(dev, 3);
if (IS_ERR(iores))
return PTR_ERR(iores);
host->pmecc_rom_base = IOMEM(iores->start);
if (IS_ERR(host->pmecc_rom_base)) {
/* Set pmecc_rom_base as the begin of gf table */
int size = sector_size == 512 ? 0x2000 : 0x4000;
@ -1245,10 +1253,14 @@ static int atmel_nand_of_init(struct atmel_nand_host *host, struct device_node *
static int atmel_hw_nand_init_params(struct device_d *dev,
struct atmel_nand_host *host)
{
struct resource *iores;
struct mtd_info *mtd = &host->mtd;
struct nand_chip *nand_chip = &host->nand_chip;
host->ecc = dev_request_mem_region(dev, 1);
iores = dev_request_mem_resource(dev, 1);
if (IS_ERR(iores))
return PTR_ERR(iores);
host->ecc = IOMEM(iores->start);
if (IS_ERR(host->ecc)) {
dev_err(host->dev, "ioremap failed\n");
return -EIO;
@ -1297,6 +1309,7 @@ static int atmel_hw_nand_init_params(struct device_d *dev,
*/
static int __init atmel_nand_probe(struct device_d *dev)
{
struct resource *iores;
struct atmel_nand_data *pdata = NULL;
struct atmel_nand_host *host;
struct mtd_info *mtd;
@ -1312,9 +1325,10 @@ static int __init atmel_nand_probe(struct device_d *dev)
if (!pdata)
return -ENOMEM;
host->io_base = dev_request_mem_region(dev, 0);
if (IS_ERR(host->io_base))
return PTR_ERR(host->io_base);
iores = dev_request_mem_resource(dev, 0);
if (IS_ERR(iores))
return PTR_ERR(iores);
host->io_base = IOMEM(iores->start);
mtd = &host->mtd;
nand_chip = &host->nand_chip;

View File

@ -36,6 +36,7 @@ struct denali_dt {
static int denali_dt_probe(struct device_d *ofdev)
{
struct resource *iores;
struct denali_dt *dt;
struct denali_nand_info *denali;
int ret;
@ -51,12 +52,15 @@ static int denali_dt_probe(struct device_d *ofdev)
denali->platform = DT;
denali->dev = ofdev;
denali->flash_mem = dev_request_mem_region(ofdev, 0);
if (IS_ERR(denali->flash_mem))
return PTR_ERR(denali->flash_mem);
denali->flash_reg = dev_request_mem_region(ofdev, 1);
if (IS_ERR(denali->flash_reg))
return PTR_ERR(denali->flash_reg);
iores = dev_request_mem_resource(ofdev, 0);
if (IS_ERR(iores))
return PTR_ERR(iores);
denali->flash_mem = IOMEM(iores->start);
iores = dev_request_mem_resource(ofdev, 1);
if (IS_ERR(iores))
return PTR_ERR(iores);
denali->flash_reg = IOMEM(iores->start);
dt->clk = clk_get(ofdev, NULL);
if (IS_ERR(dt->clk)) {

View File

@ -1105,6 +1105,7 @@ static int __init mxcnd_probe_dt(struct imx_nand_host *host)
static int __init imxnd_probe(struct device_d *dev)
{
struct resource *iores;
struct nand_chip *this;
struct mtd_info *mtd;
struct imx_nand_host *host;
@ -1146,7 +1147,10 @@ static int __init imxnd_probe(struct device_d *dev)
}
if (nfc_is_v21()) {
host->base = dev_request_mem_region(dev, 0);
iores = dev_request_mem_resource(dev, 0);
if (IS_ERR(iores))
return PTR_ERR(iores);
host->base = IOMEM(iores->start);
host->main_area0 = host->base;
host->regs = host->base + 0x1e00;
host->spare0 = host->base + 0x1000;
@ -1155,7 +1159,10 @@ static int __init imxnd_probe(struct device_d *dev)
oob_largepage = &nandv2_hw_eccoob_largepage;
oob_4kpage = &nandv2_hw_eccoob_4k; /* FIXME : to check */
} else if (nfc_is_v1()) {
host->base = dev_request_mem_region(dev, 0);
iores = dev_request_mem_resource(dev, 0);
if (IS_ERR(iores))
return PTR_ERR(iores);
host->base = IOMEM(iores->start);
host->main_area0 = host->base;
host->regs = host->base + 0xe00;
host->spare0 = host->base + 0x800;
@ -1164,8 +1171,15 @@ static int __init imxnd_probe(struct device_d *dev)
oob_largepage = &nandv1_hw_eccoob_largepage;
oob_4kpage = &nandv1_hw_eccoob_smallpage; /* FIXME : to check */
} else if (nfc_is_v3_2()) {
host->regs_ip = dev_request_mem_region(dev, 0);
host->base = dev_request_mem_region(dev, 1);
iores = dev_request_mem_resource(dev, 0);
if (IS_ERR(iores))
return PTR_ERR(iores);
host->regs_ip = IOMEM(iores->start);
iores = dev_request_mem_resource(dev, 1);
if (IS_ERR(iores))
return PTR_ERR(iores);
host->base = IOMEM(iores->start);
host->main_area0 = host->base;
if (IS_ERR(host->regs_ip)) {

View File

@ -1105,6 +1105,7 @@ static int mrvl_nand_scan(struct mtd_info *mtd)
static struct mrvl_nand_host *alloc_nand_resource(struct device_d *dev)
{
struct resource *iores;
struct mrvl_nand_platform_data *pdata;
struct mrvl_nand_host *host;
struct nand_chip *chip = NULL;
@ -1135,7 +1136,10 @@ static struct mrvl_nand_host *alloc_nand_resource(struct device_d *dev)
chip->chip_delay = CHIP_DELAY_TIMEOUT_US;
host->dev = dev;
host->mmio_base = dev_request_mem_region(dev, 0);
iores = dev_request_mem_resource(dev, 0);
if (IS_ERR(iores))
return PTR_ERR(iores);
host->mmio_base = IOMEM(iores->start);
if (IS_ERR(host->mmio_base)) {
free(host);
return host->mmio_base;

View File

@ -1274,6 +1274,7 @@ static void mxs_nand_probe_dt(struct device_d *dev, struct mxs_nand_info *nand_i
static int mxs_nand_probe(struct device_d *dev)
{
struct resource *iores;
struct mxs_nand_info *nand_info;
struct nand_chip *nand;
struct mtd_info *mtd;
@ -1293,13 +1294,15 @@ static int mxs_nand_probe(struct device_d *dev)
mxs_nand_probe_dt(dev, nand_info);
nand_info->type = type;
nand_info->io_base = dev_request_mem_region(dev, 0);
if (IS_ERR(nand_info->io_base))
return PTR_ERR(nand_info->io_base);
iores = dev_request_mem_resource(dev, 0);
if (IS_ERR(iores))
return PTR_ERR(iores);
nand_info->io_base = IOMEM(iores->start);
nand_info->bch_base = dev_request_mem_region(dev, 1);
if (IS_ERR(nand_info->bch_base))
return PTR_ERR(nand_info->bch_base);
iores = dev_request_mem_resource(dev, 1);
if (IS_ERR(iores))
return PTR_ERR(iores);
nand_info->bch_base = IOMEM(iores->start);
nand_info->clk = clk_get(dev, NULL);
if (IS_ERR(nand_info->clk))

View File

@ -846,6 +846,7 @@ static int gpmc_set_buswidth(struct nand_chip *chip, int buswidth)
*/
static int gpmc_nand_probe(struct device_d *pdev)
{
struct resource *iores;
struct gpmc_nand_info *oinfo;
struct gpmc_nand_platform_data *pdata;
struct nand_chip *nand;
@ -881,7 +882,10 @@ static int gpmc_nand_probe(struct device_d *pdev)
}
/* Setup register specific data */
oinfo->gpmc_cs = pdata->cs;
oinfo->gpmc_base = dev_request_mem_region(pdev, 0);
iores = dev_request_mem_resource(pdev, 0);
if (IS_ERR(iores))
return PTR_ERR(iores);
oinfo->gpmc_base = IOMEM(iores->start);
cs_base = oinfo->gpmc_base + GPMC_CONFIG1_0 +
(pdata->cs * GPMC_CONFIG_CS_SIZE);
oinfo->gpmc_command = (void *)(cs_base + GPMC_CS_NAND_COMMAND);

View File

@ -80,6 +80,7 @@ static void orion_nand_read_buf(struct mtd_info *mtd, uint8_t *buf, int len)
static int orion_nand_probe(struct device_d *dev)
{
struct resource *iores;
struct device_node *dev_node = dev->device_node;
struct orion_nand *priv;
struct mtd_info *mtd;
@ -93,9 +94,10 @@ static int orion_nand_probe(struct device_d *dev)
mtd = &priv->mtd;
chip = &priv->chip;
io_base = dev_request_mem_region(dev, 0);
if (IS_ERR(io_base))
return PTR_ERR(io_base);
iores = dev_request_mem_resource(dev, 0);
if (IS_ERR(iores))
return PTR_ERR(iores);
io_base = IOMEM(iores->start);
if (!of_property_read_u32(dev_node, "cle", &val))
priv->cle = (u8)val;

View File

@ -408,6 +408,7 @@ static int s3c24x0_nand_inithw(struct s3c24x0_nand_host *host)
static int s3c24x0_nand_probe(struct device_d *dev)
{
struct resource *iores;
struct nand_chip *chip;
struct s3c24x0_nand_platform_data *pdata = dev->platform_data;
struct mtd_info *mtd;
@ -420,7 +421,10 @@ static int s3c24x0_nand_probe(struct device_d *dev)
return -ENOMEM;
host->dev = dev;
host->base = dev_request_mem_region(dev, 0);
iores = dev_request_mem_resource(dev, 0);
if (IS_ERR(iores))
return PTR_ERR(iores);
host->base = IOMEM(iores->start);
/* structures must be linked */
chip = &host->nand;

View File

@ -966,13 +966,15 @@ static void cfi_init_mtd(struct flash_info *info)
static int cfi_probe_one(struct flash_info *info, int num)
{
struct resource *iores;
int ret;
info->flash_id = FLASH_UNKNOWN;
info->cmd_reset = FLASH_CMD_RESET;
info->base = dev_request_mem_region(info->dev, num);
if (IS_ERR(info->base))
return PTR_ERR(info->base);
iores = dev_request_mem_resource(info->dev, num);
if (IS_ERR(iores))
return PTR_ERR(iores);
info->base = IOMEM(iores->start);
ret = flash_detect_size(info);
if (ret) {

View File

@ -1109,6 +1109,7 @@ static void cqspi_controller_init(struct cqspi_st *cqspi)
static int cqspi_probe(struct device_d *dev)
{
struct resource *iores;
struct device_node *np = dev->device_node;
struct cqspi_st *cqspi;
struct cadence_qspi_platform_data *pdata = dev->platform_data;
@ -1142,14 +1143,20 @@ static int cqspi_probe(struct device_d *dev)
clk_enable(cqspi->qspi_clk);
cqspi->iobase = dev_request_mem_region(dev, 0);
iores = dev_request_mem_resource(dev, 0);
if (IS_ERR(iores))
return PTR_ERR(iores);
cqspi->iobase = IOMEM(iores->start);
if (IS_ERR(cqspi->iobase)) {
dev_err(dev, "dev_request_mem_region 0 failed\n");
ret = PTR_ERR(cqspi->iobase);
goto probe_failed;
}
cqspi->ahb_base = dev_request_mem_region(dev, 1);
iores = dev_request_mem_resource(dev, 1);
if (IS_ERR(iores))
return PTR_ERR(iores);
cqspi->ahb_base = IOMEM(iores->start);
if (IS_ERR(cqspi->ahb_base)) {
dev_err(dev, "dev_request_mem_region 0 failed\n");
ret = PTR_ERR(cqspi->ahb_base);

View File

@ -492,6 +492,7 @@ static int tse_init_dev(struct eth_device *edev)
static int tse_probe(struct device_d *dev)
{
struct resource *iores;
struct altera_tse_priv *priv;
struct mii_bus *miibus;
struct eth_device *edev;
@ -516,9 +517,10 @@ static int tse_probe(struct device_d *dev)
edev->parent = dev;
#ifdef CONFIG_TSE_USE_DEDICATED_DESC_MEM
tx_desc = dev_request_mem_region(dev, 3);
if (IS_ERR(tx_desc))
return PTR_ERR(tx_desc);
iores = dev_request_mem_resource(dev, 3);
if (IS_ERR(iores))
return PTR_ERR(iores);
tx_desc = IOMEM(iores->start);
rx_desc = tx_desc + 2;
#else
tx_desc = dma_alloc_coherent(sizeof(*tx_desc) * (3 + PKTBUFSRX), (dma_addr_t *)&dma_handle);
@ -534,15 +536,19 @@ static int tse_probe(struct device_d *dev)
memset(rx_desc, 0, (sizeof *rx_desc) * (PKTBUFSRX + 1));
memset(tx_desc, 0, (sizeof *tx_desc) * 2);
priv->tse_regs = dev_request_mem_region(dev, 0);
if (IS_ERR(priv->tse_regs))
return PTR_ERR(priv->tse_regs);
priv->sgdma_rx_regs = dev_request_mem_region(dev, 1);
if (IS_ERR(priv->sgdma_rx_regs))
return PTR_ERR(priv->sgdma_rx_regs);
priv->sgdma_tx_regs = dev_request_mem_region(dev, 2);
if (IS_ERR(priv->sgdma_tx_regs))
return PTR_ERR(priv->sgdma_tx_regs);
iores = dev_request_mem_resource(dev, 0);
if (IS_ERR(iores))
return PTR_ERR(iores);
priv->tse_regs = IOMEM(iores->start);
iores = dev_request_mem_resource(dev, 1);
if (IS_ERR(iores))
return PTR_ERR(iores);
priv->sgdma_rx_regs = IOMEM(iores->start);
iores = dev_request_mem_resource(dev, 2);
if (IS_ERR(iores))
return PTR_ERR(iores);
priv->sgdma_tx_regs = IOMEM(iores->start);
priv->rx_desc = rx_desc;
priv->tx_desc = tx_desc;

View File

@ -363,6 +363,7 @@ static int ar231x_mdiibus_reset(struct mii_bus *bus)
static int ar231x_eth_probe(struct device_d *dev)
{
struct resource *iores;
struct ar231x_eth_priv *priv;
struct eth_device *edev;
struct mii_bus *miibus;
@ -384,20 +385,22 @@ static int ar231x_eth_probe(struct device_d *dev)
priv->mac = pdata->mac;
priv->reset_bit = pdata->reset_bit;
priv->eth_regs = dev_request_mem_region(dev, 0);
if (IS_ERR(priv->eth_regs)) {
iores = dev_request_mem_resource(dev, 0);
if (IS_ERR(iores)) {
dev_err(dev, "No eth_regs!!\n");
return PTR_ERR(priv->eth_regs);
return PTR_ERR(iores);
}
priv->eth_regs = IOMEM(iores->start);
/* we have 0x100000 for eth, part of it are dma regs.
* So they are already requested */
priv->dma_regs = (void *)(priv->eth_regs + 0x1000);
priv->phy_regs = dev_request_mem_region(dev, 1);
if (IS_ERR(priv->phy_regs)) {
iores = dev_request_mem_resource(dev, 1);
if (IS_ERR(iores)) {
dev_err(dev, "No phy_regs!!\n");
return PTR_ERR(priv->phy_regs);
return PTR_ERR(iores);
}
priv->phy_regs = IOMEM(iores->start);
priv->cfg = pdata;
edev->init = ar231x_eth_init;

View File

@ -391,6 +391,7 @@ static int arc_emac_mdio_write(struct mii_bus *bus, int phy_addr, int reg_num,
static int arc_emac_probe(struct device_d *dev)
{
struct resource *iores;
struct eth_device *edev;
struct arc_emac_priv *priv;
unsigned long clock_frequency;
@ -406,9 +407,10 @@ static int arc_emac_probe(struct device_d *dev)
miibus = xzalloc(sizeof(struct mii_bus));
priv = edev->priv;
priv->regs = dev_request_mem_region(dev, 0);
if (IS_ERR(priv->regs))
return PTR_ERR(priv->regs);
iores = dev_request_mem_resource(dev, 0);
if (IS_ERR(iores))
return PTR_ERR(iores);
priv->regs = IOMEM(iores->start);
priv->bus = miibus;
priv->clk = clk_get(dev, "hclk");

View File

@ -1126,6 +1126,7 @@ static int cpsw_probe_dt(struct cpsw_priv *priv)
int cpsw_probe(struct device_d *dev)
{
struct resource *iores;
struct cpsw_platform_data *data = (struct cpsw_platform_data *)dev->platform_data;
struct cpsw_priv *priv;
void __iomem *regs;
@ -1136,9 +1137,10 @@ int cpsw_probe(struct device_d *dev)
dev_dbg(dev, "* %s\n", __func__);
regs = dev_request_mem_region(dev, 0);
if (IS_ERR(regs))
return PTR_ERR(regs);
iores = dev_request_mem_resource(dev, 0);
if (IS_ERR(iores))
return PTR_ERR(iores);
regs = IOMEM(iores->start);
priv = xzalloc(sizeof(*priv));
priv->dev = dev;

View File

@ -435,13 +435,17 @@ static int cs8900_check_id(struct cs8900_priv *priv)
static int cs8900_probe(struct device_d *dev)
{
struct resource *iores;
struct eth_device *edev;
struct cs8900_priv *priv;
debug("cs8900_init()\n");
priv = (struct cs8900_priv *)xmalloc(sizeof(*priv));
priv->regs = dev_request_mem_region(dev, 0);
iores = dev_request_mem_resource(dev, 0);
if (IS_ERR(iores))
return PTR_ERR(iores);
priv->regs = IOMEM(iores->start);
if (cs8900_check_id(priv)) {
free(priv);
return -1;

View File

@ -516,6 +516,7 @@ out:
static int davinci_emac_probe(struct device_d *dev)
{
struct resource *iores;
struct davinci_emac_platform_data *pdata;
struct davinci_emac_priv *priv;
uint64_t start;
@ -534,10 +535,25 @@ static int davinci_emac_probe(struct device_d *dev)
priv->dev = dev;
priv->adap_emac = dev_request_mem_region(dev, 0);
priv->adap_ewrap = dev_request_mem_region(dev, 1);
priv->adap_mdio = dev_request_mem_region(dev, 2);
priv->emac_desc_base = dev_request_mem_region(dev, 3);
iores = dev_request_mem_resource(dev, 0);
if (IS_ERR(iores))
return PTR_ERR(iores);
priv->adap_emac = IOMEM(iores->start);
iores = dev_request_mem_resource(dev, 1);
if (IS_ERR(iores))
return PTR_ERR(iores);
priv->adap_ewrap = IOMEM(iores->start);
iores = dev_request_mem_resource(dev, 2);
if (IS_ERR(iores))
return PTR_ERR(iores);
priv->adap_mdio = IOMEM(iores->start);
iores = dev_request_mem_resource(dev, 3);
if (IS_ERR(iores))
return PTR_ERR(iores);
priv->emac_desc_base = IOMEM(iores->start);
/* EMAC descriptors */
priv->emac_rx_desc = priv->emac_desc_base + EMAC_RX_DESC_BASE;

View File

@ -445,6 +445,7 @@ static int dwc_probe_dt(struct device_d *dev, struct dw_eth_dev *priv)
static int dwc_ether_probe(struct device_d *dev)
{
struct resource *iores;
struct dw_eth_dev *priv;
struct eth_device *edev;
struct mii_bus *miibus;
@ -471,9 +472,10 @@ static int dwc_ether_probe(struct device_d *dev)
return ret;
}
base = dev_request_mem_region(dev, 0);
if (IS_ERR(base))
return PTR_ERR(base);
iores = dev_request_mem_resource(dev, 0);
if (IS_ERR(iores))
return PTR_ERR(iores);
base = IOMEM(iores->start);
priv->mac_regs_p = base;
dwc_version(dev, readl(&priv->mac_regs_p->version));

View File

@ -785,6 +785,7 @@ static int dm9000_parse_pdata(struct device_d *dev, struct dm9k *priv)
static int dm9k_probe(struct device_d *dev)
{
struct resource *iores;
unsigned io_mode;
struct eth_device *edev;
struct dm9k *priv;
@ -808,17 +809,19 @@ static int dm9k_probe(struct device_d *dev)
if (ret)
goto err;
priv->iodata = dev_request_mem_region(dev, 1);
if (IS_ERR(priv->iodata)) {
ret = PTR_ERR(priv->iodata);
iores = dev_request_mem_resource(dev, 1);
if (IS_ERR(iores)) {
ret = PTR_ERR(iores);
goto err;
}
priv->iodata = IOMEM(iores->start);
priv->iobase = dev_request_mem_region(dev, 0);
if (IS_ERR(priv->iobase)) {
ret = PTR_ERR(priv->iobase);
iores = dev_request_mem_resource(dev, 0);
if (IS_ERR(iores)) {
ret = PTR_ERR(iores);
goto err;
}
priv->iobase = IOMEM(iores->start);
edev->init = dm9k_init_dev;
edev->open = dm9k_eth_open;

View File

@ -534,6 +534,7 @@ static int ethoc_mdio_write(struct mii_bus *bus, int phy, int reg, u16 val)
static int ethoc_probe(struct device_d *dev)
{
struct resource *iores;
struct eth_device *edev;
struct ethoc *priv;
@ -542,9 +543,10 @@ static int ethoc_probe(struct device_d *dev)
edev->priv = (struct ethoc *)(edev + 1);
priv = edev->priv;
priv->iobase = dev_request_mem_region(dev, 0);
if (IS_ERR(priv->iobase))
return PTR_ERR(priv->iobase);
iores = dev_request_mem_resource(dev, 0);
if (IS_ERR(iores))
return PTR_ERR(iores);
priv->iobase = IOMEM(iores->start);
priv->miibus.read = ethoc_mdio_read;
priv->miibus.write = ethoc_mdio_write;

View File

@ -647,6 +647,7 @@ static int fec_probe_dt(struct device_d *dev, struct fec_priv *fec)
#endif
static int fec_probe(struct device_d *dev)
{
struct resource *iores;
struct fec_platform_data *pdata = (struct fec_platform_data *)dev->platform_data;
struct eth_device *edev;
struct fec_priv *fec;
@ -681,7 +682,10 @@ static int fec_probe(struct device_d *dev)
clk_enable(fec->clk);
fec->regs = dev_request_mem_region(dev, 0);
iores = dev_request_mem_resource(dev, 0);
if (IS_ERR(iores))
return PTR_ERR(iores);
fec->regs = IOMEM(iores->start);
phy_reset = of_get_named_gpio(dev->device_node, "phy-reset-gpios", 0);
if (gpio_is_valid(phy_reset)) {

View File

@ -638,6 +638,7 @@ static int mpc5xxx_fec_recv(struct eth_device *dev)
int mpc5xxx_fec_probe(struct device_d *dev)
{
struct resource *iores;
struct fec_platform_data *pdata = dev->platform_data;
struct eth_device *edev;
mpc5xxx_fec_priv *fec;
@ -655,9 +656,10 @@ int mpc5xxx_fec_probe(struct device_d *dev)
edev->set_ethaddr = mpc5xxx_fec_set_ethaddr;
edev->parent = dev;
fec->eth = dev_request_mem_region(dev, 0);
if (IS_ERR(fec->eth))
return PTR_ERR(fec->eth);
iores = dev_request_mem_resource(dev, 0);
if (IS_ERR(iores))
return PTR_ERR(iores);
fec->eth = IOMEM(iores->start);
fec->tbdBase = (FEC_TBD *)FEC_BD_BASE;
fec->rbdBase = (FEC_RBD *)(FEC_BD_BASE + FEC_TBD_NUM * sizeof(FEC_TBD));

View File

@ -809,6 +809,7 @@ static void ks8851_eth_halt(struct eth_device *edev)
static int ks8851_probe(struct device_d *dev)
{
struct resource *iores;
struct eth_device *edev;
struct ks_net *ks;
u16 id;
@ -823,13 +824,16 @@ static int ks8851_probe(struct device_d *dev)
return -ENODEV;
}
ks->hw_addr = dev_request_mem_region(dev, 0);
if (IS_ERR(ks->hw_addr))
return PTR_ERR(ks->hw_addr);
iores = dev_request_mem_resource(dev, 0);
if (IS_ERR(iores))
return PTR_ERR(iores);
ks->hw_addr = IOMEM(iores->start);
iores = dev_request_mem_resource(dev, 1);
if (IS_ERR(iores))
return PTR_ERR(iores);
ks->hw_addr_cmd = IOMEM(iores->start);
ks->hw_addr_cmd = dev_request_mem_region(dev, 1);
if (IS_ERR(ks->hw_addr_cmd))
return PTR_ERR(ks->hw_addr_cmd);
ks->bus_width = dev->resource[0].flags & IORESOURCE_MEM_TYPE_MASK;
edev->init = ks8851_init_dev;

View File

@ -612,6 +612,7 @@ static void macb_init_rx_buffer_size(struct macb_device *bp, size_t size)
static int macb_probe(struct device_d *dev)
{
struct resource *iores;
struct eth_device *edev;
struct macb_device *macb;
u32 ncfgr;
@ -649,9 +650,10 @@ static int macb_probe(struct device_d *dev)
macb->phy_flags = pdata->phy_flags;
macb->regs = dev_request_mem_region(dev, 0);
if (IS_ERR(macb->regs))
return PTR_ERR(macb->regs);
iores = dev_request_mem_resource(dev, 0);
if (IS_ERR(iores))
return PTR_ERR(iores);
macb->regs = IOMEM(iores->start);
/*
* Do some basic initialization so that we at least can talk

View File

@ -1444,6 +1444,7 @@ static int smc91c111_init_dev(struct eth_device *edev)
static int smc91c111_probe(struct device_d *dev)
{
struct resource *iores;
struct eth_device *edev;
struct smc91c111_priv *priv;
@ -1481,9 +1482,10 @@ static int smc91c111_probe(struct device_d *dev)
priv->miibus.write = smc91c111_phy_write;
priv->miibus.priv = priv;
priv->miibus.parent = dev;
priv->base = dev_request_mem_region(dev, 0);
if (IS_ERR(priv->base))
return PTR_ERR(priv->base);
iores = dev_request_mem_resource(dev, 0);
if (IS_ERR(iores))
return PTR_ERR(iores);
priv->base = IOMEM(iores->start);
smc91c111_reset(edev);

Some files were not shown because too many files have changed in this diff Show More