From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.0 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A74CBC433E2 for ; Thu, 18 Jun 2020 01:12:05 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 70B81214DB for ; Thu, 18 Jun 2020 01:12:05 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="imU4GdSk"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=kernel.org header.i=@kernel.org header.b="RQOEzgxV" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 70B81214DB Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-mediatek-bounces+linux-mediatek=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=S5cr9EVRi9wlU3CLo1jFHcWxkfDNNjs2mhHokiIbZtM=; b=imU4GdSkF36ZB7 Z07RKHXc/B80/zYyds4vPIJGvCeG90c2qn5oM+n59+Q5Z1JkiICozcpTWaPonXzqBoeFSZBE9xYmw VCP74E+tdPw8cksqA/dHOK8oZvKOaLcLcnYdxlG95ZlmY9IKqqc3T757d0+BMZmcceqwZISkVQRTx mdPg2VOc4JxSbycRbW2GIBzxAyR90ucYZIv/7XXpYsQf+Bj3TnCNV5+xuL0PsSAzc/h0LPI9GSrYG mjDgUa+RveRhfweCY6Z1vj4VUb06FzP6qd3VWDMOvi7VkImc7hdwAVhEqJcxs/rRNkI8wpW9mYDwH roc55owdU+Yect7OVo1w==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jlj5w-0001a8-Oa; Thu, 18 Jun 2020 01:11:56 +0000 Received: from mail.kernel.org ([198.145.29.99]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jlj38-0005AU-Ip; Thu, 18 Jun 2020 01:09:05 +0000 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 61B8E2193E; Thu, 18 Jun 2020 01:09:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1592442541; bh=YPzz4H8pRJPKgR9c3fl1iGtB6EgAkhkiYDDNODbhzMc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RQOEzgxVM0ABlrOOxduNPsZUHR83Ow92gfO0Vi3bHRN0nuMP3Xxwc/54UZkGOLzmz AQ7CV84grMJolmMzO15uLpizRwCQhvVvApMbnJZGrBb+kXrdTxtT2fl48MPVdcAv27 wLqX15eQCrV01waZv3yV/xMv7WI2PdzQBup7YfxM= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Subject: [PATCH AUTOSEL 5.7 042/388] usb: roles: Switch on role-switch uevent reporting Date: Wed, 17 Jun 2020 21:02:19 -0400 Message-Id: <20200618010805.600873-42-sashal@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200618010805.600873-1-sashal@kernel.org> References: <20200618010805.600873-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200617_180903_153636_9825C99F X-CRM114-Status: GOOD ( 10.62 ) X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Sasha Levin , Alexandre Belloni , Heikki Krogerus , Wen Yang , Suzuki K Poulose , Greg Kroah-Hartman , linux-usb@vger.kernel.org, linux-mediatek@lists.infradead.org, Chunfeng Yun , Bryan O'Donoghue , chenqiwu , linux-arm-kernel@lists.infradead.org Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+linux-mediatek=archiver.kernel.org@lists.infradead.org From: Bryan O'Donoghue [ Upstream commit 3e63cff384e625f09758ce8f4d01ae3033402b63 ] Right now we don't report to user-space a role switch when doing a usb_role_switch_set_role() despite having registered the uevent callbacks. This patch switches on the notifications allowing user-space to see role-switch change notifications and subsequently determine the current controller data-role. example: PFX=/devices/platform/soc/78d9000.usb/ci_hdrc.0 root@somebox# udevadm monitor -p KERNEL[49.894994] change $PFX/usb_role/ci_hdrc.0-role-switch (usb_role) ACTION=change DEVPATH=$PFX/usb_role/ci_hdrc.0-role-switch SUBSYSTEM=usb_role DEVTYPE=usb_role_switch USB_ROLE_SWITCH=ci_hdrc.0-role-switch SEQNUM=2432 Cc: Heikki Krogerus Cc: Greg Kroah-Hartman Cc: Chunfeng Yun Cc: Suzuki K Poulose Cc: Alexandre Belloni Cc: Wen Yang Cc: chenqiwu Cc: linux-kernel@vger.kernel.org Signed-off-by: Bryan O'Donoghue Link: https://lore.kernel.org/r/20200508162937.2566818-1-bryan.odonoghue@linaro.org Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- drivers/usb/roles/class.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/usb/roles/class.c b/drivers/usb/roles/class.c index 5b17709821df..27d92af29635 100644 --- a/drivers/usb/roles/class.c +++ b/drivers/usb/roles/class.c @@ -49,8 +49,10 @@ int usb_role_switch_set_role(struct usb_role_switch *sw, enum usb_role role) mutex_lock(&sw->lock); ret = sw->set(sw, role); - if (!ret) + if (!ret) { sw->role = role; + kobject_uevent(&sw->dev.kobj, KOBJ_CHANGE); + } mutex_unlock(&sw->lock); -- 2.25.1 _______________________________________________ Linux-mediatek mailing list Linux-mediatek@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-mediatek