Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp2169660rwd; Tue, 13 Jun 2023 21:52:45 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6rHeBNZLMUeNXZTa1vk7NnfQ+B4Z0q97Q1aR5DLKurEnUwIVg1nM3T7ortXUJblLBcrv/x X-Received: by 2002:aca:230b:0:b0:394:4642:7148 with SMTP id e11-20020aca230b000000b0039446427148mr9115748oie.48.1686718364858; Tue, 13 Jun 2023 21:52:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686718364; cv=none; d=google.com; s=arc-20160816; b=pDlPINjLontl5kTXdWRj/PloV8xQFidwAbi81uKFGzSF11eOU9DQwairCTgXmyVWS6 6IEcT0DhZl5SO1RontQw50rfYo6Qjd7yFdBTMpgzItmdTYl2kG5Fb3Swhb0dAd7nACB2 r9uvJuF2GhM56OzgFYjF01XXJXepfcfuESJ/QsOey4aNpo9bOtyuf96o/fTa+kUtBZdD 1hNfpveOPjUmqMuZrMTCVyE95qU3AW1awBl/558N7HGM4TFCiKzgRrvOxzFmJwvjF9Hr w4dHMIEjyP55oAACG513Kh8mAu8f8z4riVkmqpioh3giWlO2kay9cMVkHSLz5+LLWoy3 qm0w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=V87rXRJ0McF4e18E5pljBHXkteT2i+vavHVk1lyfqHY=; b=zV2BjRu1gcgM08W7DpYJNz2XVYrPfCeQufr6eLUobEOdNr5WOuPayqS0Da76PJApjf umE7BPKXiC7qtOGneqOiDDwOhHv1dv76kzTejFLBJtc+eY2l1yYZUKnaTC5o5lUTZjWM PyQmQxd88/HpPyKXHxI27nm5F1ZPpxqE8v2sgcjlymaOGHW2TEniNIfHANCccsVrFw4F evJeGhwf6+pLCb1mC8SrpfgagADv6AhDm1zSMIT3AAJsUF/CKZX+TMqBjPQmvN2DqRPf gVxO/8FYpL2OgKvc+RhcrDCQGSsZf3u5vpE6LZI/XQ4Nq02v2d9X8d82hHNcPaLn4Ng9 px3Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=M3OFeK4A; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id m7-20020a17090ab78700b00244883db2c7si11827549pjr.99.2023.06.13.21.52.31; Tue, 13 Jun 2023 21:52:44 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=M3OFeK4A; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233906AbjFNEZZ (ORCPT + 99 others); Wed, 14 Jun 2023 00:25:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33952 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233728AbjFNEZX (ORCPT ); Wed, 14 Jun 2023 00:25:23 -0400 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 505EDE4; Tue, 13 Jun 2023 21:25:22 -0700 (PDT) Received: from pps.filterd (m0279863.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 35E40mXY020013; Wed, 14 Jun 2023 04:25:16 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h=message-id : date : mime-version : subject : to : cc : references : from : in-reply-to : content-type : content-transfer-encoding; s=qcppdkim1; bh=V87rXRJ0McF4e18E5pljBHXkteT2i+vavHVk1lyfqHY=; b=M3OFeK4AtnyDLCs97ApSegSR6kfDklgvGR/M4nf95CCFgv88eWYxABsOOy5kP/GQ2ZZ/ 9qrRHSEH/D0pYByhRtZj0RKVy8nWx4WT9h34fCd/Eohy7YFahWsPU1e3yGUEjR9g1F93 OxPJo5jS87RDv7+efw1OPKr2Xs5cdSANIeV+ib9HVho83HY7i9OnOaRcmNpPudsgZUk9 jcve7CkA54Tp+X58rGZDU1F3Xxr8ORN/9c5snWCs3TZA95JyXU6POCepzL7X7vEulFw6 Tebgi/SxkMn0yaRw9iRW8K+/F4eTZX7qnLCczzNYWqd2+MbFgSJazyZRUt8kJrwphtXE nw== Received: from nalasppmta04.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3r6t0bsjjn-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 14 Jun 2023 04:25:16 +0000 Received: from nalasex01a.na.qualcomm.com (nalasex01a.na.qualcomm.com [10.47.209.196]) by NALASPPMTA04.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 35E4PFwO011470 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 14 Jun 2023 04:25:15 GMT Received: from [10.217.219.52] (10.80.80.8) by nalasex01a.na.qualcomm.com (10.47.209.196) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.42; Tue, 13 Jun 2023 21:25:13 -0700 Message-ID: <73854744-03ef-2c5c-a5d6-284f004a5497@quicinc.com> Date: Wed, 14 Jun 2023 09:55:10 +0530 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.9.1 Subject: Re: [PATCH v7] usb: common: usb-conn-gpio: Set last role to unknown before initial detection Content-Language: en-US To: Heikki Krogerus CC: Greg Kroah-Hartman , AngeloGioacchino Del Regno , Matthias Brugger , , References: <1685544074-17337-1-git-send-email-quic_prashk@quicinc.com> From: Prashanth K In-Reply-To: Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: nasanex01b.na.qualcomm.com (10.46.141.250) To nalasex01a.na.qualcomm.com (10.47.209.196) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-GUID: 1tvv1WEG4yY5z_MFXZesFYsRiGRwUvu2 X-Proofpoint-ORIG-GUID: 1tvv1WEG4yY5z_MFXZesFYsRiGRwUvu2 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.573,FMLib:17.11.176.26 definitions=2023-06-14_02,2023-06-12_02,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxscore=0 bulkscore=0 priorityscore=1501 clxscore=1011 mlxlogscore=632 spamscore=0 lowpriorityscore=0 suspectscore=0 adultscore=0 impostorscore=0 phishscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2305260000 definitions=main-2306140035 X-Spam-Status: No, score=-2.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_DNSWL_LOW, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 13-06-23 04:40 pm, Heikki Krogerus wrote: > Hi, > > On Wed, May 31, 2023 at 08:11:14PM +0530, Prashanth K wrote: >> Currently if we bootup a device without cable connected, then >> usb-conn-gpio won't call set_role() since last_role is same as >> current role. This happens because during probe last_role gets >> initialised to zero. >> >> To avoid this, added a new constant in enum usb_role, last_role >> is set to USB_ROLE_UNKNOWN before performing initial detection. > > So why can't you fix this by just always setting the role > unconditionally to USB_ROLE_NONE in your probe function before the > initial detection? > Hi Heikki, thats exactly what we are doing here. + /* Set last role to unknown before performing the initial detection */ + info->last_role = USB_ROLE_UNKNOWN; + /* Perform initial detection */ usb_conn_queue_dwork(info, 0); Thanks, Prashanth K