[U-Boot] [PATCH v2 3/4] usb: sunxi: ohci: get rid of ifdefs

Maxime Ripard maxime.ripard at bootlin.com
Thu Jun 7 07:22:26 UTC 2018


Hi,

On Wed, Jun 06, 2018 at 07:30:10PM -0700, Vasily Khoruzhick wrote:
> We can use compatibles instead.
> 
> Signed-off-by: Vasily Khoruzhick <anarsoul at gmail.com>
> ---
>  drivers/usb/host/ohci-sunxi.c | 88 +++++++++++++++++++++++++++--------
>  1 file changed, 68 insertions(+), 20 deletions(-)
> 
> diff --git a/drivers/usb/host/ohci-sunxi.c b/drivers/usb/host/ohci-sunxi.c
> index ce2b47a5c4..dfdd1e538d 100644
> --- a/drivers/usb/host/ohci-sunxi.c
> +++ b/drivers/usb/host/ohci-sunxi.c
> @@ -22,12 +22,25 @@
>  #define AHB_CLK_DIST		1
>  #endif
>  
> +enum ohci_sunxi_type {
> +	sun4i_a10_ohci,
> +	sun5i_a13_ohci,
> +	sun6i_a31_ohci,
> +	sun7i_a20_ohci,
> +	sun8i_a23_ohci,
> +	sun8i_a83t_ohci,
> +	sun8i_h3_ohci,
> +	sun9i_a80_ohci,
> +	sun50i_a64_ohci,
> +};
> +
>  struct ohci_sunxi_priv {
>  	struct sunxi_ccm_reg *ccm;
>  	ohci_t ohci;
>  	int ahb_gate_mask; /* Mask of ahb_gate0 clk gate bits for this hcd */
>  	int usb_gate_mask; /* Mask of usb_clk_cfg clk gate bits for this hcd */
>  	struct phy phy;
> +	enum ohci_sunxi_type type;

I'm really not a big fan of those ID, especially when we already have
a structure here that have some very similar data embedded into it. In
this particular case, it looks like you just need to add a bool to say
if it has a reset, and an int for the extra_ahb_gate_mask, like we
have the ahb_gate_mask already.

This also applies to the EHCI patch.

Maxime

-- 
Maxime Ripard, Bootlin (formerly Free Electrons)
Embedded Linux and Kernel engineering
https://bootlin.com


More information about the U-Boot mailing list