diff options
author | Marc Kleine-Budde <mkl@pengutronix.de> | 2015-03-03 13:14:55 +0100 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2015-03-06 07:42:22 +0100 |
commit | 2f56f4d0507a8e7546d77d3d890a6cbf1e71ed61 (patch) | |
tree | af60e2390f81faec95cf280db5334312f547b535 /arch/sandbox/board | |
parent | d1490797af04e220d8a4abb687935d699786be94 (diff) | |
download | barebox-2f56f4d0507a8e7546d77d3d890a6cbf1e71ed61.tar.gz barebox-2f56f4d0507a8e7546d77d3d890a6cbf1e71ed61.tar.xz |
sandbox: hostfile: use the memory resource to determine the size not the platform_data
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'arch/sandbox/board')
-rw-r--r-- | arch/sandbox/board/hostfile.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/arch/sandbox/board/hostfile.c b/arch/sandbox/board/hostfile.c index 42ade6bec8..3e6435983b 100644 --- a/arch/sandbox/board/hostfile.c +++ b/arch/sandbox/board/hostfile.c @@ -23,6 +23,7 @@ #include <mach/linux.h> #include <init.h> #include <errno.h> +#include <linux/err.h> #include <mach/hostfile.h> #include <xfuncs.h> @@ -70,10 +71,15 @@ static int hf_probe(struct device_d *dev) { struct hf_platform_data *hf = dev->platform_data; struct hf_priv *priv = xzalloc(sizeof(*priv)); + struct resource *res; + + res = dev_get_resource(dev, IORESOURCE_MEM, 0); + if (IS_ERR(res)) + return PTR_ERR(res); priv->fd = hf->fd; priv->cdev.name = hf->devname; - priv->cdev.size = hf->size; + priv->cdev.size = resource_size(res); priv->cdev.dev = dev; priv->cdev.ops = &hf_fops; priv->cdev.priv = priv; |