Skip to contentSkip to conversation

pvpanic: Keep single style across modules

PATCH In review Andy Shevchenko 2 participants 6 messages Aug 29, 2021 – Aug 30, 2021 Char and misc drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/3 pvpanic: Keep single style across modules

We have different style on where we place module_*() and MODULE_*() macros. Inherit the style from the original module (now pvpanic-mmio.c).

---
 drivers/misc/pvpanic/pvpanic-pci.c | 14 ++++++--------
 drivers/misc/pvpanic/pvpanic.c     |  3 +--
 2 files changed, 7 insertions(+), 10 deletions(-)
drivers/misc/pvpanic/pvpanic-pci.c +6 -8
index 741116b3d995..7d1220f4c95b 100644
@@ -22,11 +22,6 @@ MODULE_AUTHOR("Mihai Carabas <[email protected]>");
 MODULE_DESCRIPTION("pvpanic device driver ");
 MODULE_LICENSE("GPL");
 
-static const struct pci_device_id pvpanic_pci_id_tbl[]  = {
-	{ PCI_DEVICE(PCI_VENDOR_ID_REDHAT, PCI_DEVICE_ID_REDHAT_PVPANIC)},
-	{}
-};
-
 static ssize_t capability_show(struct device *dev,
 			       struct device_attribute *attr, char *buf)
 {
@@ -99,6 +94,12 @@ static int pvpanic_pci_probe(struct pci_dev *pdev,
 	return devm_pvpanic_probe(&pdev->dev, pi);
 }
 
+static const struct pci_device_id pvpanic_pci_id_tbl[]  = {
+	{ PCI_DEVICE(PCI_VENDOR_ID_REDHAT, PCI_DEVICE_ID_REDHAT_PVPANIC)},
+	{}
+};
+MODULE_DEVICE_TABLE(pci, pvpanic_pci_id_tbl);
+
 static struct pci_driver pvpanic_pci_driver = {
 	.name =         "pvpanic-pci",
 	.id_table =     pvpanic_pci_id_tbl,
@@ -107,7 +108,4 @@ static struct pci_driver pvpanic_pci_driver = {
 		.dev_groups = pvpanic_pci_dev_groups,
 	},
 };
-
-MODULE_DEVICE_TABLE(pci, pvpanic_pci_id_tbl);
-
 module_pci_driver(pvpanic_pci_driver);
drivers/misc/pvpanic/pvpanic.c +1 -2
index 02b807c788c9..fb5411dfd614 100644
@@ -99,6 +99,7 @@ static int pvpanic_init(void)
 
 	return 0;
 }
+module_init(pvpanic_init);
 
 static void pvpanic_exit(void)
 {
@@ -106,6 +107,4 @@ static void pvpanic_exit(void)
 					 &pvpanic_panic_nb);
 
 }
-
-module_init(pvpanic_init);
 module_exit(pvpanic_exit);
Signature · 1 line
2.33.0
#1 lore raw

PATCH 2/3 pvpanic: Fix typos in the comments

Fix a few spelling typos in the comments.

---
 drivers/misc/pvpanic/pvpanic-mmio.c | 2 +-
 drivers/misc/pvpanic/pvpanic.c      | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/misc/pvpanic/pvpanic-mmio.c +1 -1
index be4016084979..61dbff5f0065 100644
@@ -100,7 +100,7 @@ static int pvpanic_mmio_probe(struct platform_device *pdev)
 	pi->base = base;
 	pi->capability = PVPANIC_PANICKED | PVPANIC_CRASH_LOADED;
 
-	/* initlize capability by RDPT */
+	/* initialize capability by RDPT */
 	pi->capability &= ioread8(base);
 	pi->events = pi->capability;
 
drivers/misc/pvpanic/pvpanic.c +1 -1
index fb5411dfd614..254d35efb0b7 100644
@@ -58,7 +58,7 @@ pvpanic_panic_notify(struct notifier_block *nb, unsigned long code,
 
 static struct notifier_block pvpanic_panic_nb = {
 	.notifier_call = pvpanic_panic_notify,
-	.priority = 1, /* let this called before broken drm_fb_helper */
+	.priority = 1, /* let this called before broken drm_fb_helper() */
 };
 
 static void pvpanic_remove(void *param)
Signature · 1 line
2.33.0
Reviewed-by on v1 2/3
#2 lore raw

Re: [PATCH v1 2/3] pvpanic: Fix typos in the comments

La 29.08.2021 15:43, Andy Shevchenko a scris:

Quoted 3 lines

Fix a few spelling typos in the comments.

Quoted 31 lines
---
  drivers/misc/pvpanic/pvpanic-mmio.c | 2 +-
  drivers/misc/pvpanic/pvpanic.c      | 2 +-
  2 files changed, 2 insertions(+), 2 deletions(-)
drivers/misc/pvpanic/pvpanic-mmio.c +1 -1
index be4016084979..61dbff5f0065 100644
@@ -100,7 +100,7 @@ static int pvpanic_mmio_probe(struct platform_device *pdev)
  	pi->base = base;
  	pi->capability = PVPANIC_PANICKED | PVPANIC_CRASH_LOADED;
 
-	/* initlize capability by RDPT */
+	/* initialize capability by RDPT */
  	pi->capability &= ioread8(base);
  	pi->events = pi->capability;
 
drivers/misc/pvpanic/pvpanic.c +1 -1
index fb5411dfd614..254d35efb0b7 100644
@@ -58,7 +58,7 @@ pvpanic_panic_notify(struct notifier_block *nb, unsigned long code,
 
  static struct notifier_block pvpanic_panic_nb = {
  	.notifier_call = pvpanic_panic_notify,
-	.priority = 1, /* let this called before broken drm_fb_helper */
+	.priority = 1, /* let this called before broken drm_fb_helper() */
  };
 
  static void pvpanic_remove(void *param)
#3 lore raw

PATCH 3/3 pvpanic: Indentation fixes here and there

In reply to Andy Shevchenko

1) replace double spaces with single;
2) relax line width limitation a bit.

---
 drivers/misc/pvpanic/pvpanic-mmio.c |  7 +++----
 drivers/misc/pvpanic/pvpanic-pci.c  | 12 +++++-------
 drivers/misc/pvpanic/pvpanic.c      | 11 ++++-------
 3 files changed, 12 insertions(+), 18 deletions(-)
drivers/misc/pvpanic/pvpanic-mmio.c +3 -4
index 61dbff5f0065..eb97167c03fb 100644
@@ -24,8 +24,7 @@ MODULE_AUTHOR("Hu Tao <[email protected]>");
 MODULE_DESCRIPTION("pvpanic-mmio device driver");
 MODULE_LICENSE("GPL");
 
