Re: [PATCH 6/10] HDQ driver: use ioremap for HDQ base

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Sep 25, 2008 at 12:26:17PM +0530, ext Gadiyar, Anand wrote:
> From: Madhusudhan Chikkature <madhu.cr@xxxxxx>
> 
> This patch provides the ioremap related changes to the driver.
> 
> Signed-off-by: Madhusudhan Chikkature <madhu.cr@xxxxxx>
Acked-by: Felipe Balbi <felipe.balbi@xxxxxxxxx>
> ---
>  drivers/w1/masters/omap_hdq.c |   21 ++++++++++++++-------
>  1 files changed, 14 insertions(+), 7 deletions(-)
> 
> Index: linux-omap-2.6/drivers/w1/masters/omap_hdq.c
> ===================================================================
> --- linux-omap-2.6.orig/drivers/w1/masters/omap_hdq.c	2008-09-24 10:46:53.000000000 +0530
> +++ linux-omap-2.6/drivers/w1/masters/omap_hdq.c	2008-09-24 11:13:12.000000000 +0530
> @@ -54,7 +54,7 @@ static int w1_id;
>  
>  struct hdq_data {
>  	struct device		*dev;
> -	resource_size_t		hdq_base;
> +	void __iomem		*hdq_base;
>  	struct	semaphore	hdq_semlock;
>  	int			hdq_usecount;
>  	struct	clk		*hdq_ick;
> @@ -99,12 +99,12 @@ static struct w1_bus_master omap_w1_mast
>   */
>  static inline u8 hdq_reg_in(struct hdq_data *hdq_data, u32 offset)
>  {
> -	return omap_readb(hdq_data->hdq_base + offset);
> +	return __raw_readb(hdq_data->hdq_base + offset);
>  }
>  
>  static inline u8 hdq_reg_out(struct hdq_data *hdq_data, u32 offset, u8 val)
>  {
> -	omap_writeb(val, hdq_data->hdq_base + offset);
> +	__raw_writeb(val, hdq_data->hdq_base + offset);
>  
>  	return val;
>  }
> @@ -112,9 +112,9 @@ static inline u8 hdq_reg_out(struct hdq_
>  static inline u8 hdq_reg_merge(struct hdq_data *hdq_data, u32 offset,
>  			u8 val, u8 mask)
>  {
> -	u8 new_val = (omap_readb(hdq_data->hdq_base + offset) & ~mask)
> +	u8 new_val = (__raw_readb(hdq_data->hdq_base + offset) & ~mask)
>  			| (val & mask);
> -	omap_writeb(new_val, hdq_data->hdq_base + offset);
> +	__raw_writeb(new_val, hdq_data->hdq_base + offset);
>  
>  	return new_val;
>  }
> @@ -589,7 +589,12 @@ static int __init omap_hdq_probe(struct 
>  		goto err_resource;
>  	}
>  
> -	hdq_data->hdq_base = res->start;
> +	hdq_data->hdq_base = ioremap(res->start, SZ_4K);
> +	if (!hdq_data->hdq_base) {
> +		dev_dbg(&pdev->dev, "ioremap failed\n");
> +		ret = -EINVAL;
> +		goto err_ioremap;
> +	}
>  
>  	/* get interface & functional clock objects */
>  	hdq_data->hdq_ick = clk_get(&pdev->dev, "hdq_ick");
> @@ -668,8 +673,9 @@ err_ick:
>  	clk_put(hdq_data->hdq_fck);
>  
>  err_clk:
> -	hdq_data->hdq_base = NULL;
> +	iounmap(hdq_data->hdq_base);
>  
> +err_ioremap:
>  err_resource:
>  	platform_set_drvdata(pdev, NULL);
>  	kfree(hdq_data);
> @@ -695,6 +701,7 @@ static int omap_hdq_remove(struct platfo
>  	clk_put(hdq_data->hdq_fck);
>  	free_irq(INT_24XX_HDQ_IRQ, hdq_data);
>  	platform_set_drvdata(pdev, NULL);
> +	iounmap(hdq_data->hdq_base);
>  	kfree(hdq_data);
>  
>  	return 0;
-- 
balbi
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Arm (vger)]     [ARM Kernel]     [ARM MSM]     [Linux Tegra]     [Linux WPAN Networking]     [Linux Wireless Networking]     [Maemo Users]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Trails]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux