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 338DAEB64DA for ; Wed, 19 Jul 2023 14:55:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229942AbjGSOzf (ORCPT ); Wed, 19 Jul 2023 10:55:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46574 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231651AbjGSOze (ORCPT ); Wed, 19 Jul 2023 10:55:34 -0400 Received: from mail.3ffe.de (0001.3ffe.de [IPv6:2a01:4f8:c0c:9d57::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 715111711 for ; Wed, 19 Jul 2023 07:55:33 -0700 (PDT) Received: from 3ffe.de (0001.3ffe.de [IPv6:2a01:4f8:c0c:9d57::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mail.3ffe.de (Postfix) with ESMTPSA id D8AFFA4E; Wed, 19 Jul 2023 16:55:31 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=walle.cc; s=mail2022082101; t=1689778531; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=/BezhgEZ3QJmVt+9N/3+8JtxlC8yi1o/bzbB/y9p854=; b=S0oemUShZVYBo3j+OmsIkSWbQf1gMAFfwOEE8uTIo5ZxdxYzQPElZBbGfdUT9aSsBja8WI 85sh+hVmWwKbDSFY16+qbEYECosDIVyOsDe/543G1EGV8FTEJ6hbIbvV73b7PErV82qyKP aOQ9UBP/mlazRMo3wIx00dLruq6gCgaUED8RAWZp8iirbs1zZOFTjPYSufc0QwrhAvy0tA Ny40c5+3fx38J3dwvv5Ky5apqoPGnCVjbPbIOqQnXJywE3cUghFLVWLO49qNB4H+zaogaj JUmciCObGNc8t3B1fQPnkhpX+FhopVbCXqUaiDBYFgVgXnJDUTh8QMe5U2Ao/Q== MIME-Version: 1.0 Date: Wed, 19 Jul 2023 16:55:31 +0200 From: Michael Walle To: =?UTF-8?Q?Uwe_Kleine-K=C3=B6nig?= Cc: linux-pwm@vger.kernel.org, Thierry Reding , kernel@pengutronix.de Subject: Re: [PATCH 09/10] pwm: sl28cpld: Consistenly name pwm_chip variables "chip" In-Reply-To: <20230719143956.6sv3feiroiwrcosb@pengutronix.de> References: <20230714205623.2496590-1-u.kleine-koenig@pengutronix.de> <20230714205623.2496590-10-u.kleine-koenig@pengutronix.de> <20230719143956.6sv3feiroiwrcosb@pengutronix.de> Message-ID: <9cb1b141e206dd9afd215d8886d688d9@walle.cc> X-Sender: michael@walle.cc Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-pwm@vger.kernel.org Hi, >> I'd expect it to be: >> #define sl28cpld_pwm_from_chip(_chip) \ >> container_of(_chip, struct sl28cpld_pwm, chip) > > Indeed, that's bogus. My preference would be to make this a static > inline, i.e. > > diff --git a/drivers/pwm/pwm-sl28cpld.c b/drivers/pwm/pwm-sl28cpld.c > index 98b0024f9658..c789e934671e 100644 > --- a/drivers/pwm/pwm-sl28cpld.c > +++ b/drivers/pwm/pwm-sl28cpld.c > @@ -84,8 +84,11 @@ struct sl28cpld_pwm { > struct regmap *regmap; > u32 offset; > }; > -#define sl28cpld_pwm_from_chip(chip) \ > - container_of(chip, struct sl28cpld_pwm, chip) > + > +static inline struct sl28cpld_pwm *sl28cpld_pwm_from_chip(struct > pwm_chip *chip) > +{ > + return container_of(chip, struct sl28cpld_pwm, chip); > +} > > static int sl28cpld_pwm_get_state(struct pwm_chip *chip, > struct pwm_device *pwm, > > but I can live with _chip, too. I don't have a strong preference. Looks like most drivers use the inline. Go with that :) -michael