-static ssize_t capability_show(struct device *dev,
-			       struct device_attribute *attr, char *buf)
+static ssize_t capability_show(struct device *dev, struct device_attribute *attr, char *buf)
 {
 	struct pvpanic_instance *pi = dev_get_drvdata(dev);
 
@@ -33,14 +32,14 @@ static ssize_t capability_show(struct device *dev,
 }
 static DEVICE_ATTR_RO(capability);
 
-static ssize_t events_show(struct device *dev,  struct device_attribute *attr, char *buf)
+static ssize_t events_show(struct device *dev, struct device_attribute *attr, char *buf)
 {
 	struct pvpanic_instance *pi = dev_get_drvdata(dev);
 
 	return sysfs_emit(buf, "%x\n", pi->events);
 }
 
-static ssize_t events_store(struct device *dev,  struct device_attribute *attr,
+static ssize_t events_store(struct device *dev, struct device_attribute *attr,
 			    const char *buf, size_t count)
 {
 	struct pvpanic_instance *pi = dev_get_drvdata(dev);
drivers/misc/pvpanic/pvpanic-pci.c +5 -7
index 7d1220f4c95b..07eddb5ea30f 100644
@@ -19,11 +19,10 @@
 #define PCI_DEVICE_ID_REDHAT_PVPANIC     0x0011
 
 MODULE_AUTHOR("Mihai Carabas <[email protected]>");
-MODULE_DESCRIPTION("pvpanic device driver ");
+MODULE_DESCRIPTION("pvpanic device driver");
 MODULE_LICENSE("GPL");
 
-static ssize_t capability_show(struct device *dev,
-			       struct device_attribute *attr, char *buf)
+static ssize_t capability_show(struct device *dev, struct device_attribute *attr, char *buf)
 {
 	struct pvpanic_instance *pi = dev_get_drvdata(dev);
 
@@ -31,14 +30,14 @@ static ssize_t capability_show(struct device *dev,
 }
 static DEVICE_ATTR_RO(capability);
 
-static ssize_t events_show(struct device *dev,  struct device_attribute *attr, char *buf)
+static ssize_t events_show(struct device *dev, struct device_attribute *attr, char *buf)
 {
 	struct pvpanic_instance *pi = dev_get_drvdata(dev);
 
 	return sysfs_emit(buf, "%x\n", pi->events);
 }
 
-static ssize_t events_store(struct device *dev,  struct device_attribute *attr,
+static ssize_t events_store(struct device *dev, struct device_attribute *attr,
 			    const char *buf, size_t count)
 {
 	struct pvpanic_instance *pi = dev_get_drvdata(dev);
@@ -65,8 +64,7 @@ static struct attribute *pvpanic_pci_dev_attrs[] = {
 };
 ATTRIBUTE_GROUPS(pvpanic_pci_dev);
 
-static int pvpanic_pci_probe(struct pci_dev *pdev,
-			     const struct pci_device_id *ent)
+static int pvpanic_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
 {
 	struct pvpanic_instance *pi;
 	void __iomem *base;
drivers/misc/pvpanic/pvpanic.c +4 -7
index 254d35efb0b7..c9b5a66697ea 100644
@@ -23,7 +23,7 @@
 #include "pvpanic.h"
 
 MODULE_AUTHOR("Mihai Carabas <[email protected]>");
-MODULE_DESCRIPTION("pvpanic device driver ");
+MODULE_DESCRIPTION("pvpanic device driver");
 MODULE_LICENSE("GPL");
 
 static struct list_head pvpanic_list;
@@ -43,8 +43,7 @@ pvpanic_send_event(unsigned int event)
 }
 
 static int
-pvpanic_panic_notify(struct notifier_block *nb, unsigned long code,
-		     void *unused)
+pvpanic_panic_notify(struct notifier_block *nb, unsigned long code, void *unused)
 {
 	unsigned int event = PVPANIC_PANICKED;
 
@@ -94,8 +93,7 @@ static int pvpanic_init(void)
 	INIT_LIST_HEAD(&pvpanic_list);
 	spin_lock_init(&pvpanic_lock);
 
-	atomic_notifier_chain_register(&panic_notifier_list,
-				       &pvpanic_panic_nb);
+	atomic_notifier_chain_register(&panic_notifier_list, &pvpanic_panic_nb);
 
 	return 0;
 }
@@ -103,8 +101,7 @@ module_init(pvpanic_init);
 
 static void pvpanic_exit(void)
 {
-	atomic_notifier_chain_unregister(&panic_notifier_list,
-					 &pvpanic_panic_nb);
+	atomic_notifier_chain_unregister(&panic_notifier_list, &pvpanic_panic_nb);
 
 }
 module_exit(pvpanic_exit);
Signature · 1 line
2.33.0
Reviewed-by on v1 3/3
#4 lore raw

Re: [PATCH v1 3/3] pvpanic: Indentation fixes here and there

La 29.08.2021 15:43, Andy Shevchenko a scris:

Quoted 4 lines

1) replace double spaces with single;
2) relax line width limitation a bit.

Quoted 125 lines
---
  drivers/misc/pvpanic/pvpanic-mmio.c |  7 +++----
  drivers/misc/pvpanic/pvpanic-pci.c  | 12 +++++-------
  drivers/misc/pvpanic/pvpanic.c      | 11 ++++-------
  3 files changed, 12 insertions(+), 18 deletions(-)
drivers/misc/pvpanic/pvpanic-mmio.c +3 -4
index 61dbff5f0065..eb97167c03fb 100644
@@ -24,8 +24,7 @@ MODULE_AUTHOR("Hu Tao <[email protected]>");
  MODULE_DESCRIPTION("pvpanic-mmio device driver");
  MODULE_LICENSE("GPL");
 
-static ssize_t capability_show(struct device *dev,
-			       struct device_attribute *attr, char *buf)
+static ssize_t capability_show(struct device *dev, struct device_attribute *attr, char *buf)
  {
  	struct pvpanic_instance *pi = dev_get_drvdata(dev);
 
@@ -33,14 +32,14 @@ static ssize_t capability_show(struct device *dev,
  }
  static DEVICE_ATTR_RO(capability);
 
-static ssize_t events_show(struct device *dev,  struct device_attribute *attr, char *buf)
+static ssize_t events_show(struct device *dev, struct device_attribute *attr, char *buf)
  {
  	struct pvpanic_instance *pi = dev_get_drvdata(dev);
 
  	return sysfs_emit(buf, "%x\n", pi->events);
  }
 
-static ssize_t events_store(struct device *dev,  struct device_attribute *attr,
+static ssize_t events_store(struct device *dev, struct device_attribute *attr,
  			    const char *buf, size_t count)
  {
  	struct pvpanic_instance *pi = dev_get_drvdata(dev);
drivers/misc/pvpanic/pvpanic-pci.c +5 -7
index 7d1220f4c95b..07eddb5ea30f 100644
@@ -19,11 +19,10 @@
  #define PCI_DEVICE_ID_REDHAT_PVPANIC     0x0011
 
  MODULE_AUTHOR("Mihai Carabas <[email protected]>");
-MODULE_DESCRIPTION("pvpanic device driver ");
+MODULE_DESCRIPTION("pvpanic device driver");
  MODULE_LICENSE("GPL");
 
-static ssize_t capability_show(struct device *dev,
-			       struct device_attribute *attr, char *buf)
+static ssize_t capability_show(struct device *dev, struct device_attribute *attr, char *buf)
  {
  	struct pvpanic_instance *pi = dev_get_drvdata(dev);
 
@@ -31,14 +30,14 @@ static ssize_t capability_show(struct device *dev,
  }
  static DEVICE_ATTR_RO(capability);
 
-static ssize_t events_show(struct device *dev,  struct device_attribute *attr, char *buf)
+static ssize_t events_show(struct device *dev, struct device_attribute *attr, char *buf)
  {
  	struct pvpanic_instance *pi = dev_get_drvdata(dev);
 
  	return sysfs_emit(buf, "%x\n", pi->events);
  }
 
-static ssize_t events_store(struct device *dev,  struct device_attribute *attr,
+static ssize_t events_store(struct device *dev, struct device_attribute *attr,
  			    const char *buf, size_t count)
  {
  	struct pvpanic_instance *pi = dev_get_drvdata(dev);
@@ -65,8 +64,7 @@ static struct attribute *pvpanic_pci_dev_attrs[] = {
  };
  ATTRIBUTE_GROUPS(pvpanic_pci_dev);
 
-static int pvpanic_pci_probe(struct pci_dev *pdev,
-			     const struct pci_device_id *ent)
+static int pvpanic_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
  {
  	struct pvpanic_instance *pi;
  	void __iomem *base;
drivers/misc/pvpanic/pvpanic.c +4 -7
index 254d35efb0b7..c9b5a66697ea 100644
@@ -23,7 +23,7 @@
  #include "pvpanic.h"
 
  MODULE_AUTHOR("Mihai Carabas <[email protected]>");
-MODULE_DESCRIPTION("pvpanic device driver ");
+MODULE_DESCRIPTION("pvpanic device driver");
  MODULE_LICENSE("GPL");
 
  static struct list_head pvpanic_list;
@@ -43,8 +43,7 @@ pvpanic_send_event(unsigned int event)
  }
 
  static int
-pvpanic_panic_notify(struct notifier_block *nb, unsigned long code,
-		     void *unused)
+pvpanic_panic_notify(struct notifier_block *nb, unsigned long code, void *unused)
  {
  	unsigned int event = PVPANIC_PANICKED;
 
@@ -94,8 +93,7 @@ static int pvpanic_init(void)
  	INIT_LIST_HEAD(&pvpanic_list);
  	spin_lock_init(&pvpanic_lock);
 
-	atomic_notifier_chain_register(&panic_notifier_list,
-				       &pvpanic_panic_nb);
+	atomic_notifier_chain_register(&panic_notifier_list, &pvpanic_panic_nb);
 
  	return 0;
  }
@@ -103,8 +101,7 @@ module_init(pvpanic_init);
 
  static void pvpanic_exit(void)
  {
-	atomic_notifier_chain_unregister(&panic_notifier_list,
-					 &pvpanic_panic_nb);
+	atomic_notifier_chain_unregister(&panic_notifier_list, &pvpanic_panic_nb);
 
  }
  module_exit(pvpanic_exit);
Reviewed-by on v1 1/3
#5 lore raw
In reply to Andy Shevchenko

La 29.08.2021 15:43, Andy Shevchenko a scris:

Quoted 4 lines

We have different style on where we place module_*() and MODULE_*() macros. Inherit the style from the original module (now pvpanic-mmio.c).

Quoted 61 lines
---
  drivers/misc/pvpanic/pvpanic-pci.c | 14 ++++++--------
  drivers/misc/pvpanic/pvpanic.c     |  3 +--
  2 files changed, 7 insertions(+), 10 deletions(-)
drivers/misc/pvpanic/pvpanic-pci.c +6 -8
index 741116b3d995..7d1220f4c95b 100644
@@ -22,11 +22,6 @@ MODULE_AUTHOR("Mihai Carabas <[email protected]>");
  MODULE_DESCRIPTION("pvpanic device driver ");
  MODULE_LICENSE("GPL");
 
-static const struct pci_device_id pvpanic_pci_id_tbl[]  = {
-	{ PCI_DEVICE(PCI_VENDOR_ID_REDHAT, PCI_DEVICE_ID_REDHAT_PVPANIC)},
-	{}
-};
-
  static ssize_t capability_show(struct device *dev,
  			       struct device_attribute *attr, char *buf)
  {
@@ -99,6 +94,12 @@ static int pvpanic_pci_probe(struct pci_dev *pdev,
  	return devm_pvpanic_probe(&pdev->dev, pi);
  }
 
+static const struct pci_device_id pvpanic_pci_id_tbl[]  = {
+	{ PCI_DEVICE(PCI_VENDOR_ID_REDHAT, PCI_DEVICE_ID_REDHAT_PVPANIC)},
+	{}
+};
+MODULE_DEVICE_TABLE(pci, pvpanic_pci_id_tbl);
+
  static struct pci_driver pvpanic_pci_driver = {
  	.name =         "pvpanic-pci",
  	.id_table =     pvpanic_pci_id_tbl,
@@ -107,7 +108,4 @@ static struct pci_driver pvpanic_pci_driver = {
  		.dev_groups = pvpanic_pci_dev_groups,
  	},
  };
-
-MODULE_DEVICE_TABLE(pci, pvpanic_pci_id_tbl);
-
  module_pci_driver(pvpanic_pci_driver);
drivers/misc/pvpanic/pvpanic.c +1 -2
index 02b807c788c9..fb5411dfd614 100644
@@ -99,6 +99,7 @@ static int pvpanic_init(void)
 
  	return 0;
  }
+module_init(pvpanic_init);
 
  static void pvpanic_exit(void)
  {
@@ -106,6 +107,4 @@ static void pvpanic_exit(void)
  					 &pvpanic_panic_nb);
 
  }
-
-module_init(pvpanic_init);
  module_exit(pvpanic_exit);