Re: [PATCH 1/5] CSI camera interface driver for MX1

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

 



On Thu, Mar 26, 2009 at 05:31:35PM -0400, Dave Strauss wrote:
> Newbie question -- where does one find checkpatch.pl?  And are there any other
> tools we should be running on patches before we submit them?

scripts/checkpatch.pl in the kernel source.

Sparse is another tool which can be used while building the kernel to
increase the build time checking, but it can be quite noisy, so please
only look at stuff which pops up for your specific area.

Also, avoid using __force to shut up sparse warnings - sparse's address
space separation via use of __user and __iomem tags are supposed to _only_
be casted away by the final level of code (iow, the bits which really
do the accesses.)  It's preferred to leave the warnings in place rather
than silence them.

In other words:

static int blah(void __iomem *ptr)
{
	void *foo = ptr;
	...
}

will generate a sparse warning.  The right solution to this is:

static int blah(void __iomem *ptr)
{
	void __iomem *foo = ptr;
	...
}

but if that's not possible for whatever reason, leave it as is and
definitely do *not* silence it like this:

static int blah(void __iomem *ptr)
{
	void *foo = (void __force *)ptr;
	...
}

The point of __iomem is to allow static checking that pointers for MMIO
aren't dereferenced without using the correct accessors, and adding
such __force casts negates the purpose of sparse.
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Input]     [Video for Linux]     [Gstreamer Embedded]     [Mplayer Users]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux