From mboxrd@z Thu Jan 1 00:00:00 1970 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 43F5D17EF for ; Fri, 30 Jun 2023 04:54:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7D53AC433C8; Fri, 30 Jun 2023 04:54:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1688100880; bh=eoliOSaKGQAolA79oDzqjjwO5r3sAUMUdDNg2GHu2Sc=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=lOgRhFl+3XlQKNPz+wz2Y0Zk1Jc0K6SgOMpaMVUVPhozQ5IJ0CPRfqEAiwM7/aZO9 sHVoCmMPFrjJqYKbraSY6Hm5xBNJV3Cw9Z2dYN3f4VskOIiH+yJiRxBbuGRv21FFIJ gVSnKg4hgIEvyjSaXj1rjHlNRUCtXB+64Q5jPL0hS1wsL0KmEcv7KgtFl1k+tL9xM4 Upf5xZkvAANTxVOGr6yzcKE1FJcE+luSmkac+MyDXiFNJg81qoTJg9LsCn+QmuBP+F pKO081uOX3GYXnrRfiml4s3wVNMOophB/9dKRoQtC+QbYmsJRJ9JuSV8QQDF7QXGGQ 0Kk0F6mgp7slA== Date: Fri, 30 Jun 2023 12:54:37 +0800 From: Tzung-Bi Shih To: Uwe =?iso-8859-1?Q?Kleine-K=F6nig?= Cc: Thierry Reding , Benson Leung , Guenter Roeck , linux-pwm@vger.kernel.org, chrome-platform@lists.linux.dev, kernel@pengutronix.de Subject: Re: [PATCH 7/8] pwm: cros-ec: Put per channel data into driver data Message-ID: References: <20230629094839.757092-1-u.kleine-koenig@pengutronix.de> <20230629094839.757092-8-u.kleine-koenig@pengutronix.de> Precedence: bulk X-Mailing-List: chrome-platform@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20230629094839.757092-8-u.kleine-koenig@pengutronix.de> On Thu, Jun 29, 2023 at 11:48:38AM +0200, Uwe Kleine-König wrote: > Instead of an allocation of a single u16 per channel, allocate them all > in a single chunk which greatly reduces memory fragmentation and also > the overhead to track the allocated memory. Also put the channel data in > driver data where it's cheaper to determine the address (no function > call involved, just a trivial pointer addition). > > This also allows to get rid of the request and free callbacks. > > The only cost is that the channel data is allocated early, and even for > unused channels. > > Signed-off-by: Uwe Kleine-König With comments addressed below: Reviewed-by: Tzung-Bi Shih > @@ -27,6 +27,7 @@ struct cros_ec_pwm_device { > struct cros_ec_device *ec; > struct pwm_chip chip; > bool use_pwm_type; > + struct cros_ec_pwm *channel; Please update the kernel-doc too. Otherwise: $ ./scripts/kernel-doc -none drivers/pwm/pwm-cros-ec.c drivers/pwm/pwm-cros-ec.c:31: warning: Function parameter or member 'channel' not described in 'cros_ec_pwm_device' I have no strong preference: please consider to use `channels` if it makes sense.