[2/3] usb: xhci-plat: add xhci_plat_priv_overwrite

Message ID 20221027004050.4192111-3-albertccwang@google.com
State New
Headers
Series add xhci hooks for USB offload |

Commit Message

Albert Wang Oct. 27, 2022, 12:40 a.m. UTC
  From: Howard Yen <howardyen@google.com>

Add an overwrite to platform specific callback for setting up the
xhci_offload_ops, allow vendor to store the xhci_offload_ops and
overwrite them when xhci_plat_probe invoked.

Signed-off-by: Howard Yen <howardyen@google.com>
Link: https://lore.kernel.org/r/20210119101044.1637023-1-howardyen@google.com
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
---
 drivers/usb/host/xhci-plat.c | 20 ++++++++++++++++++++
 drivers/usb/host/xhci-plat.h |  7 +++++++
 2 files changed, 27 insertions(+)
  

Comments

Greg KH Oct. 27, 2022, 6:23 a.m. UTC | #1
On Thu, Oct 27, 2022 at 08:40:49AM +0800, Albert Wang wrote:
> From: Howard Yen <howardyen@google.com>
> 
> Add an overwrite to platform specific callback for setting up the
> xhci_offload_ops, allow vendor to store the xhci_offload_ops and
> overwrite them when xhci_plat_probe invoked.
> 
> Signed-off-by: Howard Yen <howardyen@google.com>
> Link: https://lore.kernel.org/r/20210119101044.1637023-1-howardyen@google.com
> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>

Again, no, I do NOT sign off on this submission.

Also, you did not sign off on it, yet you forwarded it on.  That's not
allowed either, and makes this whole series not even able to be
accepted, if it were a valid set of changes :(

Please fix.

thanks,

greg k-h
  
Albert Wang Nov. 3, 2022, 2:12 p.m. UTC | #2
Understood, will fix and re-upload v2 patch set.

Thanks,
Albert

Albert Wang | Pixel USB Software  | albertccwang@google.com | +886-918-695-245


On Thu, Oct 27, 2022 at 2:22 PM Greg KH <gregkh@linuxfoundation.org> wrote:
>
> On Thu, Oct 27, 2022 at 08:40:49AM +0800, Albert Wang wrote:
> > From: Howard Yen <howardyen@google.com>
> >
> > Add an overwrite to platform specific callback for setting up the
> > xhci_offload_ops, allow vendor to store the xhci_offload_ops and
> > overwrite them when xhci_plat_probe invoked.
> >
> > Signed-off-by: Howard Yen <howardyen@google.com>
> > Link: https://lore.kernel.org/r/20210119101044.1637023-1-howardyen@google.com
> > Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
>
> Again, no, I do NOT sign off on this submission.
>
> Also, you did not sign off on it, yet you forwarded it on.  That's not
> allowed either, and makes this whole series not even able to be
> accepted, if it were a valid set of changes :(
>
> Please fix.
>
> thanks,
>
> greg k-h
  

Patch

diff --git a/drivers/usb/host/xhci-plat.c b/drivers/usb/host/xhci-plat.c
index 2f04acb42fa6..11ff89f722b7 100644
--- a/drivers/usb/host/xhci-plat.c
+++ b/drivers/usb/host/xhci-plat.c
@@ -173,9 +173,26 @@  static const struct of_device_id usb_xhci_of_match[] = {
 MODULE_DEVICE_TABLE(of, usb_xhci_of_match);
 #endif
 
+static struct xhci_plat_priv_overwrite xhci_plat_vendor_overwrite;
+
+int xhci_plat_register_offload_ops(struct xhci_offload_ops *offload_ops)
+{
+	if (offload_ops == NULL)
+		return -EINVAL;
+
+	xhci_plat_vendor_overwrite.offload_ops = offload_ops;
+
+	return 0;
+}
+EXPORT_SYMBOL_GPL(xhci_plat_register_offload_ops);
+
 static int xhci_vendor_init(struct xhci_hcd *xhci)
 {
 	struct xhci_offload_ops *ops = xhci_offload_get_ops(xhci);
+	struct xhci_plat_priv *priv = xhci_to_priv(xhci);
+
+	if (xhci_plat_vendor_overwrite.offload_ops)
+		ops = priv->offload_ops = xhci_plat_vendor_overwrite.offload_ops;
 
 	if (ops && ops->offload_init)
 		return ops->offload_init(xhci);
@@ -185,9 +202,12 @@  static int xhci_vendor_init(struct xhci_hcd *xhci)
 static void xhci_vendor_cleanup(struct xhci_hcd *xhci)
 {
 	struct xhci_offload_ops *ops = xhci_offload_get_ops(xhci);
+	struct xhci_plat_priv *priv = xhci_to_priv(xhci);
 
 	if (ops && ops->offload_cleanup)
 		ops->offload_cleanup(xhci);
+
+	priv->offload_ops = NULL;
 }
 
 static int xhci_plat_probe(struct platform_device *pdev)
diff --git a/drivers/usb/host/xhci-plat.h b/drivers/usb/host/xhci-plat.h
index 5aa0d38fa01a..0656d6daa194 100644
--- a/drivers/usb/host/xhci-plat.h
+++ b/drivers/usb/host/xhci-plat.h
@@ -22,4 +22,11 @@  struct xhci_plat_priv {
 
 #define hcd_to_xhci_priv(h) ((struct xhci_plat_priv *)hcd_to_xhci(h)->priv)
 #define xhci_to_priv(x) ((struct xhci_plat_priv *)(x)->priv)
+
+struct xhci_plat_priv_overwrite {
+	struct xhci_offload_ops *offload_ops;
+};
+
+int xhci_plat_register_offload_ops(struct xhci_offload_ops *offload_ops);
+
 #endif	/* _XHCI_PLAT_H */