mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: "Daniel Glöckner" <dg@emlix.com>
To: Barebox List <barebox@lists.infradead.org>
Subject: [PATCH v3 05/14] usb: Add a slice to usb host controllers
Date: Mon, 15 Jun 2020 19:20:38 +0200	[thread overview]
Message-ID: <2abb1088ba8f9fad2b507b8a51dc12186687d7be.1592241105.git.dg@emlix.com> (raw)
In-Reply-To: <cover.1592241105.git.dg@emlix.com>
In-Reply-To: <cover.1592241105.git.dg@emlix.com>

From: Sascha Hauer <s.hauer@pengutronix.de>

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 drivers/usb/core/usb.c | 7 +++++++
 include/usb/usb.h      | 7 +++++++
 2 files changed, 14 insertions(+)

diff --git a/drivers/usb/core/usb.c b/drivers/usb/core/usb.c
index 30c251f40..847529526 100644
--- a/drivers/usb/core/usb.c
+++ b/drivers/usb/core/usb.c
@@ -78,11 +78,16 @@ static inline int usb_host_acquire(struct usb_host *host)
 	if (host->sem)
 		return -EAGAIN;
 	host->sem++;
+
+	slice_acquire(&host->slice);
+
 	return 0;
 }
 
 static inline void usb_host_release(struct usb_host *host)
 {
+	slice_release(&host->slice);
+
 	if (host->sem > 0)
 		host->sem--;
 }
@@ -92,11 +97,13 @@ int usb_register_host(struct usb_host *host)
 	list_add_tail(&host->list, &host_list);
 	host->busnum = host_busnum++;
 	host->sem = 0;
+	slice_init(&host->slice, dev_name(host->hw_dev));
 	return 0;
 }
 
 void usb_unregister_host(struct usb_host *host)
 {
+	slice_exit(&host->slice);
 	list_del(&host->list);
 }
 
diff --git a/include/usb/usb.h b/include/usb/usb.h
index c2085eae8..1b51a00dd 100644
--- a/include/usb/usb.h
+++ b/include/usb/usb.h
@@ -20,6 +20,7 @@
 #define _USB_H_
 
 #include <driver.h>
+#include <slice.h>
 #include <usb/ch9.h>
 #include <usb/ch11.h>
 #include <usb/usb_defs.h>
@@ -165,11 +166,17 @@ struct usb_host {
 	struct usb_device *root_dev;
 	int sem;
 	struct usb_phy *usbphy;
+	struct slice slice;
 };
 
 int usb_register_host(struct usb_host *);
 void usb_unregister_host(struct usb_host *host);
 
+static inline struct slice *usb_device_slice(struct usb_device *udev)
+{
+	return &udev->host->slice;
+}
+
 int usb_host_detect(struct usb_host *host);
 
 int usb_set_protocol(struct usb_device *dev, int ifnum, int protocol);
-- 
2.17.1


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

  parent reply	other threads:[~2020-06-15 17:21 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-15 17:20 [PATCH v3 00/14] Slices and fastboot over UDP Daniel Glöckner
2020-06-15 17:20 ` [PATCH v3 01/14] Introduce slices Daniel Glöckner
2020-06-15 17:20 ` [PATCH v3 02/14] Introduce idle slice Daniel Glöckner
2020-06-15 17:20 ` [PATCH v3 03/14] net: Add a slice to struct eth_device Daniel Glöckner
2020-06-15 17:20 ` [PATCH v3 04/14] net: mdiobus: Add slice Daniel Glöckner
2020-06-15 17:20 ` Daniel Glöckner [this message]
2020-06-15 17:20 ` [PATCH v3 06/14] usbnet: " Daniel Glöckner
2020-06-15 17:20 ` [PATCH v3 07/14] net: Call net_poll() in a poller Daniel Glöckner
2020-06-15 17:20 ` [PATCH v3 08/14] net: reply to ping requests Daniel Glöckner
2020-06-15 17:20 ` [PATCH v3 09/14] usbnet: Be more friendly in the receive path Daniel Glöckner
2020-06-15 17:20 ` [PATCH v3 10/14] poller: Allow to run pollers inside of pollers Daniel Glöckner
2020-06-17  7:00   ` Sascha Hauer
2020-06-15 17:20 ` [PATCH v3 11/14] defconfigs: update renamed fastboot options Daniel Glöckner
2020-06-15 17:20 ` [PATCH v3 12/14] globalvar: Add helper for deprecated variable names Daniel Glöckner
2020-06-15 17:20 ` [PATCH v3 13/14] fastboot: rename usbgadget.fastboot_* variables to fastboot.* Daniel Glöckner
2020-06-15 17:20 ` [PATCH v3 14/14] fastboot net: implement fastboot over UDP Daniel Glöckner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2abb1088ba8f9fad2b507b8a51dc12186687d7be.1592241105.git.dg@emlix.com \
    --to=dg@emlix.com \
    --cc=barebox@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox