lkml.org 
[lkml]   [2009]   [May]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v2 5/7] [PATCH 5/8] can: SJA1000 generic platform bus driver
On Tue, 12 May 2009 11:28:02 +0200
Wolfgang Grandegger <wg@grandegger.com> wrote:

> This driver adds support for the SJA1000 chips connected to the
> "platform bus", which can be found on various embedded systems.

[...]

> +
> +static u8 sp_read_reg(const struct net_device *dev, int reg)
> +{
> + return ioread8((void __iomem *)(dev->base_addr + reg));
> +}
> +
> +static void sp_write_reg(const struct net_device *dev, int reg, u8 val)
> +{
> + iowrite8(val, (void __iomem *)(dev->base_addr + reg));
> +}

So there's no locking around accesses to the hardware at all. How do you
protect against concurrent access?

[...]

> +static int sp_remove(struct platform_device *pdev)
> +{
> + struct net_device *dev = dev_get_drvdata(&pdev->dev);
> + struct resource *res;
> +
> + unregister_sja1000dev(dev);
> + dev_set_drvdata(&pdev->dev, NULL);
> + res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> + release_mem_region(res->start, res->end - res->start + 1);
> +
> + if (dev->base_addr)
> + iounmap((void __iomem *)dev->base_addr);

Seems like you should unmap it before releasing it back to the kernel.
Nobody else is ever going to jump in and try to map it, but still...

> + free_sja1000dev(dev);
> +
> + return 0;
> +}

jon


\
 
 \ /
  Last update: 2009-05-14 00:05    [from the cache]
©2003-2014 Jasper Spaans. Advertise on this site