From mboxrd@z Thu Jan 1 00:00:00 1970 Return-path: Received: from metis.ext.pengutronix.de ([2001:67c:670:201:290:27ff:fe1d:cc33]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jRADf-0003F6-Pc for barebox@lists.infradead.org; Wed, 22 Apr 2020 07:54:58 +0000 From: Sascha Hauer Date: Wed, 22 Apr 2020 09:54:47 +0200 Message-Id: <20200422075452.25226-7-s.hauer@pengutronix.de> In-Reply-To: <20200422075452.25226-1-s.hauer@pengutronix.de> References: <20200422075452.25226-1-s.hauer@pengutronix.de> MIME-Version: 1.0 List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "barebox" Errors-To: barebox-bounces+u.kleine-koenig=pengutronix.de@lists.infradead.org Subject: [PATCH 06/11] usb: Add a slice to usb host controllers To: Barebox List Cc: Edmund Henniges , =?UTF-8?q?Daniel=20Gl=C3=B6ckner?= Signed-off-by: Sascha Hauer --- drivers/usb/core/usb.c | 6 ++++++ include/usb/usb.h | 7 +++++++ 2 files changed, 13 insertions(+) diff --git a/drivers/usb/core/usb.c b/drivers/usb/core/usb.c index d0a91b9e9f..db86ab4d19 100644 --- a/drivers/usb/core/usb.c +++ b/drivers/usb/core/usb.c @@ -81,11 +81,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--; } @@ -95,6 +100,7 @@ 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; } diff --git a/include/usb/usb.h b/include/usb/usb.h index 82a4736445..b3b6cb3178 100644 --- a/include/usb/usb.h +++ b/include/usb/usb.h @@ -23,6 +23,7 @@ #define _USB_H_ #include +#include #include #include #include @@ -168,11 +169,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.26.1 _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox