From: Heiner Kallweit <hkallweit1@gmail.com>
To: Jean Delvare <jdelvare@suse.de>
Cc: Mika Westerberg <mika.westerberg@linux.intel.com>,
linux-i2c@vger.kernel.org
Subject: Re: [PATCH 10/10] i2c: i801: Improve handling platform data for tco device
Date: Thu, 5 Aug 2021 21:44:50 +0200 [thread overview]
Message-ID: <09238749-cc4b-a689-b87f-affc95ee0bfe@gmail.com> (raw)
In-Reply-To: <20210805203230.35058c09@endymion>
On 05.08.2021 20:32, Jean Delvare wrote:
> On Sun, 01 Aug 2021 16:24:30 +0200, Heiner Kallweit wrote:
>> The platform data structures are used in the respective i801_add_tco
>> functions only. Therefore we can make the definitions local to these
>> functions.
>>
>> Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
>> ---
>> drivers/i2c/busses/i2c-i801.c | 27 ++++++++++++---------------
>> 1 file changed, 12 insertions(+), 15 deletions(-)
>>
>> diff --git a/drivers/i2c/busses/i2c-i801.c b/drivers/i2c/busses/i2c-i801.c
>> index 1ca92a1e0..64217479a 100644
>> --- a/drivers/i2c/busses/i2c-i801.c
>> +++ b/drivers/i2c/busses/i2c-i801.c
>> @@ -1464,15 +1464,14 @@ static inline unsigned int i801_get_adapter_class(struct i801_priv *priv)
>> }
>> #endif
>>
>> -static const struct itco_wdt_platform_data spt_tco_platform_data = {
>> - .name = "Intel PCH",
>> - .version = 4,
>> -};
>> -
>> static struct platform_device *
>> i801_add_tco_spt(struct i801_priv *priv, struct pci_dev *pci_dev,
>> struct resource *tco_res)
>> {
>> + static const struct itco_wdt_platform_data pldata = {
>> + .name = "Intel PCH",
>> + .version = 4,
>> + };
>> static DEFINE_MUTEX(p2sb_mutex);
>> struct resource *res;
>> unsigned int devfn;
>> @@ -1516,22 +1515,20 @@ i801_add_tco_spt(struct i801_priv *priv, struct pci_dev *pci_dev,
>> res->flags = IORESOURCE_MEM;
>>
>> return platform_device_register_resndata(&pci_dev->dev, "iTCO_wdt", -1,
>> - tco_res, 2, &spt_tco_platform_data,
>> - sizeof(spt_tco_platform_data));
>> + tco_res, 2, &pldata, sizeof(pldata));
>> }
>>
>> -static const struct itco_wdt_platform_data cnl_tco_platform_data = {
>> - .name = "Intel PCH",
>> - .version = 6,
>> -};
>> -
>> static struct platform_device *
>> i801_add_tco_cnl(struct i801_priv *priv, struct pci_dev *pci_dev,
>> struct resource *tco_res)
>> {
>> - return platform_device_register_resndata(&pci_dev->dev,
>> - "iTCO_wdt", -1, tco_res, 1, &cnl_tco_platform_data,
>> - sizeof(cnl_tco_platform_data));
>> + static const struct itco_wdt_platform_data pldata = {
>> + .name = "Intel PCH",
>> + .version = 6,
>> + };
>> +
>> + return platform_device_register_resndata(&pci_dev->dev, "iTCO_wdt", -1,
>> + tco_res, 1, &pldata, sizeof(pldata));
>> }
>>
>> static void i801_add_tco(struct i801_priv *priv)
>
> I don't really care either way, to be honest. But fine with me.
>
To explain the motivation: I try to restrict visibility of a variable as much
as possible. This reduces risk of misuse / mistakes / name collisions.
> Reviewed-by: Jean Delvare <jdelvare@suse.de>
>
prev parent reply other threads:[~2021-08-05 20:06 UTC|newest]
Thread overview: 43+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-08-01 14:15 [PATCH 00/10] i2c: i801: Series with improvements Heiner Kallweit
2021-08-01 14:16 ` [PATCH 01/10] i2c: i801: Don't call pm_runtime_allow Heiner Kallweit
2021-08-02 12:53 ` Jean Delvare
2021-08-02 16:31 ` Heiner Kallweit
2021-08-04 13:36 ` Jarkko Nikula
2021-08-04 14:06 ` Rafael J. Wysocki
2021-08-04 19:02 ` Heiner Kallweit
2021-08-05 8:31 ` Jean Delvare
2021-08-06 14:11 ` Rafael J. Wysocki
2021-08-06 13:52 ` Rafael J. Wysocki
2021-08-06 18:34 ` Heiner Kallweit
2021-08-01 14:17 ` [PATCH 02/10] i2c: i801: Improve disabling runtime pm Heiner Kallweit
2021-08-05 8:39 ` Jean Delvare
2021-08-01 14:18 ` [PATCH 03/10] i2c: i801: Make p2sb_spinlock a mutex Heiner Kallweit
2021-08-05 8:49 ` Jean Delvare
2021-08-05 12:19 ` Mika Westerberg
2021-08-01 14:19 ` [PATCH 04/10] i2c: i801: Remove not needed debug message Heiner Kallweit
2021-08-05 8:53 ` Jean Delvare
2021-08-01 14:20 ` [PATCH 05/10] i2c: i801: Improve is_dell_system_with_lis3lv02d Heiner Kallweit
2021-08-05 9:51 ` Jean Delvare
2021-08-05 19:11 ` Pali Rohár
2021-08-05 19:42 ` Heiner Kallweit
2021-08-05 23:08 ` Pali Rohár
2021-08-06 9:55 ` Jean Delvare
2021-08-06 10:47 ` Pali Rohár
2021-08-06 11:26 ` Jean Delvare
2021-08-01 14:21 ` [PATCH 06/10] i2c: i801: Remove not needed check for PCI_COMMAND_INTX_DISABLE Heiner Kallweit
2021-08-05 10:41 ` Jean Delvare
2021-08-05 20:04 ` Heiner Kallweit
2021-08-06 8:46 ` Jean Delvare
2021-08-01 14:21 ` [PATCH 07/10] i2c: i801: Improve i801_acpi_probe/remove functions Heiner Kallweit
2021-08-05 13:38 ` Jean Delvare
2021-08-05 14:24 ` Mika Westerberg
2021-08-01 14:22 ` [PATCH 08/10] i2c: i801: Improve i801_add_mux Heiner Kallweit
2021-08-05 13:43 ` Jean Delvare
2021-08-01 14:23 ` [PATCH 09/10] i2c: i801: Improve register_dell_lis3lv02d_i2c_device Heiner Kallweit
2021-08-05 14:23 ` Jean Delvare
2021-08-06 20:49 ` Heiner Kallweit
2021-08-09 13:33 ` Jean Delvare
2021-08-09 19:11 ` Heiner Kallweit
2021-08-01 14:24 ` [PATCH 10/10] i2c: i801: Improve handling platform data for tco device Heiner Kallweit
2021-08-05 18:32 ` Jean Delvare
2021-08-05 19:44 ` Heiner Kallweit [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=09238749-cc4b-a689-b87f-affc95ee0bfe@gmail.com \
--to=hkallweit1@gmail.com \
--cc=jdelvare@suse.de \
--cc=linux-i2c@vger.kernel.org \
--cc=mika.westerberg@linux.intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox