Re: [PATCH v2 07/11] OMAP2/3/4: DMA: HWMOD: Device registration

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

 



On Tue, Sep 14, 2010 at 06:44:01AM -0500, G, Manjunath Kondaiah wrote:


-----Original Message-----
From: Balbi, Felipe
Sent: Tuesday, September 14, 2010 3:54 PM
To: G, Manjunath Kondaiah
Cc: Kevin Hilman; linux-omap@xxxxxxxxxxxxxxx; Cousson,
Benoit; Shilimkar, Santosh
Subject: Re: [PATCH v2 07/11] OMAP2/3/4: DMA: HWMOD: Device
registration

Hi,

On Tue, Sep 14, 2010 at 05:18:52AM -0500, G, Manjunath Kondaiah wrote:
>How static inline functions are better than this?

static inline function will at least give you type checking ??

If so, even inline function has certain disadvantages such as, A.
somtimes the compiler may not be able to inline as many functions as
the programmer indicates.

show me one such example.

B. Inline functions might increcase compilation time

it's possible, for sure. But for the case you just showed the arguments
are even constant, so there's more room for compile-time optimization.
In the end, GCC will replace your calls with:

address = value;

or, when reading:

return address

The issue in DMA driver is, if I replace dma_read/dma_write macros with
inline functions, I need to remove OMAP_DMA4_##reg macro in dma_read
and dma write functions and I have to expand the register names all
over the place in DMA driver(like instead of CAPS0, it should be
OMAP_DMA4_CAPS0, having only CAPS0 will be easier to read).

it might be easier to read but this is a recipe for disaster. Avoid
using those macros for part of the actual symbol/define/whatever name
like that. If someone later decides to change something, it will be a
pain. With those macros you also kill any possibility of using
ctags/cscope for source code cross-referencing. When a developers
searchs for the definition of CAPS0, he won't find it, as it's called
OMAP_DMA4_CAPS0. So remove those silly things and change the defines to
static inline functions.

--
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