From mboxrd@z Thu Jan 1 00:00:00 1970 From: Marek Vasut Date: Fri, 27 May 2016 14:47:13 +0200 Subject: [U-Boot] [PATCH 2/5] usb: xhci: fsl: code cleanup for device tree fixup for fsl usb controllers In-Reply-To: References: <1464242367-314-1-git-send-email-sriram.dash@nxp.com> <1464242367-314-3-git-send-email-sriram.dash@nxp.com> <5746E9BE.9050006@denx.de> Message-ID: <574841D1.4010708@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 On 05/27/2016 07:14 AM, Sriram Dash wrote: >> -----Original Message----- >> From: Marek Vasut [mailto:marex at denx.de] >> Sent: Thursday, May 26, 2016 5:49 PM >> To: Sriram Dash ; u-boot at lists.denx.de >> Cc: york sun ; albert.u.boot at aribaud.net; Rajesh Bhagat >> >> Subject: Re: [PATCH 2/5] usb: xhci: fsl: code cleanup for device tree fixup for fsl usb >> controllers >> >> On 05/26/2016 07:59 AM, Sriram Dash wrote: >> >> Commit message, please. >> > > Will take care in v2. > >>> Signed-off-by: Rajesh Bhagat >>> Signed-off-by: Sriram Dash >>> --- >>> drivers/usb/common/fsl-dt-fixup.c | 51 >>> +++++++++++++-------------------------- >>> 1 file changed, 17 insertions(+), 34 deletions(-) >>> >>> diff --git a/drivers/usb/common/fsl-dt-fixup.c >>> b/drivers/usb/common/fsl-dt-fixup.c >>> index 6f31932..520130e 100644 >>> --- a/drivers/usb/common/fsl-dt-fixup.c >>> +++ b/drivers/usb/common/fsl-dt-fixup.c >>> @@ -99,6 +99,19 @@ static int fdt_fixup_usb_erratum(void *blob, const char >> *prop_erratum, >>> return node_offset; >>> } >>> >>> +#define FDT_FIXUP_ERRATUM(id) \ >>> +do { \ >>> + if (has_erratum_##id()) { \ >>> + usb_erratum_##id##_off = fdt_fixup_usb_erratum \ >>> + (blob, \ >>> + "fsl,usb-erratum-"#id, \ >>> + usb_erratum_##id##_off); \ >>> + if (usb_erratum_##id##_off < 0) \ >>> + return; \ >>> + debug("Adding USB erratum "#id"\n"); \ >>> + } \ >>> +} while (0) >> >> Would it be difficult to turn this into a function ? >> >> You can likely implement some function like int fsl_has_erratum(const unsigned int >> erratum) and then do the string concatenation with snprintf(). >> > > Do you suspect any possible issue with macro implementation, or your comment is for reducing the size of U boot by making it a function? I'm not a fan of huge macros, since they often introduce various subtle issues and in this case it would most likely reduce size of the u-boot. >>> void fdt_fixup_dr_usb(void *blob, bd_t *bd) { >>> static const char * const modes[] = { "host", "peripheral", "otg" }; >>> @@ -164,39 +177,9 @@ void fdt_fixup_dr_usb(void *blob, bd_t *bd) >>> if (usb_phy_off < 0) >>> return; >>> >>> - if (has_erratum_a006261()) { >>> - usb_erratum_a006261_off = fdt_fixup_usb_erratum >>> - (blob, >>> - "fsl,usb-erratum-a006261", >>> - usb_erratum_a006261_off); >>> - if (usb_erratum_a006261_off < 0) >>> - return; >>> - } >>> - >>> - if (has_erratum_a007075()) { >>> - usb_erratum_a007075_off = fdt_fixup_usb_erratum >>> - (blob, >>> - "fsl,usb-erratum-a007075", >>> - usb_erratum_a007075_off); >>> - if (usb_erratum_a007075_off < 0) >>> - return; >>> - } >>> - >>> - if (has_erratum_a007792()) { >>> - usb_erratum_a007792_off = fdt_fixup_usb_erratum >>> - (blob, >>> - "fsl,usb-erratum-a007792", >>> - usb_erratum_a007792_off); >>> - if (usb_erratum_a007792_off < 0) >>> - return; >>> - } >>> - if (has_erratum_a005697()) { >>> - usb_erratum_a005697_off = fdt_fixup_usb_erratum >>> - (blob, >>> - "fsl,usb-erratum-a005697", >>> - usb_erratum_a005697_off); >>> - if (usb_erratum_a005697_off < 0) >>> - return; >>> - } >>> + FDT_FIXUP_ERRATUM(a006261); >>> + FDT_FIXUP_ERRATUM(a007075); >>> + FDT_FIXUP_ERRATUM(a007792); >>> + FDT_FIXUP_ERRATUM(a005697); >>> } >>> } >>> >> >> >> -- >> Best regards, >> Marek Vasut -- Best regards, Marek Vasut