Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp4092770pxj; Tue, 8 Jun 2021 06:21:35 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzh9HGboAY+e/FO33Pb4eweJeCL+KDjhWrbTs9hHjS8y73IL1OXvslQJxtQINUsIQ934bI9 X-Received: by 2002:a17:906:e104:: with SMTP id gj4mr23921063ejb.350.1623158495476; Tue, 08 Jun 2021 06:21:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623158495; cv=none; d=google.com; s=arc-20160816; b=UJ2uZ9JR0G5YLQLkbN4t60nPXtz6il7U2Nz47Tdl8s4bSnIxMiFge6vuPMANJVvUaO Y4Fb9WTmDnhJ+cJWkNcc9VaU6i9uctXEZBXCBI62Z8VrgcnlSwO76a6ngFEjb+oGPr5H nPH6prvMqgDFzsCAWJsQoWgsYBlkWoijOx0nvGmAgFyS2yvL2wYzyC8JB+HVefj9vlHI QHNo+y/l34JStxi/awvJaA+TbjavuYRUzyA4K9mAySbu4qotSh39ZhoIkeY+sunX1fOU FbHlAWozSssqnmlJSS0miIBVmUESmF9nNrnzFESuuXolqwrV8GSjWCatpVmVQn3I7A4W kzfg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:ironport-sdr :ironport-sdr; bh=5QlCbfgKXp4SB7zk+3F7IoRcT1PXVSlYY0tt1TOu+ns=; b=ATvHZO4LNlL/DW/5/6/bASwSRyqI+/fraRLuJJV7kI1sDD5LbkbdgqRZ6TuSSYg2ab jCTdrpc9wuKhsmApBrxbEq1xws/OM+jYD/0qbofrmO27LZt69qtdJY8f468aWPcyfNb6 tqAUbj+gq4oI4hB/G3MVP4EJ2DDz8f4mE9XSU/BFtP3d0L9E1t2F51vKqiL+Bm4ulsYq iVeK0QXZ5ucsqsEHoUWkdPDZTQ+gVqUOrFSN9Y/o75IkrqpwiPTv9jlDuY0o1gNhrjIQ g7FiqzJ8NdlATXntBXcsmn95iHmKPAXjVWf7FvK6bEgmV5D+E5dY5Dn7rPr7GzO0sIag LH4w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id e21si14763167ejr.246.2021.06.08.06.21.11; Tue, 08 Jun 2021 06:21:35 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232977AbhFHNUk (ORCPT + 99 others); Tue, 8 Jun 2021 09:20:40 -0400 Received: from mga01.intel.com ([192.55.52.88]:2174 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232916AbhFHNU2 (ORCPT ); Tue, 8 Jun 2021 09:20:28 -0400 IronPort-SDR: DVXPmKH8vMgx9UJjscyVFhcy2g0CUZYfhWXy34sZSFQX2X/Z1qFkxL/UXZ0pgA9DkxzClxkJer 4dIpzitiAE6w== X-IronPort-AV: E=McAfee;i="6200,9189,10008"; a="226184001" X-IronPort-AV: E=Sophos;i="5.83,258,1616482800"; d="scan'208";a="226184001" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Jun 2021 06:18:35 -0700 IronPort-SDR: 7JQRozo58WL6GPe4AKfKHK9YOjwgV53n0ap5P0UP42As1RqJ5qgkOx6JetDc0cRlv0EfMA9fY1 xqYUJZBEbBPA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.83,258,1616482800"; d="scan'208";a="552275810" Received: from kuha.fi.intel.com ([10.237.72.162]) by fmsmga001.fm.intel.com with SMTP; 08 Jun 2021 06:18:33 -0700 Received: by kuha.fi.intel.com (sSMTP sendmail emulation); Tue, 08 Jun 2021 16:18:32 +0300 Date: Tue, 8 Jun 2021 16:18:32 +0300 From: Heikki Krogerus To: Sergei Shtylyov Cc: Benjamin Berg , linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [RFC PATCH 2/7] usb: typec: ucsi: Don't stop alt mode registration on busy condition Message-ID: References: <20210607131442.20121-1-heikki.krogerus@linux.intel.com> <20210607131442.20121-3-heikki.krogerus@linux.intel.com> <2f4bf248-cd27-623d-5984-fafa931404fa@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <2f4bf248-cd27-623d-5984-fafa931404fa@gmail.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jun 08, 2021 at 12:31:45PM +0300, Sergei Shtylyov wrote: > Hello! > > On 07.06.2021 16:14, Heikki Krogerus wrote: > > > If the PPM tells it's busy, we can now simply try again. > > > > Signed-off-by: Heikki Krogerus > > --- > > drivers/usb/typec/ucsi/ucsi.c | 5 ++++- > > 1 file changed, 4 insertions(+), 1 deletion(-) > > > > diff --git a/drivers/usb/typec/ucsi/ucsi.c b/drivers/usb/typec/ucsi/ucsi.c > > index 366c8a468bc18..a8e0e31dcddf5 100644 > > --- a/drivers/usb/typec/ucsi/ucsi.c > > +++ b/drivers/usb/typec/ucsi/ucsi.c > > @@ -437,8 +437,11 @@ static int ucsi_register_altmodes(struct ucsi_connector *con, u8 recipient) > > command |= UCSI_GET_ALTMODE_CONNECTOR_NUMBER(con->num); > > command |= UCSI_GET_ALTMODE_OFFSET(i); > > len = ucsi_send_command(con->ucsi, command, alt, sizeof(alt)); > > Could insert your check here, to reduce the indentation... Sure thing. > > - if (len <= 0) > > + if (len <= 0) { > > + if (len == -EBUSY) > > + continue; > > return len; > > + } > > /* > > * This code is requesting one alt mode at a time, but some PPMs thanks, -- heikki