Yoshihiro Shimoda <yoshihiro.shimoda.uh@xxxxxxxxxxx> writes: > [ text/plain ] > Hi Felipe, > > Thank you for the patch! hey, no problem :-) >> Sent: Tuesday, March 29, 2016 7:11 PM > < snip > >> static const struct xhci_plat_priv xhci_plat_renesas_rcar_gen2 = { >> .type = XHCI_PLAT_TYPE_RENESAS_RCAR_GEN2, >> .firmware_name = XHCI_RCAR_FIRMWARE_NAME_V1, >> + .init_quirk = xhci_rcar_init_quirk, >> }; > > I should have said explicitly before, but the xhci_plat_renesas_rcar_gen2 > also needs ".plat_start = xhci_rcar_start" like the variable of gen3. good catch, I really missed that one :-) Here's an updated version of $subject: 8<------------------------------------ cut here ---------------------------- From 33607d25f042d4972dcf2a95f35f051c74b12e51 Mon Sep 17 00:00:00 2001 From: Felipe Balbi <felipe.balbi@xxxxxxxxxxxxxxx> Date: Tue, 29 Mar 2016 13:03:31 +0300 Subject: [PATCH] usb: host: xhci: plat: make use of new methods in xhci_plat_priv Now that the code has been refactored enough, switching over to using ->plat_start() and ->init_quirk() becomes a very simple patch. After this patch, there are no further uses for xhci_plat_type_is() which will be removed in a follow-up patch. Signed-off-by: Felipe Balbi <felipe.balbi@xxxxxxxxxxxxxxx> --- drivers/usb/host/xhci-plat.c | 42 +++++++++++++++++++++++++++--------------- 1 file changed, 27 insertions(+), 15 deletions(-) diff --git a/drivers/usb/host/xhci-plat.c b/drivers/usb/host/xhci-plat.c index d2a4f2be6a75..9e84992805d6 100644 --- a/drivers/usb/host/xhci-plat.c +++ b/drivers/usb/host/xhci-plat.c @@ -37,6 +37,24 @@ static const struct xhci_driver_overrides xhci_plat_overrides __initconst = { .start = xhci_plat_start, }; +static void xhci_priv_plat_start(struct usb_hcd *hcd) +{ + struct xhci_plat_priv *priv = hcd_to_xhci_priv(hcd); + + if (priv->plat_start) + priv->plat_start(hcd); +} + +static int xhci_priv_init_quirk(struct usb_hcd *hcd) +{ + struct xhci_plat_priv *priv = hcd_to_xhci_priv(hcd); + + if (!priv->init_quirk) + return 0; + + return priv->init_quirk(hcd); +} + static void xhci_plat_quirks(struct device *dev, struct xhci_hcd *xhci) { /* @@ -52,44 +70,38 @@ static int xhci_plat_setup(struct usb_hcd *hcd) { int ret; - if (xhci_plat_type_is(hcd, XHCI_PLAT_TYPE_RENESAS_RCAR_GEN2) || - xhci_plat_type_is(hcd, XHCI_PLAT_TYPE_RENESAS_RCAR_GEN3)) { - ret = xhci_rcar_init_quirk(hcd); - if (ret) - return ret; - } - if (xhci_plat_type_is(hcd, XHCI_PLAT_TYPE_MARVELL_ARMADA)) { - ret = xhci_mvebu_mbus_init_quirk(hcd); - if (ret) - return ret; - } + ret = xhci_priv_init_quirk(hcd); + if (ret) + return ret; return xhci_gen_setup(hcd, xhci_plat_quirks); } static int xhci_plat_start(struct usb_hcd *hcd) { - if (xhci_plat_type_is(hcd, XHCI_PLAT_TYPE_RENESAS_RCAR_GEN2) || - xhci_plat_type_is(hcd, XHCI_PLAT_TYPE_RENESAS_RCAR_GEN3)) - xhci_rcar_start(hcd); - + xhci_priv_plat_start(hcd); return xhci_run(hcd); } #ifdef CONFIG_OF static const struct xhci_plat_priv xhci_plat_marvell_armada = { .type = XHCI_PLAT_TYPE_MARVELL_ARMADA, + .init_quirk = xhci_mvebu_mbus_init_quirk, }; static const struct xhci_plat_priv xhci_plat_renesas_rcar_gen2 = { .type = XHCI_PLAT_TYPE_RENESAS_RCAR_GEN2, .firmware_name = XHCI_RCAR_FIRMWARE_NAME_V1, + .init_quirk = xhci_rcar_init_quirk, + .plat_start = xhci_rcar_start, }; static const struct xhci_plat_priv xhci_plat_renesas_rcar_gen3 = { .type = XHCI_PLAT_TYPE_RENESAS_RCAR_GEN3, .firmware_name = XHCI_RCAR_FIRMWARE_NAME_V2, + .init_quirk = xhci_rcar_init_quirk, + .plat_start = xhci_rcar_start, }; static const struct of_device_id usb_xhci_of_match[] = { -- 2.8.0.rc2 -- balbi
Attachment:
signature.asc
Description: PGP signature