Received: by 2002:ab2:620c:0:b0:1ef:ffd0:ce49 with SMTP id o12csp886896lqt; Tue, 19 Mar 2024 06:59:19 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXPPW3BmaByjkeb4hZdFUls+BC5t11PfDpKztQKBOdpgznU4NWgVd5WXHxWfqlBwmjKBEAzt1BvbwXr+LiVeUzThD4u/9U2m4MaMDYEoQ== X-Google-Smtp-Source: AGHT+IEjuojbpupcIHKSzRvkd2ydvnl3V8s6OsmmFcKEiQfuw3wMKDitPVcPR4oWmHvt7BbAhVUV X-Received: by 2002:a25:b2a2:0:b0:dc6:dc58:8785 with SMTP id k34-20020a25b2a2000000b00dc6dc588785mr10430958ybj.62.1710856759007; Tue, 19 Mar 2024 06:59:19 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1710856758; cv=pass; d=google.com; s=arc-20160816; b=s1plzlePS45vm2q+dSPX/EZIAv7yqJXcEGXB4uyrffXWoufmkkMQmpaxqYpj8AQIVP 4IATBIti62AwbBnmVquTqFTHpqbpz6cR4uQL3JNuIJ2t1DvghR83Yapn8qPNv6yM4gmQ 88nXFkSLWSPZ+AP6MMIv6E2wvXZNigooudQ6Dcw/YNZuCBUZzwuDEcscxuOjwHZbJ8n+ xTGblKguz91/0VxPzBIFTyHlaLQURC1sKAmioKlK/AhMnE009NhBL78K9aoleT9aRp8R qyEbZcqUib3coPFORKRPPrbcjQg8IkPKgHnAQpJo4ZnPqOBRIx/Dvj/iL2Mo2o2VYnkW drMQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:autocrypt:from:references:cc :to:content-language:subject:user-agent:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:date:message-id :sender:dkim-signature; bh=hs18eHNDInn0iqGJWsnk8ODqQ1LsXwtDyJ+PpnjaiKg=; fh=p44jU40oF5BHQnjJ043nD+rlxYRyVXHnuApnQ8m26Gg=; b=cSKjQRpezKxx/m2DeU7xECgxSSkw5Bb+rIe+Z0sokvdCCVo5fiy+jP9UraKtJWXATW B1vwmvh39gq7H0sF18tIIIilpRN+Vg3sbYeoSEKuX/WBgjlSNMYyPtQ7v0y0fqFGY3B5 meDSfkS8PeUBcu/1dMc1Fl7Saj8WKYRMw2sLxVjnMveEGCPP9B0d0H8QJhGVOZEfboTb lOijQR7xTPRTrTu3fXqASPxbOOyfWtFtJFyzVYO3JP02Lbq+6PkGwU5WHoPkl13QawCt G4GzQMxbVhxk2rl5zZwWuBbgTYAGFv5mAe3JAC8SuvF1jUOHeRkxZsePD6lLUAXhj1dD OcBg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=ZE75yvUo; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-107619-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-107619-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id b16-20020ac85bd0000000b00430e27f26eesi683763qtb.750.2024.03.19.06.59.18 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Mar 2024 06:59:18 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-107619-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=ZE75yvUo; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-107619-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-107619-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id A80141C2242C for ; Tue, 19 Mar 2024 13:59:18 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 387EA823B1; Tue, 19 Mar 2024 13:58:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="ZE75yvUo" Received: from mail-oo1-f45.google.com (mail-oo1-f45.google.com [209.85.161.45]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7C6C081725; Tue, 19 Mar 2024 13:58:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.161.45 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710856714; cv=none; b=sHWduXbDEQxAGsLF07wc1OtjdOWgbKbp4LqnKoIyYZ3XVYDAYLIiYy5T2L9w1PZE9P5SENAq1iXQDDDNBl5csK1mfuyY8nMHRK0vICafyXQM5ud422wUH4QFjJiog6fDwg43qEzZHT1Jfn9oBXCkWafZCY2Y+pjJc4R++PPYxac= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710856714; c=relaxed/simple; bh=U9hpVncJzy2lA3W/C1VFV8DykwmuLIUpD9mFaLxoWNA=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=h3kcXeXeDDoKgJGEPrfrZJvCeushPzDSIY/TvJoF/L9Xc0/E0l8Lh1mgLSzCwPWkUFLCoxi3zDSHqGbrn5pzN2EQ3vTxkf/MgsXeKCSj8soheOXHMyDU9FgOKHovosx5G1R+fOaap010XOHrqaf3+mB6tCkQ8FMDWyff7x+pGco= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=roeck-us.net; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=ZE75yvUo; arc=none smtp.client-ip=209.85.161.45 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=roeck-us.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-oo1-f45.google.com with SMTP id 006d021491bc7-5a496fde460so1710795eaf.1; Tue, 19 Mar 2024 06:58:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1710856711; x=1711461511; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:autocrypt:from:references:cc :to:content-language:subject:user-agent:mime-version:date:message-id :sender:from:to:cc:subject:date:message-id:reply-to; bh=hs18eHNDInn0iqGJWsnk8ODqQ1LsXwtDyJ+PpnjaiKg=; b=ZE75yvUor2DH/JQOcd+2/SZgXiamnl2mhz8eO4XFbQ/q3P7TU1cNFf8reeRL9fFdzA biavkHU+9/bkfiKA52XtaLRmtOkO2dy/1gl4enYdjzaMeJ5Y9fbNTvnuTJEkGG+rNa2S C8bU+W7bxfddBKfslpFWT9fheE6LNaPYilmM+JGVwZjGL49JYH86zXcabPzBph2DOEqr L3K9CPFtR234reMvHYZMTRLfxTffG+Yk1k880EK+yVY+ugP4Yn+oSpeOK3jvXez6dHPu KLjafw8BZBaqATQgVXp6MCJrrZwwU/FlcQ5AR9IxEoKcUn3SQc2NSq/5Djfn7AzTbxsJ eouA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710856711; x=1711461511; h=content-transfer-encoding:in-reply-to:autocrypt:from:references:cc :to:content-language:subject:user-agent:mime-version:date:message-id :sender:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=hs18eHNDInn0iqGJWsnk8ODqQ1LsXwtDyJ+PpnjaiKg=; b=fazS9RNY5zSm99tLhTj+bBePZpQzfHmXzqxN4QkplHgi8sNshiEcGYi0/10ER+c/zb Da2ApvjJwWUT4IXg1AjgNk8NhM5pIoomd/0pPBJbqR65LvBuSw1akLqye36na9SxFTyx d1GOwMIUqVEsWElZDzVbWIQfCvC29Gdv8PCR4OaRU438ASGSvCjCXHWXxBREbmTkWviJ m3JeQ+3BEwM9K/MExJbxW0Xq9p5VMQdFpZ9RTQriIQLFfRmNwQGdVon6ngY2+YafymRB mFiiVj0nPvtF31N+8yrySW8TV9W4jfyeffhAgQJ3JTZiTbRvM1FvIOxA50h18ahSEuVI HivA== X-Forwarded-Encrypted: i=1; AJvYcCVPYxy2CUjMSC5q3Ji4YzJDzqNNxHjY08RXRhStj3hhvEqqb8yZnuDUPNQn9l/ci10sjWb+z6kFDWBjy4s5zlFmDdyALMEWfJreDK5gHe7z93wdfblk+yWf4+C8P2MSmDlFHNfI6gnV4ohDpVd1xMr7DhdDCX6zFkGsfZ5ouDyW X-Gm-Message-State: AOJu0YzsKLox+5ogwC6mvqsN+l+Tn+Y2uZp5YjOGHxLvLeQKjaGxH/MX inerxqaaTEvZbhpU6YgUJtWXR9b19Gdh4wus1v3C1P5n3iSAfkA4 X-Received: by 2002:a05:6871:28f:b0:222:7193:f7cb with SMTP id i15-20020a056871028f00b002227193f7cbmr16694360oae.26.1710856711548; Tue, 19 Mar 2024 06:58:31 -0700 (PDT) Received: from ?IPV6:2600:1700:e321:62f0:329c:23ff:fee3:9d7c? ([2600:1700:e321:62f0:329c:23ff:fee3:9d7c]) by smtp.gmail.com with ESMTPSA id o14-20020a63fb0e000000b005cfc1015befsm9060642pgh.89.2024.03.19.06.58.30 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 19 Mar 2024 06:58:30 -0700 (PDT) Sender: Guenter Roeck Message-ID: Date: Tue, 19 Mar 2024 06:58:29 -0700 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v1] usb: typec: Return size of buffer if pd_set operation succeeds Content-Language: en-US To: Kyle Tso , heikki.krogerus@linux.intel.com, gregkh@linuxfoundation.org Cc: badhri@google.com, linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org, stable@vger.kernel.org References: <20240319074309.3306579-1-kyletso@google.com> From: Guenter Roeck Autocrypt: addr=linux@roeck-us.net; keydata= xsFNBE6H1WcBEACu6jIcw5kZ5dGeJ7E7B2uweQR/4FGxH10/H1O1+ApmcQ9i87XdZQiB9cpN RYHA7RCEK2dh6dDccykQk3bC90xXMPg+O3R+C/SkwcnUak1UZaeK/SwQbq/t0tkMzYDRxfJ7 nyFiKxUehbNF3r9qlJgPqONwX5vJy4/GvDHdddSCxV41P/ejsZ8PykxyJs98UWhF54tGRWFl 7i1xvaDB9lN5WTLRKSO7wICuLiSz5WZHXMkyF4d+/O5ll7yz/o/JxK5vO/sduYDIlFTvBZDh gzaEtNf5tQjsjG4io8E0Yq0ViobLkS2RTNZT8ICq/Jmvl0SpbHRvYwa2DhNsK0YjHFQBB0FX IdhdUEzNefcNcYvqigJpdICoP2e4yJSyflHFO4dr0OrdnGLe1Zi/8Xo/2+M1dSSEt196rXaC kwu2KgIgmkRBb3cp2vIBBIIowU8W3qC1+w+RdMUrZxKGWJ3juwcgveJlzMpMZNyM1jobSXZ0 VHGMNJ3MwXlrEFPXaYJgibcg6brM6wGfX/LBvc/haWw4yO24lT5eitm4UBdIy9pKkKmHHh7s jfZJkB5fWKVdoCv/omy6UyH6ykLOPFugl+hVL2Prf8xrXuZe1CMS7ID9Lc8FaL1ROIN/W8Vk BIsJMaWOhks//7d92Uf3EArDlDShwR2+D+AMon8NULuLBHiEU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KFOkynOs3pVbcbq1pxbhk3TRWCGRU5JolI4ohy/7JV1TVbjiDI HP/aVnm6NC8of26P40Pg8EdAhajZnHHjA7FrJXsy3cyIGqvg9os4rNkUWmrCfLLsZDHD8FnU mDW4+i+XlNFUPUYMrIKi9joBhu18ssf5i5Q= In-Reply-To: <20240319074309.3306579-1-kyletso@google.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 3/19/24 00:43, Kyle Tso wrote: > The attribute writing should return the number of bytes used from the > buffer on success. > > Fixes: a7cff92f0635 ("usb: typec: USB Power Delivery helpers for ports and partners") > Cc: stable@vger.kernel.org > Signed-off-by: Kyle Tso Reviewed-by: Guenter Roeck > --- > drivers/usb/typec/class.c | 7 ++++++- > 1 file changed, 6 insertions(+), 1 deletion(-) > > diff --git a/drivers/usb/typec/class.c b/drivers/usb/typec/class.c > index 389c7f0b8d93..9610e647a8d4 100644 > --- a/drivers/usb/typec/class.c > +++ b/drivers/usb/typec/class.c > @@ -1310,6 +1310,7 @@ static ssize_t select_usb_power_delivery_store(struct device *dev, > { > struct typec_port *port = to_typec_port(dev); > struct usb_power_delivery *pd; > + int ret; > > if (!port->ops || !port->ops->pd_set) > return -EOPNOTSUPP; > @@ -1318,7 +1319,11 @@ static ssize_t select_usb_power_delivery_store(struct device *dev, > if (!pd) > return -EINVAL; > > - return port->ops->pd_set(port, pd); > + ret = port->ops->pd_set(port, pd); > + if (ret) > + return ret; > + > + return size; > } > > static ssize_t select_usb_power_delivery_show(struct device *dev,