Received: by 2002:a05:7412:9c07:b0:fa:6e18:a558 with SMTP id lr7csp786557rdb; Sun, 28 Jan 2024 08:55:21 -0800 (PST) X-Google-Smtp-Source: AGHT+IGzty5Uazf8wTopTVA6nNE3PCY/zTf+AIVdXmZKIlX70y3bq5RJOKX1UDJLfwIKURUgUYvI X-Received: by 2002:a2e:855a:0:b0:2cd:fb19:8758 with SMTP id u26-20020a2e855a000000b002cdfb198758mr2270139ljj.32.1706460921157; Sun, 28 Jan 2024 08:55:21 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706460921; cv=pass; d=google.com; s=arc-20160816; b=BESKPBC0n0fqnO1PeD9HJwSFT2AXMrZ7b7aDaJF/rzOa5H2JCkxHMYp/z8P2A2o3X8 XzLbIV/9sa84ToTrNSU3jnLJA1mExip2X7/bx+uRdbPon1Y48RCiye5EU8aClZ/PW2nd YymJyQYeX/U26Y7Ex/sESwT/G2zZGJ0GcH0HIkCYOyGaBKoK5zeOeYCJfBADdr3Y4nK/ WhWphvXkw4zn0XrJnlVUVZjuiLHa4MJZQNiFCUZ/fDGikkS1UCxd1kjhoz/UW01gkAR/ rfEw7PS/o4Q4wYGwRe1T+ecV8lzAhEGLanHDudu3c6ba1ZlPKro3D9wC8ca7GqO4aeu1 o4+w== 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; bh=ePEkKyOt7jxXQDmOkEB2hzJDhRXETduXFYQHghcfLkY=; fh=BlMC0ufJ6Ga8ffhbe4cHMKIcvQMW5jjy/PaKfi4qOGE=; b=orhH4iqH+D0FVW3wTl9RVbHQZLRWh0gAoqmhvRwKStGAowUoBTNGldxpZ67d3m2fpX yA2+WOzDF+g88XiwBD4QBt8NAdAKCnY4NY/OItslULpzkCO9Ha8hSlBSwP0Gu659SSVK gjB/SEo40NB/Iu6V6YQCickHAZojSut9zTNHCVDRu8Dv3NeKn3Ajs5iE51cOjUstFRWH Ilnk6Vcq2pxXjrIZy0XSeYLJxvpsFFT1isOh1/QdzM4wGm7VxHfx/eznPTTHUd0OHKPM Tb9HGtVcJbCgSsFFBRqcKEBJFTffORejoewF/77XTxe/AoAgF39f3a7pTIZNv4RGc97u NSUA== ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=pengutronix.de); spf=pass (google.com: domain of linux-kernel+bounces-41837-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-41837-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id ig2-20020a056402458200b0055ed779088asi969659edb.143.2024.01.28.08.55.21 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 28 Jan 2024 08:55:21 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-41837-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=pengutronix.de); spf=pass (google.com: domain of linux-kernel+bounces-41837-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-41837-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 am.mirrors.kernel.org (Postfix) with ESMTPS id CD42C1F21B02 for ; Sun, 28 Jan 2024 16:55:20 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id AE55328E34; Sun, 28 Jan 2024 16:55:14 +0000 (UTC) Received: from metis.whiteo.stw.pengutronix.de (metis.whiteo.stw.pengutronix.de [185.203.201.7]) (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 210C223745 for ; Sun, 28 Jan 2024 16:55:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.203.201.7 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706460914; cv=none; b=qKPWxw6QDT0fV9oV6poh5vzFI7gqyNguKaExja4l4brld0W2s+3VGhmk+9btuuxmfw1dZfLNqdip3geJqLKXYTgdjLzfBmRpQG/6sJrWY8AkCf9kUsNcqYxXRWxmYz0EH0RwG1/8Z0bsK1UJWteIXG22rl5dmJBydsQ9q3mR6iI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706460914; c=relaxed/simple; bh=TnCEqMjkzWgPyIi20zQerIZSNZJKpHx0FIMN+HYOeVM=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=fg18NNCR/VF7/umawEZzamhSqxXlN2n+yUzT0w2bS75o+tK90cSEIb+NsbWad60cioL0Qx7a/pTIwEPymfrblf1fErtPQHEvg+ryfpWRdRfVnUy7HgNV3earPdUzntcfQfEckkj5IwEqZvLIa149lgKgWp/32dfWpFEVR9XZVXw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=pengutronix.de; spf=pass smtp.mailfrom=pengutronix.de; arc=none smtp.client-ip=185.203.201.7 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=pengutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pengutronix.de Received: from drehscheibe.grey.stw.pengutronix.de ([2a0a:edc0:0:c01:1d::a2]) by metis.whiteo.stw.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1rU8Qw-00031D-Au; Sun, 28 Jan 2024 17:55:02 +0100 Received: from [2a0a:edc0:0:900:1d::77] (helo=ptz.office.stw.pengutronix.de) by drehscheibe.grey.stw.pengutronix.de with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rU8Qv-002z9K-5g; Sun, 28 Jan 2024 17:55:01 +0100 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.96) (envelope-from ) id 1rU8Qv-00AH2z-0H; Sun, 28 Jan 2024 17:55:01 +0100 Date: Sun, 28 Jan 2024 17:55:00 +0100 From: Uwe =?utf-8?Q?Kleine-K=C3=B6nig?= To: Andy Shevchenko Cc: Raag Jadav , jarkko.nikula@linux.intel.com, mika.westerberg@linux.intel.com, lakshmi.sowjanya.d@intel.com, linux-pwm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v1 3/3] pwm: dwc: use to_pci_dev() helper Message-ID: References: <20240122030238.29437-1-raag.jadav@intel.com> <20240122030238.29437-4-raag.jadav@intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="rfhsoumljfh5ev2l" Content-Disposition: inline In-Reply-To: X-SA-Exim-Connect-IP: 2a0a:edc0:0:c01:1d::a2 X-SA-Exim-Mail-From: ukl@pengutronix.de X-SA-Exim-Scanned: No (on metis.whiteo.stw.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-kernel@vger.kernel.org --rfhsoumljfh5ev2l Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hello, On Sun, Jan 28, 2024 at 04:46:48PM +0200, Andy Shevchenko wrote: > On Mon, Jan 22, 2024 at 08:32:38AM +0530, Raag Jadav wrote: > > Use to_pci_dev() helper to get pci device reference. >=20 > PCI >=20 > ... >=20 > > static int dwc_pwm_suspend(struct device *dev) > > { > > - struct pci_dev *pdev =3D container_of(dev, struct pci_dev, dev); > > + struct pci_dev *pdev =3D to_pci_dev(dev); > > struct dwc_pwm *dwc =3D pci_get_drvdata(pdev); > > int i; > > =20 > > @@ -120,7 +120,7 @@ static int dwc_pwm_suspend(struct device *dev) > > =20 > > static int dwc_pwm_resume(struct device *dev) > > { > > - struct pci_dev *pdev =3D container_of(dev, struct pci_dev, dev); > > + struct pci_dev *pdev =3D to_pci_dev(dev); > > struct dwc_pwm *dwc =3D pci_get_drvdata(pdev); > > int i; >=20 > I don't see how pdev is being used. That said, why dev_get_drvdata() is n= ot > suffice? I would even consider using dev_get_drvdata() a nice cleanup given that pci_get_drvdata() works because dwc_pwm_alloc() called dev_set_drvdata() (and not pci_set_drvdata()). Not so long ago (i.e. before commit a357d1493f0c ("pwm: dwc: Move memory allocation to own function")) the dwc driver was pci only and used pci_set_drvdata(). Then the upside of first converting the struct device to a struct pci_dev was not to hard code knowledge about the implementation of pci_[gs]et_drvdata(). Best regards Uwe --=20 Pengutronix e.K. | Uwe Kleine-K=F6nig | Industrial Linux Solutions | https://www.pengutronix.de/ | --rfhsoumljfh5ev2l Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAABCgAdFiEEP4GsaTp6HlmJrf7Tj4D7WH0S/k4FAmW2huQACgkQj4D7WH0S /k6xAAf9FrXzNIGYd31goHKYoohHhptzWd8EBhHqM1GX6oWyeea03c7SQ3q7aOr0 xEMthrjkaLf5Pqj3xO8okMKcN2dOtFG1Jv5Fx4No6ylh9LNFU5kJwnG8s24a82dV x12AlAfLsd2PpCKxTFgj5ZaadkB0y/Fd9z28yArE5zE2kZgVS4IQaaUZJun8NvxV V56mrHH7jk3qAR4/alfr9nKSNkgEiL1fpjpD22gF1Fh77fn+J6wK4b22xSsqESXL Xg5PHq1uqZwoR++ooGr05Dt5EW3fub8IjKzfSUMSSh76tWy5PL69aFJzbATWHRmM kiyl339nCMNX/y40/FTSqT4KSLMPZQ== =lEBB -----END PGP SIGNATURE----- --rfhsoumljfh5ev2l--