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 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id F125AEB64DB for ; Wed, 14 Jun 2023 04:25:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242328AbjFNEZZ (ORCPT ); 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 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