Received: by 2002:ab2:3350:0:b0:1f4:6588:b3a7 with SMTP id o16csp1195318lqe; Mon, 8 Apr 2024 01:16:18 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXOpmiWKuJQvU2SSPZidmSjL+ZNHV4ASYlvGaI2N7hDcWDsUmPxa2pksYqOwtssVUX7Nv+fRcKFhPzvsQ+H3wpqHT/gyfvaeZBmAZhk6Q== X-Google-Smtp-Source: AGHT+IGlZDC/xabVf+N6iwby47qjIs10bAcDW3+CgSOul7dVzDZvppfFuHRRJ4KwgBd1Zz8K/ikA X-Received: by 2002:a05:6a21:329c:b0:1a7:3b64:d502 with SMTP id yt28-20020a056a21329c00b001a73b64d502mr10480069pzb.2.1712564178057; Mon, 08 Apr 2024 01:16:18 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712564178; cv=pass; d=google.com; s=arc-20160816; b=boq6qETvvC0QGposNlNCoWMUStfofdREiGy6VBgNnl2UEtgkvbdM5K1aDX4iyiEaHV JDen/SPyjZB/anSHDdAtt7TrqRs68UR1ghHEHA6FeDt7hilV1HxBxWXJh7OUQnf+ogvY YE5uQroh2BOwcVxh3j934cvE2S58FSTEuFjcepRbCQ+rG/R+hF8Ui3hT6DYfmEyTdhcr Vjxl5k7WtirM9XLgaTZPEN03gTWffh/ENsJeNODWa6hhweyZvrOnVII5/BAbjtACz2sh BBjbrCdZIIIitrg0RX3CAIn1vGaQECmt/9QlX+sgSKIZ1xqeLa1r30QbavwNVGrtI4S5 PJvw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=v0KSy0Vitr8mDgD0yGu3/z/70uAMbvkVm8n7OqzuwR4=; fh=FMp0dJvy3u1CKOiQ4WS3w2pFhujHnNWAIIq7IDpk5cI=; b=Jl6dOVpiZ3XfciTyDh6fcEL3/D64YWKWnZiZ1LUMRz4bhNRMMWswmsFGt+OkT8jCxn fMDUGRG9b9PVDrSMX9N7CbHa6HBHye7JDyzlatdTcReZlhCuRtDVyb0xy6wVXAxyMvjK WQJxDZcQNwmTtuqU71sFVPDXd6ObouCTvPU1zLwiOilVixlUlgBun1+BQhlvR/rY2sva vIG/5Y68aNhh3qPlyzv/H7YFnc3UvUEPTBcsNjYcy3Amkan6dTiIFkZrgpCG3gaZJFif mxyvc5lo8iSpYuByo+u5yUYbnmPBgHwVzHeh9tNG3J1IyiqDZToS2d8Q9VLAN1KmVjlL U0jw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=mdzQmQxM; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-135014-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-135014-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id q22-20020a62e116000000b006ece7b17b47si5823031pfh.301.2024.04.08.01.16.17 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 08 Apr 2024 01:16:18 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-135014-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=mdzQmQxM; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-135014-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-135014-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=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 sy.mirrors.kernel.org (Postfix) with ESMTPS id 35410B20E47 for ; Mon, 8 Apr 2024 08:14:51 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 597DB364AA; Mon, 8 Apr 2024 08:13:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="mdzQmQxM" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7506B3BBC4; Mon, 8 Apr 2024 08:13:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712564013; cv=none; b=OlLyDbj6j5vJcZULKJEOSSRTj7jFZNvwhB1EtprQkcO2GVg7DCzlwKGeVbGnebkQ58jX9V4tMNWU72FLe6kIgTJb9syNKNXnPCj1pupRTmFvPWej/YphW3c3h2lUKRA0pamrIEhtMx45yomzqMuDfoS8Zqrshw9M60WD7toRsF0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712564013; c=relaxed/simple; bh=WEeMAl5Iqj9tc9Ix7uKHT60HGpMM9PPE3v/6L9yJzao=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=pBHhzZh9lZ2loQLnAFwo8aREkm+eZ1JZH5vOdkvaCqfehGcGRHRHVfmy2dGuX6D9n6DziAHvfYqgHuSZxF1FYGhccmIT63bhHhW+dRmcvnbxz8oSMtmPsMgXaZNIcn0s/E4kXxA1C7ZyNNogFDS8GiyxFcHWcwbECzMbFD79fyY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=mdzQmQxM; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 98782C433C7; Mon, 8 Apr 2024 08:13:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1712564013; bh=WEeMAl5Iqj9tc9Ix7uKHT60HGpMM9PPE3v/6L9yJzao=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=mdzQmQxMMKcFpmq+QHRoh7bB4ojP9CvdolrCbac8NlQjgC0AgDFJKDy6I8NTOM9Ph oUNcpZh/iWSbpVTpwPiSfdyKoxUhOLLXY2/m3KMRwOzqc3K1eqmz2S5B9WEoAKohlw 4lv29wk/bZKGvsC2eZTTB0c9lSBETOZX+oXTTFwa8tmaceY22/VbShFETOtZOoUEgw tHfutXUmKc+Nis+CJ1yg0tcvs23id8XqnrHGFbftn4BQJk6sIP+kyAakKX8/8NONlw 5WxBkjgKBighBPwJ9MxymQ3uB1bliUMxGaHW4/ie98whDPhx+uZG59Up8asGN2FvIv 0IGDbJ2X0m8qA== Date: Mon, 8 Apr 2024 16:13:29 +0800 From: Tzung-Bi Shih To: Pavan Holla Cc: Greg Kroah-Hartman , Heikki Krogerus , Benson Leung , Guenter Roeck , linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org, Abhishek Pandit-Subedi , chrome-platform@lists.linux.dev Subject: Re: [PATCH v3 2/2] usb: typec: ucsi: Implement ChromeOS UCSI driver Message-ID: References: <20240403-public-ucsi-h-v3-0-f848e18c8ed2@chromium.org> <20240403-public-ucsi-h-v3-2-f848e18c8ed2@chromium.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240403-public-ucsi-h-v3-2-f848e18c8ed2@chromium.org> On Wed, Apr 03, 2024 at 06:05:22PM +0000, Pavan Holla wrote: > Implementation of a UCSI transport driver for ChromeOS. > This driver will be loaded if the ChromeOS EC implements a PPM. How this driver get probed? From drivers/mfd/cros_ec_dev.c? If so, there is no "cros-ec-ucsi" in the MFD driver yet. > diff --git a/drivers/usb/typec/ucsi/cros_ec_ucsi.c b/drivers/usb/typec/ucsi/cros_ec_ucsi.c > [...] > +static int cros_ucsi_async_write(struct ucsi *ucsi, unsigned int offset, > + const void *val, size_t val_len) > +{ > + struct cros_ucsi_data *udata = ucsi_get_drvdata(ucsi); > + uint8_t ec_buffer[MAX_EC_DATA_SIZE + sizeof(struct ec_params_ucsi_ppm_set)]; > + struct ec_params_ucsi_ppm_set *req = (struct ec_params_ucsi_ppm_set *)ec_buffer; > + int ret = 0; The initialization is redundant. `ret` will be overridden soon. > + if (val_len > MAX_EC_DATA_SIZE) { > + dev_err(udata->dev, "Can't write %zu bytes. Too big.", val_len); > + return -EINVAL; > + } > + > + memset(req, 0, sizeof(ec_buffer)); The `memset` is redundant. > + req->offset = offset; > + memcpy(req->data, val, val_len); > + ret = cros_ec_cmd(udata->ec, 0, EC_CMD_UCSI_PPM_SET, > + req, sizeof(struct ec_params_ucsi_ppm_set) + val_len, NULL, 0); `sizeof(*req)`. > +static int cros_ucsi_probe(struct platform_device *pdev) > +{ > + struct device *dev = &pdev->dev; > [...] > + udata->ucsi = ucsi_create(udata->dev, &cros_ucsi_ops); `dev`. > [...] > +static const struct platform_device_id cros_ec_ucsi_id[] = { To be consistent with other symbols, consider either: - s/cros_ec_/cros_/ for the symbol. or - s/cros_ucsi_/cros_ec_ucsi_/g for echoing the file name. > + { "cros-ec-ucsi"}, The driver has declared DRV_NAME, use it. `{ DRV_NAME, 0 },`. > + {} > +}; > +MODULE_DEVICE_TABLE(platform, cros_ec_ucsi_id); Ditto. > +static struct platform_driver cros_ucsi_driver = { > + .driver = { > + .name = DRV_NAME, > + .pm = &cros_ucsi_pm_ops, > + }, > + .id_table = cros_ec_ucsi_id, Ditto.