From: Wolfgang Denk Date: Tue, 22 Mar 2011 16:16:22 +0100 Subject: [U-Boot] [PATCH V3 2/5] mv_i2c: use structure to replace the direclty define In-Reply-To: References: <1300344306-26608-3-git-send-email-leiwen@marvell.com> Message-ID: <20110322151622.6606F151F7D@gemini.denx.de> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Dear Lei Wen, In message you wrote: > ... > >> - writel(readl(ICR) & ~ICR_ACKNA> K, ICR); > >> - writel(readl(ICR) & ~ICR_ALDIE, ICR); > >> - writel(readl(ICR) | ICR_TB, ICR); > >> + PXAI2C_AND(&base->icr, ~ICR_AC> KNAK); > >> + PXAI2C_AND(&base->icr, ~ICR_ALDIE); > >> + PXAI2C_OR(&base->icr, ICR_TB); > > > > What are benefits of those macros? > > To me this looks ugly and looses readability. > > This intend for short the original too long code, but I don't reject to ret> urn > to the readl, write one. Please either use plain writel() / readl() accessors, or, alternatively, implement standard accessors that could be used by everybody else for the same purpose, too. See for example the misc clrbits*(), setbits*() or clrsetbits*() macros as dfined for example in "arch/powerpc/include/asm/io.h" Best regards, Wolfgang Denk -- DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de "Deliver yesterday, code today, think tomorrow."