linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] pci: cleanup coding styling in pci-driver.c
@ 2022-09-05 14:01 Jingyu Wang
  2022-09-06 21:32 ` Bjorn Helgaas
  0 siblings, 1 reply; 2+ messages in thread
From: Jingyu Wang @ 2022-09-05 14:01 UTC (permalink / raw)
  To: bhelgaas; +Cc: linux-pci, linux-kernel, Jingyu Wang

Signed-off-by: Jingyu Wang <jingyuwang_vip@163.com>
---
 drivers/pci/pci-driver.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/drivers/pci/pci-driver.c b/drivers/pci/pci-driver.c
index 49238ddd39ee..bba486f5e5fe 100644
--- a/drivers/pci/pci-driver.c
+++ b/drivers/pci/pci-driver.c
@@ -204,6 +204,7 @@ static ssize_t new_id_store(struct device_driver *driver, const char *buf,
 
 	if (fields != 7) {
 		struct pci_dev *pdev = kzalloc(sizeof(*pdev), GFP_KERNEL);
+
 		if (!pdev)
 			return -ENOMEM;
 
@@ -222,8 +223,8 @@ static ssize_t new_id_store(struct device_driver *driver, const char *buf,
 			return retval;
 	}
 
-	/* Only accept driver_data values that match an existing id_table
-	   entry */
+	/* Only accept driver_data values that match an existing id_table entry
+	 */
 	if (ids) {
 		retval = -EINVAL;
 		while (ids->vendor || ids->subvendor || ids->class_mask) {
@@ -272,6 +273,7 @@ static ssize_t remove_id_store(struct device_driver *driver, const char *buf,
 	spin_lock(&pdrv->dynids.lock);
 	list_for_each_entry_safe(dynid, n, &pdrv->dynids.list, node) {
 		struct pci_device_id *id = &dynid->id;
+
 		if ((id->vendor == vendor) &&
 		    (id->device == device) &&
 		    (subvendor == PCI_ANY_ID || id->subvendor == subvendor) &&
@@ -537,6 +539,7 @@ static int pci_restore_standard_config(struct pci_dev *pci_dev)
 
 	if (pci_dev->current_state != PCI_D0) {
 		int error = pci_set_power_state(pci_dev, PCI_D0);
+
 		if (error)
 			return error;
 	}
@@ -705,6 +708,7 @@ static int pci_pm_prepare(struct device *dev)
 
 	if (pm && pm->prepare) {
 		int error = pm->prepare(dev);
+
 		if (error < 0)
 			return error;
 
@@ -1364,7 +1368,7 @@ static int pci_pm_runtime_idle(struct device *dev)
 		return 0;
 
 	if (!pm)
-		return -ENOSYS;
+		return -ENODEV;
 
 	if (pm->runtime_idle)
 		return pm->runtime_idle(dev);
@@ -1471,6 +1475,7 @@ struct pci_driver *pci_dev_driver(const struct pci_dev *dev)
 		return dev->driver;
 	else {
 		int i;
+
 		for (i = 0; i <= PCI_ROM_RESOURCE; i++)
 			if (dev->resource[i].flags & IORESOURCE_BUSY)
 				return &pci_compat_driver;

base-commit: e47eb90a0a9ae20b82635b9b99a8d0979b757ad8
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] pci: cleanup coding styling in pci-driver.c
  2022-09-05 14:01 [PATCH] pci: cleanup coding styling in pci-driver.c Jingyu Wang
@ 2022-09-06 21:32 ` Bjorn Helgaas
  0 siblings, 0 replies; 2+ messages in thread
From: Bjorn Helgaas @ 2022-09-06 21:32 UTC (permalink / raw)
  To: Jingyu Wang; +Cc: bhelgaas, linux-pci, linux-kernel

On Mon, Sep 05, 2022 at 10:01:36PM +0800, Jingyu Wang wrote:
> Signed-off-by: Jingyu Wang <jingyuwang_vip@163.com>

I'm not going to take this because:

  - Subject line doesn't follow drivers/pci capitalization convention.

  - Minor style changes by themselves aren't really worth it unless
    you are also doing more substantive improvements.

  - It contains a non-cosmetic return value change (ENOSYS/ENODEV)
    that is unrelated to the rest and not mentioned in the commit log.

> ---
>  drivers/pci/pci-driver.c | 11 ++++++++---
>  1 file changed, 8 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/pci/pci-driver.c b/drivers/pci/pci-driver.c
> index 49238ddd39ee..bba486f5e5fe 100644
> --- a/drivers/pci/pci-driver.c
> +++ b/drivers/pci/pci-driver.c
> @@ -204,6 +204,7 @@ static ssize_t new_id_store(struct device_driver *driver, const char *buf,
>  
>  	if (fields != 7) {
>  		struct pci_dev *pdev = kzalloc(sizeof(*pdev), GFP_KERNEL);
> +
>  		if (!pdev)
>  			return -ENOMEM;
>  
> @@ -222,8 +223,8 @@ static ssize_t new_id_store(struct device_driver *driver, const char *buf,
>  			return retval;
>  	}
>  
> -	/* Only accept driver_data values that match an existing id_table
> -	   entry */
> +	/* Only accept driver_data values that match an existing id_table entry
> +	 */
>  	if (ids) {
>  		retval = -EINVAL;
>  		while (ids->vendor || ids->subvendor || ids->class_mask) {
> @@ -272,6 +273,7 @@ static ssize_t remove_id_store(struct device_driver *driver, const char *buf,
>  	spin_lock(&pdrv->dynids.lock);
>  	list_for_each_entry_safe(dynid, n, &pdrv->dynids.list, node) {
>  		struct pci_device_id *id = &dynid->id;
> +
>  		if ((id->vendor == vendor) &&
>  		    (id->device == device) &&
>  		    (subvendor == PCI_ANY_ID || id->subvendor == subvendor) &&
> @@ -537,6 +539,7 @@ static int pci_restore_standard_config(struct pci_dev *pci_dev)
>  
>  	if (pci_dev->current_state != PCI_D0) {
>  		int error = pci_set_power_state(pci_dev, PCI_D0);
> +
>  		if (error)
>  			return error;
>  	}
> @@ -705,6 +708,7 @@ static int pci_pm_prepare(struct device *dev)
>  
>  	if (pm && pm->prepare) {
>  		int error = pm->prepare(dev);
> +
>  		if (error < 0)
>  			return error;
>  
> @@ -1364,7 +1368,7 @@ static int pci_pm_runtime_idle(struct device *dev)
>  		return 0;
>  
>  	if (!pm)
> -		return -ENOSYS;
> +		return -ENODEV;
>  
>  	if (pm->runtime_idle)
>  		return pm->runtime_idle(dev);
> @@ -1471,6 +1475,7 @@ struct pci_driver *pci_dev_driver(const struct pci_dev *dev)
>  		return dev->driver;
>  	else {
>  		int i;
> +
>  		for (i = 0; i <= PCI_ROM_RESOURCE; i++)
>  			if (dev->resource[i].flags & IORESOURCE_BUSY)
>  				return &pci_compat_driver;
> 
> base-commit: e47eb90a0a9ae20b82635b9b99a8d0979b757ad8
> -- 
> 2.34.1
> 

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-09-06 21:33 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-05 14:01 [PATCH] pci: cleanup coding styling in pci-driver.c Jingyu Wang
2022-09-06 21:32 ` Bjorn Helgaas

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).