diff mbox series

[3/4] platform/x86/amd/pmc: Remove unnecessary line breaks

Message ID 20250217081720.107719-3-Shyam-sundar.S-k@amd.com (mailing list archive)
State New
Headers show
Series [1/4] platform/x86/amd/pmc: Notify user when platform does not support s0ix transition | expand

Commit Message

Shyam Sundar S K Feb. 17, 2025, 8:17 a.m. UTC
Enhance code readability by fixing line break and blank line
inconsistencies.

Co-developed-by: Sanket Goswami <Sanket.Goswami@amd.com>
Signed-off-by: Sanket Goswami <Sanket.Goswami@amd.com>
Signed-off-by: Shyam Sundar S K <Shyam-sundar.S-k@amd.com>
---
 drivers/platform/x86/amd/pmc/pmc.c | 7 -------
 1 file changed, 7 deletions(-)

Comments

Mario Limonciello Feb. 17, 2025, 3:38 p.m. UTC | #1
On 2/17/2025 02:17, Shyam Sundar S K wrote:
> Enhance code readability by fixing line break and blank line
> inconsistencies.
> 
> Co-developed-by: Sanket Goswami <Sanket.Goswami@amd.com>
> Signed-off-by: Sanket Goswami <Sanket.Goswami@amd.com>
> Signed-off-by: Shyam Sundar S K <Shyam-sundar.S-k@amd.com>
> ---
>   drivers/platform/x86/amd/pmc/pmc.c | 7 -------
>   1 file changed, 7 deletions(-)
> 
> diff --git a/drivers/platform/x86/amd/pmc/pmc.c b/drivers/platform/x86/amd/pmc/pmc.c
> index 742920530987..d80a5b899a1d 100644
> --- a/drivers/platform/x86/amd/pmc/pmc.c
> +++ b/drivers/platform/x86/amd/pmc/pmc.c
> @@ -168,7 +168,6 @@ static int get_metrics_table(struct amd_pmc_dev *pdev, struct smu_metrics *table
>   {
>   	if (!pdev->smu_virt_addr) {
>   		int ret = amd_pmc_setup_smu_logging(pdev);
> -
>   		if (ret)

Does checkpatch like this?

I thought it has checks explicitly for
"Missing a blank line after declarations"

>   			return ret;
>   	}
> @@ -222,7 +221,6 @@ static ssize_t smu_fw_version_show(struct device *d, struct device_attribute *at
>   
>   	if (!dev->major) {
>   		int rc = amd_pmc_get_smu_version(dev);
> -
>   		if (rc)
>   			return rc;
>   	}
> @@ -236,7 +234,6 @@ static ssize_t smu_program_show(struct device *d, struct device_attribute *attr,
>   
>   	if (!dev->major) {
>   		int rc = amd_pmc_get_smu_version(dev);
> -
>   		if (rc)
>   			return rc;
>   	}
> @@ -704,7 +701,6 @@ static int amd_pmc_suspend_handler(struct device *dev)
>   	 */
>   	if (pdev->disable_8042_wakeup && !disable_workarounds) {
>   		int rc = amd_pmc_wa_irq1(pdev);
> -
>   		if (rc) {
>   			dev_err(pdev->dev, "failed to adjust keyboard wakeup: %d\n", rc);
>   			return rc;
> @@ -743,7 +739,6 @@ static int amd_pmc_probe(struct platform_device *pdev)
>   	u32 val;
>   
>   	dev->dev = &pdev->dev;
> -
>   	rdev = pci_get_domain_bus_and_slot(0, 0, PCI_DEVFN(0, 0));
>   	if (!rdev || !pci_match_id(pmc_pci_ids, rdev)) {
>   		err = -ENODEV;
> @@ -751,7 +746,6 @@ static int amd_pmc_probe(struct platform_device *pdev)
>   	}
>   
>   	dev->cpu_id = rdev->device;
> -
>   	if (dev->cpu_id == AMD_CPU_ID_SP || dev->cpu_id == AMD_CPU_ID_SHP) {
>   		dev_warn_once(dev->dev, "S0i3 is not supported on this hardware\n");
>   		err = -ENODEV;
> @@ -767,7 +761,6 @@ static int amd_pmc_probe(struct platform_device *pdev)
>   	}
>   
>   	base_addr_lo = val & AMD_PMC_BASE_ADDR_HI_MASK;
> -
>   	err = amd_smn_read(0, AMD_PMC_BASE_ADDR_HI, &val);
>   	if (err) {
>   		dev_err(dev->dev, "error reading 0x%x\n", AMD_PMC_BASE_ADDR_HI);
Shyam Sundar S K Feb. 18, 2025, 7:08 a.m. UTC | #2
On 2/17/2025 21:08, Mario Limonciello wrote:
> On 2/17/2025 02:17, Shyam Sundar S K wrote:
>> Enhance code readability by fixing line break and blank line
>> inconsistencies.
>>
>> Co-developed-by: Sanket Goswami <Sanket.Goswami@amd.com>
>> Signed-off-by: Sanket Goswami <Sanket.Goswami@amd.com>
>> Signed-off-by: Shyam Sundar S K <Shyam-sundar.S-k@amd.com>
>> ---
>>   drivers/platform/x86/amd/pmc/pmc.c | 7 -------
>>   1 file changed, 7 deletions(-)
>>
>> diff --git a/drivers/platform/x86/amd/pmc/pmc.c b/drivers/platform/
>> x86/amd/pmc/pmc.c
>> index 742920530987..d80a5b899a1d 100644
>> --- a/drivers/platform/x86/amd/pmc/pmc.c
>> +++ b/drivers/platform/x86/amd/pmc/pmc.c
>> @@ -168,7 +168,6 @@ static int get_metrics_table(struct amd_pmc_dev
>> *pdev, struct smu_metrics *table
>>   {
>>       if (!pdev->smu_virt_addr) {
>>           int ret = amd_pmc_setup_smu_logging(pdev);
>> -
>>           if (ret)
> 
> Does checkpatch like this?
> 
> I thought it has checks explicitly for
> "Missing a blank line after declarations"
> 

Not sure what is meant by blank line after declaration in this context.

This change is mid-way of the function.

I did run checkpatch again and did not see any issue.

total: 0 errors, 0 warnings, 0 checks, 49 lines checked

pmc_v1/0003-platform-x86-amd-pmc-Remove-unnecessary-line-breaks.patch
has no obvious style problems and is ready for submission.

Thanks,
Shyam

>>               return ret;
>>       }
>> @@ -222,7 +221,6 @@ static ssize_t smu_fw_version_show(struct device
>> *d, struct device_attribute *at
>>         if (!dev->major) {
>>           int rc = amd_pmc_get_smu_version(dev);
>> -
>>           if (rc)
>>               return rc;
>>       }
>> @@ -236,7 +234,6 @@ static ssize_t smu_program_show(struct device
>> *d, struct device_attribute *attr,
>>         if (!dev->major) {
>>           int rc = amd_pmc_get_smu_version(dev);
>> -
>>           if (rc)
>>               return rc;
>>       }
>> @@ -704,7 +701,6 @@ static int amd_pmc_suspend_handler(struct device
>> *dev)
>>        */
>>       if (pdev->disable_8042_wakeup && !disable_workarounds) {
>>           int rc = amd_pmc_wa_irq1(pdev);
>> -
>>           if (rc) {
>>               dev_err(pdev->dev, "failed to adjust keyboard wakeup:
>> %d\n", rc);
>>               return rc;
>> @@ -743,7 +739,6 @@ static int amd_pmc_probe(struct platform_device
>> *pdev)
>>       u32 val;
>>         dev->dev = &pdev->dev;
>> -
>>       rdev = pci_get_domain_bus_and_slot(0, 0, PCI_DEVFN(0, 0));
>>       if (!rdev || !pci_match_id(pmc_pci_ids, rdev)) {
>>           err = -ENODEV;
>> @@ -751,7 +746,6 @@ static int amd_pmc_probe(struct platform_device
>> *pdev)
>>       }
>>         dev->cpu_id = rdev->device;
>> -
>>       if (dev->cpu_id == AMD_CPU_ID_SP || dev->cpu_id ==
>> AMD_CPU_ID_SHP) {
>>           dev_warn_once(dev->dev, "S0i3 is not supported on this
>> hardware\n");
>>           err = -ENODEV;
>> @@ -767,7 +761,6 @@ static int amd_pmc_probe(struct platform_device
>> *pdev)
>>       }
>>         base_addr_lo = val & AMD_PMC_BASE_ADDR_HI_MASK;
>> -
>>       err = amd_smn_read(0, AMD_PMC_BASE_ADDR_HI, &val);
>>       if (err) {
>>           dev_err(dev->dev, "error reading 0x%x\n",
>> AMD_PMC_BASE_ADDR_HI);
>
Mario Limonciello Feb. 18, 2025, 2:52 p.m. UTC | #3
On 2/18/2025 01:08, Shyam Sundar S K wrote:
> 
> 
> On 2/17/2025 21:08, Mario Limonciello wrote:
>> On 2/17/2025 02:17, Shyam Sundar S K wrote:
>>> Enhance code readability by fixing line break and blank line
>>> inconsistencies.
>>>
>>> Co-developed-by: Sanket Goswami <Sanket.Goswami@amd.com>
>>> Signed-off-by: Sanket Goswami <Sanket.Goswami@amd.com>
>>> Signed-off-by: Shyam Sundar S K <Shyam-sundar.S-k@amd.com>
>>> ---
>>>    drivers/platform/x86/amd/pmc/pmc.c | 7 -------
>>>    1 file changed, 7 deletions(-)
>>>
>>> diff --git a/drivers/platform/x86/amd/pmc/pmc.c b/drivers/platform/
>>> x86/amd/pmc/pmc.c
>>> index 742920530987..d80a5b899a1d 100644
>>> --- a/drivers/platform/x86/amd/pmc/pmc.c
>>> +++ b/drivers/platform/x86/amd/pmc/pmc.c
>>> @@ -168,7 +168,6 @@ static int get_metrics_table(struct amd_pmc_dev
>>> *pdev, struct smu_metrics *table
>>>    {
>>>        if (!pdev->smu_virt_addr) {
>>>            int ret = amd_pmc_setup_smu_logging(pdev);
>>> -
>>>            if (ret)
>>
>> Does checkpatch like this?
>>
>> I thought it has checks explicitly for
>> "Missing a blank line after declarations"
>>
> 
> Not sure what is meant by blank line after declaration in this context.
> 
> This change is mid-way of the function.
> 
> I did run checkpatch again and did not see any issue.
> 
> total: 0 errors, 0 warnings, 0 checks, 49 lines checked
> 
> pmc_v1/0003-platform-x86-amd-pmc-Remove-unnecessary-line-breaks.patch
> has no obvious style problems and is ready for submission.

Here is the specific check I was expecting checkpatch to throw:

https://github.com/torvalds/linux/blob/v6.14-rc3/scripts/checkpatch.pl#L4118

I had "thought" the intent was there was a blank line after declaration 
no matter the scope not just the start of function.

> 
> Thanks,
> Shyam
> 
>>>                return ret;
>>>        }
>>> @@ -222,7 +221,6 @@ static ssize_t smu_fw_version_show(struct device
>>> *d, struct device_attribute *at
>>>          if (!dev->major) {
>>>            int rc = amd_pmc_get_smu_version(dev);
>>> -
>>>            if (rc)
>>>                return rc;
>>>        }
>>> @@ -236,7 +234,6 @@ static ssize_t smu_program_show(struct device
>>> *d, struct device_attribute *attr,
>>>          if (!dev->major) {
>>>            int rc = amd_pmc_get_smu_version(dev);
>>> -
>>>            if (rc)
>>>                return rc;
>>>        }
>>> @@ -704,7 +701,6 @@ static int amd_pmc_suspend_handler(struct device
>>> *dev)
>>>         */
>>>        if (pdev->disable_8042_wakeup && !disable_workarounds) {
>>>            int rc = amd_pmc_wa_irq1(pdev);
>>> -
>>>            if (rc) {
>>>                dev_err(pdev->dev, "failed to adjust keyboard wakeup:
>>> %d\n", rc);
>>>                return rc;
>>> @@ -743,7 +739,6 @@ static int amd_pmc_probe(struct platform_device
>>> *pdev)
>>>        u32 val;
>>>          dev->dev = &pdev->dev;
>>> -
>>>        rdev = pci_get_domain_bus_and_slot(0, 0, PCI_DEVFN(0, 0));
>>>        if (!rdev || !pci_match_id(pmc_pci_ids, rdev)) {
>>>            err = -ENODEV;
>>> @@ -751,7 +746,6 @@ static int amd_pmc_probe(struct platform_device
>>> *pdev)
>>>        }
>>>          dev->cpu_id = rdev->device;
>>> -
>>>        if (dev->cpu_id == AMD_CPU_ID_SP || dev->cpu_id ==
>>> AMD_CPU_ID_SHP) {
>>>            dev_warn_once(dev->dev, "S0i3 is not supported on this
>>> hardware\n");
>>>            err = -ENODEV;
>>> @@ -767,7 +761,6 @@ static int amd_pmc_probe(struct platform_device
>>> *pdev)
>>>        }
>>>          base_addr_lo = val & AMD_PMC_BASE_ADDR_HI_MASK;
>>> -
>>>        err = amd_smn_read(0, AMD_PMC_BASE_ADDR_HI, &val);
>>>        if (err) {
>>>            dev_err(dev->dev, "error reading 0x%x\n",
>>> AMD_PMC_BASE_ADDR_HI);
>>
>
diff mbox series

Patch

diff --git a/drivers/platform/x86/amd/pmc/pmc.c b/drivers/platform/x86/amd/pmc/pmc.c
index 742920530987..d80a5b899a1d 100644
--- a/drivers/platform/x86/amd/pmc/pmc.c
+++ b/drivers/platform/x86/amd/pmc/pmc.c
@@ -168,7 +168,6 @@  static int get_metrics_table(struct amd_pmc_dev *pdev, struct smu_metrics *table
 {
 	if (!pdev->smu_virt_addr) {
 		int ret = amd_pmc_setup_smu_logging(pdev);
-
 		if (ret)
 			return ret;
 	}
@@ -222,7 +221,6 @@  static ssize_t smu_fw_version_show(struct device *d, struct device_attribute *at
 
 	if (!dev->major) {
 		int rc = amd_pmc_get_smu_version(dev);
-
 		if (rc)
 			return rc;
 	}
@@ -236,7 +234,6 @@  static ssize_t smu_program_show(struct device *d, struct device_attribute *attr,
 
 	if (!dev->major) {
 		int rc = amd_pmc_get_smu_version(dev);
-
 		if (rc)
 			return rc;
 	}
@@ -704,7 +701,6 @@  static int amd_pmc_suspend_handler(struct device *dev)
 	 */
 	if (pdev->disable_8042_wakeup && !disable_workarounds) {
 		int rc = amd_pmc_wa_irq1(pdev);
-
 		if (rc) {
 			dev_err(pdev->dev, "failed to adjust keyboard wakeup: %d\n", rc);
 			return rc;
@@ -743,7 +739,6 @@  static int amd_pmc_probe(struct platform_device *pdev)
 	u32 val;
 
 	dev->dev = &pdev->dev;
-
 	rdev = pci_get_domain_bus_and_slot(0, 0, PCI_DEVFN(0, 0));
 	if (!rdev || !pci_match_id(pmc_pci_ids, rdev)) {
 		err = -ENODEV;
@@ -751,7 +746,6 @@  static int amd_pmc_probe(struct platform_device *pdev)
 	}
 
 	dev->cpu_id = rdev->device;
-
 	if (dev->cpu_id == AMD_CPU_ID_SP || dev->cpu_id == AMD_CPU_ID_SHP) {
 		dev_warn_once(dev->dev, "S0i3 is not supported on this hardware\n");
 		err = -ENODEV;
@@ -767,7 +761,6 @@  static int amd_pmc_probe(struct platform_device *pdev)
 	}
 
 	base_addr_lo = val & AMD_PMC_BASE_ADDR_HI_MASK;
-
 	err = amd_smn_read(0, AMD_PMC_BASE_ADDR_HI, &val);
 	if (err) {
 		dev_err(dev->dev, "error reading 0x%x\n", AMD_PMC_BASE_ADDR_HI);