2021-08-29 12:46:25

by Andy Shevchenko

[permalink] [raw]
Subject: [PATCH v1 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).

Signed-off-by: Andy Shevchenko <[email protected]>
---
drivers/misc/pvpanic/pvpanic-pci.c | 14 ++++++--------
drivers/misc/pvpanic/pvpanic.c | 3 +--
2 files changed, 7 insertions(+), 10 deletions(-)

diff --git a/drivers/misc/pvpanic/pvpanic-pci.c b/drivers/misc/pvpanic/pvpanic-pci.c
index 741116b3d995..7d1220f4c95b 100644
--- a/drivers/misc/pvpanic/pvpanic-pci.c
+++ b/drivers/misc/pvpanic/pvpanic-pci.c
@@ -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);
diff --git a/drivers/misc/pvpanic/pvpanic.c b/drivers/misc/pvpanic/pvpanic.c
index 02b807c788c9..fb5411dfd614 100644
--- a/drivers/misc/pvpanic/pvpanic.c
+++ b/drivers/misc/pvpanic/pvpanic.c
@@ -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);
--
2.33.0


2021-08-29 12:46:25

by Andy Shevchenko

[permalink] [raw]
Subject: [PATCH v1 3/3] pvpanic: Indentation fixes here and there

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

Signed-off-by: Andy Shevchenko <[email protected]>
---
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(-)

diff --git a/drivers/misc/pvpanic/pvpanic-mmio.c b/drivers/misc/pvpanic/pvpanic-mmio.c
index 61dbff5f0065..eb97167c03fb 100644
--- a/drivers/misc/pvpanic/pvpanic-mmio.c
+++ b/drivers/misc/pvpanic/pvpanic-mmio.c
@@ -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);
diff --git a/drivers/misc/pvpanic/pvpanic-pci.c b/drivers/misc/pvpanic/pvpanic-pci.c
index 7d1220f4c95b..07eddb5ea30f 100644
--- a/drivers/misc/pvpanic/pvpanic-pci.c
+++ b/drivers/misc/pvpanic/pvpanic-pci.c
@@ -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;
diff --git a/drivers/misc/pvpanic/pvpanic.c b/drivers/misc/pvpanic/pvpanic.c
index 254d35efb0b7..c9b5a66697ea 100644
--- a/drivers/misc/pvpanic/pvpanic.c
+++ b/drivers/misc/pvpanic/pvpanic.c
@@ -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);
--
2.33.0

2021-08-29 12:47:56

by Andy Shevchenko

[permalink] [raw]
Subject: [PATCH v1 2/3] pvpanic: Fix typos in the comments

Fix a few spelling typos in the comments.

Signed-off-by: Andy Shevchenko <[email protected]>
---
drivers/misc/pvpanic/pvpanic-mmio.c | 2 +-
drivers/misc/pvpanic/pvpanic.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/misc/pvpanic/pvpanic-mmio.c b/drivers/misc/pvpanic/pvpanic-mmio.c
index be4016084979..61dbff5f0065 100644
--- a/drivers/misc/pvpanic/pvpanic-mmio.c
+++ b/drivers/misc/pvpanic/pvpanic-mmio.c
@@ -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;

diff --git a/drivers/misc/pvpanic/pvpanic.c b/drivers/misc/pvpanic/pvpanic.c
index fb5411dfd614..254d35efb0b7 100644
--- a/drivers/misc/pvpanic/pvpanic.c
+++ b/drivers/misc/pvpanic/pvpanic.c
@@ -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)
--
2.33.0

2021-08-30 06:31:13

by Mihai Carabas

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

La 29.08.2021 15:43, Andy Shevchenko a scris:
> 1) replace double spaces with single;
> 2) relax line width limitation a bit.
>
> Signed-off-by: Andy Shevchenko <[email protected]>
Reviewed-by: Mihai Carabas <[email protected]>
> ---
> 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(-)
>
> diff --git a/drivers/misc/pvpanic/pvpanic-mmio.c b/drivers/misc/pvpanic/pvpanic-mmio.c
> index 61dbff5f0065..eb97167c03fb 100644
> --- a/drivers/misc/pvpanic/pvpanic-mmio.c
> +++ b/drivers/misc/pvpanic/pvpanic-mmio.c
> @@ -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);
> diff --git a/drivers/misc/pvpanic/pvpanic-pci.c b/drivers/misc/pvpanic/pvpanic-pci.c
> index 7d1220f4c95b..07eddb5ea30f 100644
> --- a/drivers/misc/pvpanic/pvpanic-pci.c
> +++ b/drivers/misc/pvpanic/pvpanic-pci.c
> @@ -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;
> diff --git a/drivers/misc/pvpanic/pvpanic.c b/drivers/misc/pvpanic/pvpanic.c
> index 254d35efb0b7..c9b5a66697ea 100644
> --- a/drivers/misc/pvpanic/pvpanic.c
> +++ b/drivers/misc/pvpanic/pvpanic.c
> @@ -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);


2021-08-30 06:31:26

by Mihai Carabas

[permalink] [raw]
Subject: Re: [PATCH v1 1/3] pvpanic: Keep single style across modules

La 29.08.2021 15:43, Andy Shevchenko a scris:
> We have different style on where we place module_*() and MODULE_*() macros.
> Inherit the style from the original module (now pvpanic-mmio.c).
>
> Signed-off-by: Andy Shevchenko <[email protected]>
Reviewed-by: Mihai Carabas <[email protected]
> ---
> drivers/misc/pvpanic/pvpanic-pci.c | 14 ++++++--------
> drivers/misc/pvpanic/pvpanic.c | 3 +--
> 2 files changed, 7 insertions(+), 10 deletions(-)
>
> diff --git a/drivers/misc/pvpanic/pvpanic-pci.c b/drivers/misc/pvpanic/pvpanic-pci.c
> index 741116b3d995..7d1220f4c95b 100644
> --- a/drivers/misc/pvpanic/pvpanic-pci.c
> +++ b/drivers/misc/pvpanic/pvpanic-pci.c
> @@ -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);
> diff --git a/drivers/misc/pvpanic/pvpanic.c b/drivers/misc/pvpanic/pvpanic.c
> index 02b807c788c9..fb5411dfd614 100644
> --- a/drivers/misc/pvpanic/pvpanic.c
> +++ b/drivers/misc/pvpanic/pvpanic.c
> @@ -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);


2021-08-30 06:32:58

by Mihai Carabas

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

La 29.08.2021 15:43, Andy Shevchenko a scris:
> Fix a few spelling typos in the comments.
>
> Signed-off-by: Andy Shevchenko <[email protected]>
Reviewed-by: Mihai Carabas <[email protected]>
> ---
> drivers/misc/pvpanic/pvpanic-mmio.c | 2 +-
> drivers/misc/pvpanic/pvpanic.c | 2 +-
> 2 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/misc/pvpanic/pvpanic-mmio.c b/drivers/misc/pvpanic/pvpanic-mmio.c
> index be4016084979..61dbff5f0065 100644
> --- a/drivers/misc/pvpanic/pvpanic-mmio.c
> +++ b/drivers/misc/pvpanic/pvpanic-mmio.c
> @@ -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;
>
> diff --git a/drivers/misc/pvpanic/pvpanic.c b/drivers/misc/pvpanic/pvpanic.c
> index fb5411dfd614..254d35efb0b7 100644
> --- a/drivers/misc/pvpanic/pvpanic.c
> +++ b/drivers/misc/pvpanic/pvpanic.c
> @@ -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)