All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 00/12] ACPI: constify patches and other minor fixes
@ 2015-06-13 12:26 Mathias Krause
  2015-06-13 12:26 ` [PATCH 01/12] ACPI / AC: constify DMI system id table Mathias Krause
                   ` (12 more replies)
  0 siblings, 13 replies; 16+ messages in thread
From: Mathias Krause @ 2015-06-13 12:26 UTC (permalink / raw)
  To: Rafael J. Wysocki, Len Brown; +Cc: linux-acpi, Mathias Krause

Hi Rafael, Len,

this series constifies a few variables in the ACPI code that are read
only and therefore can be const. The main goal is to constify all users
of struct acpi_device_id, but while digging through the code I found a
few other places that could be improved too (constifying other variables
in patches 1, 2, 4 and 9 as adding __init annotations where sensible in
patch 7 or dropping bogus annotations in patch 3).

This series only handles the ACPI related bits for the constification of
struct acpi_device_id but all other users have been changed too (you've
been Cc'ed on the corresponding patches).

Please apply!


Mathias Krause (12):
  ACPI / AC: constify DMI system id table
  ACPI / LPSS: constify device descriptors
  ACPI / processor: remove bogus __refdata annotation
  ACPI / PNP: constify device IDs
  ACPI / battery: constify the offset tables
  ACPI / battery: minor tweaks to acpi_battery_units()
  ACPI / battery: mark DMI table as __initconst
  ACPI / HED: constify ACPI device ids
  ACPI / processor: constify DMI system id table
  ACPI / scan: constify ACPI device ids
  ACPI / video: constify ACPI and DMI id tables
  ACPI: Constify ACPI device IDs in documentation

 Documentation/acpi/enumeration.txt |    6 +++---
 drivers/acpi/ac.c                  |    2 +-
 drivers/acpi/acpi_lpss.c           |   22 +++++++++++-----------
 drivers/acpi/acpi_pnp.c            |    2 +-
 drivers/acpi/acpi_processor.c      |    2 +-
 drivers/acpi/battery.c             |   30 +++++++++++++++---------------
 drivers/acpi/hed.c                 |    2 +-
 drivers/acpi/processor_idle.c      |    2 +-
 drivers/acpi/scan.c                |    2 +-
 drivers/acpi/video_detect.c        |    4 ++--
 10 files changed, 37 insertions(+), 37 deletions(-)

-- 
1.7.10.4


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

* [PATCH 01/12] ACPI / AC: constify DMI system id table
  2015-06-13 12:26 [PATCH 00/12] ACPI: constify patches and other minor fixes Mathias Krause
@ 2015-06-13 12:26 ` Mathias Krause
  2015-06-13 12:26 ` [PATCH 02/12] ACPI / LPSS: constify device descriptors Mathias Krause
                   ` (11 subsequent siblings)
  12 siblings, 0 replies; 16+ messages in thread
From: Mathias Krause @ 2015-06-13 12:26 UTC (permalink / raw)
  To: Rafael J. Wysocki, Len Brown; +Cc: linux-acpi, Mathias Krause

There is no need to have ac_dmi_table[] writeable, constify it.

Signed-off-by: Mathias Krause <minipli@googlemail.com>
---
 drivers/acpi/ac.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/acpi/ac.c b/drivers/acpi/ac.c
index bbcc2b5a70d4..9b5354a2cd08 100644
--- a/drivers/acpi/ac.c
+++ b/drivers/acpi/ac.c
@@ -308,7 +308,7 @@ static int thinkpad_e530_quirk(const struct dmi_system_id *d)
 	return 0;
 }
 
-static struct dmi_system_id ac_dmi_table[] = {
+static const struct dmi_system_id ac_dmi_table[] = {
 	{
 	.callback = thinkpad_e530_quirk,
 	.ident = "thinkpad e530",
-- 
1.7.10.4


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

* [PATCH 02/12] ACPI / LPSS: constify device descriptors
  2015-06-13 12:26 [PATCH 00/12] ACPI: constify patches and other minor fixes Mathias Krause
  2015-06-13 12:26 ` [PATCH 01/12] ACPI / AC: constify DMI system id table Mathias Krause
@ 2015-06-13 12:26 ` Mathias Krause
  2015-06-13 12:26 ` [PATCH 03/12] ACPI / processor: remove bogus __refdata annotation Mathias Krause
                   ` (10 subsequent siblings)
  12 siblings, 0 replies; 16+ messages in thread
From: Mathias Krause @ 2015-06-13 12:26 UTC (permalink / raw)
  To: Rafael J. Wysocki, Len Brown; +Cc: linux-acpi, Mathias Krause

The device descriptors are never written to -- even pointed to as
'const' from struct lpss_private_data. Make them r/o for real.

Signed-off-by: Mathias Krause <minipli@googlemail.com>
---
 drivers/acpi/acpi_lpss.c |   22 +++++++++++-----------
 1 file changed, 11 insertions(+), 11 deletions(-)

diff --git a/drivers/acpi/acpi_lpss.c b/drivers/acpi/acpi_lpss.c
index 37fb19047603..569ee090343f 100644
--- a/drivers/acpi/acpi_lpss.c
+++ b/drivers/acpi/acpi_lpss.c
@@ -129,50 +129,50 @@ static void byt_i2c_setup(struct lpss_private_data *pdata)
 	writel(0, pdata->mmio_base + LPSS_I2C_ENABLE);
 }
 
-static struct lpss_device_desc lpt_dev_desc = {
+static const struct lpss_device_desc lpt_dev_desc = {
 	.flags = LPSS_CLK | LPSS_CLK_GATE | LPSS_CLK_DIVIDER | LPSS_LTR,
 	.prv_offset = 0x800,
 };
 
-static struct lpss_device_desc lpt_i2c_dev_desc = {
+static const struct lpss_device_desc lpt_i2c_dev_desc = {
 	.flags = LPSS_CLK | LPSS_CLK_GATE | LPSS_LTR,
 	.prv_offset = 0x800,
 };
 
-static struct lpss_device_desc lpt_uart_dev_desc = {
+static const struct lpss_device_desc lpt_uart_dev_desc = {
 	.flags = LPSS_CLK | LPSS_CLK_GATE | LPSS_CLK_DIVIDER | LPSS_LTR,
 	.clk_con_id = "baudclk",
 	.prv_offset = 0x800,
 	.setup = lpss_uart_setup,
 };
 
-static struct lpss_device_desc lpt_sdio_dev_desc = {
+static const struct lpss_device_desc lpt_sdio_dev_desc = {
 	.flags = LPSS_LTR,
 	.prv_offset = 0x1000,
 	.prv_size_override = 0x1018,
 };
 
-static struct lpss_device_desc byt_pwm_dev_desc = {
+static const struct lpss_device_desc byt_pwm_dev_desc = {
 	.flags = LPSS_SAVE_CTX,
 };
 
-static struct lpss_device_desc byt_uart_dev_desc = {
+static const struct lpss_device_desc byt_uart_dev_desc = {
 	.flags = LPSS_CLK | LPSS_CLK_GATE | LPSS_CLK_DIVIDER | LPSS_SAVE_CTX,
 	.clk_con_id = "baudclk",
 	.prv_offset = 0x800,
 	.setup = lpss_uart_setup,
 };
 
-static struct lpss_device_desc byt_spi_dev_desc = {
+static const struct lpss_device_desc byt_spi_dev_desc = {
 	.flags = LPSS_CLK | LPSS_CLK_GATE | LPSS_CLK_DIVIDER | LPSS_SAVE_CTX,
 	.prv_offset = 0x400,
 };
 
-static struct lpss_device_desc byt_sdio_dev_desc = {
+static const struct lpss_device_desc byt_sdio_dev_desc = {
 	.flags = LPSS_CLK,
 };
 
-static struct lpss_device_desc byt_i2c_dev_desc = {
+static const struct lpss_device_desc byt_i2c_dev_desc = {
 	.flags = LPSS_CLK | LPSS_SAVE_CTX,
 	.prv_offset = 0x800,
 	.setup = byt_i2c_setup,
@@ -323,14 +323,14 @@ out:
 static int acpi_lpss_create_device(struct acpi_device *adev,
 				   const struct acpi_device_id *id)
 {
-	struct lpss_device_desc *dev_desc;
+	const struct lpss_device_desc *dev_desc;
 	struct lpss_private_data *pdata;
 	struct resource_entry *rentry;
 	struct list_head resource_list;
 	struct platform_device *pdev;
 	int ret;
 
-	dev_desc = (struct lpss_device_desc *)id->driver_data;
+	dev_desc = (const struct lpss_device_desc *)id->driver_data;
 	if (!dev_desc) {
 		pdev = acpi_create_platform_device(adev);
 		return IS_ERR_OR_NULL(pdev) ? PTR_ERR(pdev) : 1;
-- 
1.7.10.4


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

* [PATCH 03/12] ACPI / processor: remove bogus __refdata annotation
  2015-06-13 12:26 [PATCH 00/12] ACPI: constify patches and other minor fixes Mathias Krause
  2015-06-13 12:26 ` [PATCH 01/12] ACPI / AC: constify DMI system id table Mathias Krause
  2015-06-13 12:26 ` [PATCH 02/12] ACPI / LPSS: constify device descriptors Mathias Krause
@ 2015-06-13 12:26 ` Mathias Krause
  2015-06-13 12:26 ` [PATCH 04/12] ACPI / PNP: constify device IDs Mathias Krause
                   ` (9 subsequent siblings)
  12 siblings, 0 replies; 16+ messages in thread
From: Mathias Krause @ 2015-06-13 12:26 UTC (permalink / raw)
  To: Rafael J. Wysocki, Len Brown; +Cc: linux-acpi, Mathias Krause

The processor_handler structure does not reference any __init / __exit
code or data. Therefore the __refdata annotation is not needed.

Signed-off-by: Mathias Krause <minipli@googlemail.com>
---
 drivers/acpi/acpi_processor.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/acpi/acpi_processor.c b/drivers/acpi/acpi_processor.c
index 58f335ca2e75..92cee1580600 100644
--- a/drivers/acpi/acpi_processor.c
+++ b/drivers/acpi/acpi_processor.c
@@ -487,7 +487,7 @@ static const struct acpi_device_id processor_device_ids[] = {
 	{ }
 };
 
-static struct acpi_scan_handler __refdata processor_handler = {
+static struct acpi_scan_handler processor_handler = {
 	.ids = processor_device_ids,
 	.attach = acpi_processor_add,
 #ifdef CONFIG_ACPI_HOTPLUG_CPU
-- 
1.7.10.4


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

* [PATCH 04/12] ACPI / PNP: constify device IDs
  2015-06-13 12:26 [PATCH 00/12] ACPI: constify patches and other minor fixes Mathias Krause
                   ` (2 preceding siblings ...)
  2015-06-13 12:26 ` [PATCH 03/12] ACPI / processor: remove bogus __refdata annotation Mathias Krause
@ 2015-06-13 12:26 ` Mathias Krause
  2015-06-13 12:26 ` [PATCH 05/12] ACPI / battery: constify the offset tables Mathias Krause
                   ` (8 subsequent siblings)
  12 siblings, 0 replies; 16+ messages in thread
From: Mathias Krause @ 2015-06-13 12:26 UTC (permalink / raw)
  To: Rafael J. Wysocki, Len Brown; +Cc: linux-acpi, Mathias Krause

Instead of re-creating the array on the stack each time
is_cmos_rtc_device() gets called, make the array 'static const'.

Signed-off-by: Mathias Krause <minipli@googlemail.com>
---
 drivers/acpi/acpi_pnp.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/acpi/acpi_pnp.c b/drivers/acpi/acpi_pnp.c
index ff6d8adc9cda..9d20ba66d33b 100644
--- a/drivers/acpi/acpi_pnp.c
+++ b/drivers/acpi/acpi_pnp.c
@@ -368,7 +368,7 @@ static struct acpi_scan_handler acpi_pnp_handler = {
  */
 static int is_cmos_rtc_device(struct acpi_device *adev)
 {
-	struct acpi_device_id ids[] = {
+	static const struct acpi_device_id ids[] = {
 		{ "PNP0B00" },
 		{ "PNP0B01" },
 		{ "PNP0B02" },
-- 
1.7.10.4


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

* [PATCH 05/12] ACPI / battery: constify the offset tables
  2015-06-13 12:26 [PATCH 00/12] ACPI: constify patches and other minor fixes Mathias Krause
                   ` (3 preceding siblings ...)
  2015-06-13 12:26 ` [PATCH 04/12] ACPI / PNP: constify device IDs Mathias Krause
@ 2015-06-13 12:26 ` Mathias Krause
  2015-06-13 12:26 ` [PATCH 06/12] ACPI / battery: minor tweaks to acpi_battery_units() Mathias Krause
                   ` (7 subsequent siblings)
  12 siblings, 0 replies; 16+ messages in thread
From: Mathias Krause @ 2015-06-13 12:26 UTC (permalink / raw)
  To: Rafael J. Wysocki, Len Brown; +Cc: linux-acpi, Mathias Krause

The offset tables are only read, not modified. Make them const.

Signed-off-by: Mathias Krause <minipli@googlemail.com>
---
 drivers/acpi/battery.c |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/acpi/battery.c b/drivers/acpi/battery.c
index 63d43677f644..8ec28e395fa1 100644
--- a/drivers/acpi/battery.c
+++ b/drivers/acpi/battery.c
@@ -354,14 +354,14 @@ struct acpi_offsets {
 	u8 mode;		/* int or string? */
 };
 
-static struct acpi_offsets state_offsets[] = {
+static const struct acpi_offsets state_offsets[] = {
 	{offsetof(struct acpi_battery, state), 0},
 	{offsetof(struct acpi_battery, rate_now), 0},
 	{offsetof(struct acpi_battery, capacity_now), 0},
 	{offsetof(struct acpi_battery, voltage_now), 0},
 };
 
-static struct acpi_offsets info_offsets[] = {
+static const struct acpi_offsets info_offsets[] = {
 	{offsetof(struct acpi_battery, power_unit), 0},
 	{offsetof(struct acpi_battery, design_capacity), 0},
 	{offsetof(struct acpi_battery, full_charge_capacity), 0},
@@ -377,7 +377,7 @@ static struct acpi_offsets info_offsets[] = {
 	{offsetof(struct acpi_battery, oem_info), 1},
 };
 
-static struct acpi_offsets extended_info_offsets[] = {
+static const struct acpi_offsets extended_info_offsets[] = {
 	{offsetof(struct acpi_battery, revision), 0},
 	{offsetof(struct acpi_battery, power_unit), 0},
 	{offsetof(struct acpi_battery, design_capacity), 0},
@@ -402,7 +402,7 @@ static struct acpi_offsets extended_info_offsets[] = {
 
 static int extract_package(struct acpi_battery *battery,
 			   union acpi_object *package,
-			   struct acpi_offsets *offsets, int num)
+			   const struct acpi_offsets *offsets, int num)
 {
 	int i;
 	union acpi_object *element;
-- 
1.7.10.4


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

* [PATCH 06/12] ACPI / battery: minor tweaks to acpi_battery_units()
  2015-06-13 12:26 [PATCH 00/12] ACPI: constify patches and other minor fixes Mathias Krause
                   ` (4 preceding siblings ...)
  2015-06-13 12:26 ` [PATCH 05/12] ACPI / battery: constify the offset tables Mathias Krause
@ 2015-06-13 12:26 ` Mathias Krause
  2015-06-13 12:26 ` [PATCH 07/12] ACPI / battery: mark DMI table as __initconst Mathias Krause
                   ` (6 subsequent siblings)
  12 siblings, 0 replies; 16+ messages in thread
From: Mathias Krause @ 2015-06-13 12:26 UTC (permalink / raw)
  To: Rafael J. Wysocki, Len Brown; +Cc: linux-acpi, Mathias Krause

Make the acpi_battery_units() function take a const argument and return
a const char*, too. Also make it static. It probably doesn't matter, as
gcc will be clever enough to optimize and inline the code even without
these hints. However, we also get rid of a #ifdef block by moving the
function closer to its usage location, so it's at least a small gain in
code readability.

Signed-off-by: Mathias Krause <minipli@googlemail.com>
---
 drivers/acpi/battery.c |   14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)

diff --git a/drivers/acpi/battery.c b/drivers/acpi/battery.c
index 8ec28e395fa1..309ba02d4eb8 100644
--- a/drivers/acpi/battery.c
+++ b/drivers/acpi/battery.c
@@ -338,14 +338,6 @@ static enum power_supply_property energy_battery_props[] = {
 	POWER_SUPPLY_PROP_SERIAL_NUMBER,
 };
 
-#ifdef CONFIG_ACPI_PROCFS_POWER
-inline char *acpi_battery_units(struct acpi_battery *battery)
-{
-	return (battery->power_unit == ACPI_BATTERY_POWER_UNIT_MA) ?
-		"mA" : "mW";
-}
-#endif
-
 /* --------------------------------------------------------------------------
                                Battery Management
    -------------------------------------------------------------------------- */
@@ -792,6 +784,12 @@ static void acpi_battery_refresh(struct acpi_battery *battery)
 #ifdef CONFIG_ACPI_PROCFS_POWER
 static struct proc_dir_entry *acpi_battery_dir;
 
+static const char *acpi_battery_units(const struct acpi_battery *battery)
+{
+	return (battery->power_unit == ACPI_BATTERY_POWER_UNIT_MA) ?
+		"mA" : "mW";
+}
+
 static int acpi_battery_print_info(struct seq_file *seq, int result)
 {
 	struct acpi_battery *battery = seq->private;
-- 
1.7.10.4


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

* [PATCH 07/12] ACPI / battery: mark DMI table as __initconst
  2015-06-13 12:26 [PATCH 00/12] ACPI: constify patches and other minor fixes Mathias Krause
                   ` (5 preceding siblings ...)
  2015-06-13 12:26 ` [PATCH 06/12] ACPI / battery: minor tweaks to acpi_battery_units() Mathias Krause
@ 2015-06-13 12:26 ` Mathias Krause
  2015-06-13 12:26 ` [PATCH 08/12] ACPI / HED: constify ACPI device ids Mathias Krause
                   ` (5 subsequent siblings)
  12 siblings, 0 replies; 16+ messages in thread
From: Mathias Krause @ 2015-06-13 12:26 UTC (permalink / raw)
  To: Rafael J. Wysocki, Len Brown; +Cc: linux-acpi, Mathias Krause

The bat_dmi_table[] DMI table is referenced from the __init function
acpi_battery_init_async() only. It and its referenced functions can
therefore be marked __initconst to free up ~1kB of runtime memory after
initialization is done.

Signed-off-by: Mathias Krause <minipli@googlemail.com>
---
 drivers/acpi/battery.c |    8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/acpi/battery.c b/drivers/acpi/battery.c
index 309ba02d4eb8..9bc379c7de5f 100644
--- a/drivers/acpi/battery.c
+++ b/drivers/acpi/battery.c
@@ -1123,19 +1123,21 @@ static int battery_notify(struct notifier_block *nb,
 	return 0;
 }
 
-static int battery_bix_broken_package_quirk(const struct dmi_system_id *d)
+static int __init
+battery_bix_broken_package_quirk(const struct dmi_system_id *d)
 {
 	battery_bix_broken_package = 1;
 	return 0;
 }
 
-static int battery_notification_delay_quirk(const struct dmi_system_id *d)
+static int __init
+battery_notification_delay_quirk(const struct dmi_system_id *d)
 {
 	battery_notification_delay_ms = 1000;
 	return 0;
 }
 
-static struct dmi_system_id bat_dmi_table[] = {
+static const struct dmi_system_id bat_dmi_table[] __initconst = {
 	{
 		.callback = battery_bix_broken_package_quirk,
 		.ident = "NEC LZ750/LS",
-- 
1.7.10.4


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

* [PATCH 08/12] ACPI / HED: constify ACPI device ids
  2015-06-13 12:26 [PATCH 00/12] ACPI: constify patches and other minor fixes Mathias Krause
                   ` (6 preceding siblings ...)
  2015-06-13 12:26 ` [PATCH 07/12] ACPI / battery: mark DMI table as __initconst Mathias Krause
@ 2015-06-13 12:26 ` Mathias Krause
  2015-06-13 12:26 ` [PATCH 09/12] ACPI / processor: constify DMI system id table Mathias Krause
                   ` (4 subsequent siblings)
  12 siblings, 0 replies; 16+ messages in thread
From: Mathias Krause @ 2015-06-13 12:26 UTC (permalink / raw)
  To: Rafael J. Wysocki, Len Brown; +Cc: linux-acpi, Mathias Krause

Constify the acpi_hed_ids[] ACPI device IDs array -- no need to have it
writeable.

Signed-off-by: Mathias Krause <minipli@googlemail.com>
---
 drivers/acpi/hed.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/acpi/hed.c b/drivers/acpi/hed.c
index aafe3ca829c2..a322710b5ba4 100644
--- a/drivers/acpi/hed.c
+++ b/drivers/acpi/hed.c
@@ -27,7 +27,7 @@
 #include <linux/acpi.h>
 #include <acpi/hed.h>
 
-static struct acpi_device_id acpi_hed_ids[] = {
+static const struct acpi_device_id acpi_hed_ids[] = {
 	{"PNP0C33", 0},
 	{"", 0},
 };
-- 
1.7.10.4


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

* [PATCH 09/12] ACPI / processor: constify DMI system id table
  2015-06-13 12:26 [PATCH 00/12] ACPI: constify patches and other minor fixes Mathias Krause
                   ` (7 preceding siblings ...)
  2015-06-13 12:26 ` [PATCH 08/12] ACPI / HED: constify ACPI device ids Mathias Krause
@ 2015-06-13 12:26 ` Mathias Krause
  2015-06-13 12:26 ` [PATCH 10/12] ACPI / scan: constify ACPI device ids Mathias Krause
                   ` (3 subsequent siblings)
  12 siblings, 0 replies; 16+ messages in thread
From: Mathias Krause @ 2015-06-13 12:26 UTC (permalink / raw)
  To: Rafael J. Wysocki, Len Brown; +Cc: linux-acpi, Mathias Krause

There is no need to have processor_power_dmi_table[] writeable, constify
it.

Signed-off-by: Mathias Krause <minipli@googlemail.com>
---
 drivers/acpi/processor_idle.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/acpi/processor_idle.c b/drivers/acpi/processor_idle.c
index 39e0c8e36244..d540f42c9232 100644
--- a/drivers/acpi/processor_idle.c
+++ b/drivers/acpi/processor_idle.c
@@ -94,7 +94,7 @@ static int set_max_cstate(const struct dmi_system_id *id)
 	return 0;
 }
 
-static struct dmi_system_id processor_power_dmi_table[] = {
+static const struct dmi_system_id processor_power_dmi_table[] = {
 	{ set_max_cstate, "Clevo 5600D", {
 	  DMI_MATCH(DMI_BIOS_VENDOR,"Phoenix Technologies LTD"),
 	  DMI_MATCH(DMI_BIOS_VERSION,"SHE845M0.86C.0013.D.0302131307")},
-- 
1.7.10.4


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

* [PATCH 10/12] ACPI / scan: constify ACPI device ids
  2015-06-13 12:26 [PATCH 00/12] ACPI: constify patches and other minor fixes Mathias Krause
                   ` (8 preceding siblings ...)
  2015-06-13 12:26 ` [PATCH 09/12] ACPI / processor: constify DMI system id table Mathias Krause
@ 2015-06-13 12:26 ` Mathias Krause
  2015-06-13 12:26 ` [PATCH 11/12] ACPI / video: constify ACPI and DMI id tables Mathias Krause
                   ` (2 subsequent siblings)
  12 siblings, 0 replies; 16+ messages in thread
From: Mathias Krause @ 2015-06-13 12:26 UTC (permalink / raw)
  To: Rafael J. Wysocki, Len Brown; +Cc: linux-acpi, Mathias Krause

Make the button ACPI device ID array static const. Safes us a little bit
of code.

Signed-off-by: Mathias Krause <minipli@googlemail.com>
---
 drivers/acpi/scan.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c
index 03141aa4ea95..7d30edc5777c 100644
--- a/drivers/acpi/scan.c
+++ b/drivers/acpi/scan.c
@@ -1671,7 +1671,7 @@ static int acpi_bus_extract_wakeup_device_power_package(acpi_handle handle,
 
 static void acpi_wakeup_gpe_init(struct acpi_device *device)
 {
-	struct acpi_device_id button_device_ids[] = {
+	static const struct acpi_device_id button_device_ids[] = {
 		{"PNP0C0C", 0},
 		{"PNP0C0D", 0},
 		{"PNP0C0E", 0},
-- 
1.7.10.4


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

* [PATCH 11/12] ACPI / video: constify ACPI and DMI id tables
  2015-06-13 12:26 [PATCH 00/12] ACPI: constify patches and other minor fixes Mathias Krause
                   ` (9 preceding siblings ...)
  2015-06-13 12:26 ` [PATCH 10/12] ACPI / scan: constify ACPI device ids Mathias Krause
@ 2015-06-13 12:26 ` Mathias Krause
  2015-06-13 12:27 ` [PATCH 12/12] ACPI: Constify ACPI device IDs in documentation Mathias Krause
  2015-06-15 22:49 ` [PATCH 00/12] ACPI: constify patches and other minor fixes Rafael J. Wysocki
  12 siblings, 0 replies; 16+ messages in thread
From: Mathias Krause @ 2015-06-13 12:26 UTC (permalink / raw)
  To: Rafael J. Wysocki, Len Brown; +Cc: linux-acpi, Mathias Krause

Make the video ACPI device ID array static and constify the DMI system
IDs array. Safes us a little bit of code.

Signed-off-by: Mathias Krause <minipli@googlemail.com>
---
 drivers/acpi/video_detect.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/acpi/video_detect.c b/drivers/acpi/video_detect.c
index c42feb2bacd0..be825802b228 100644
--- a/drivers/acpi/video_detect.c
+++ b/drivers/acpi/video_detect.c
@@ -109,7 +109,7 @@ find_video(acpi_handle handle, u32 lvl, void *context, void **rv)
 	struct pci_dev *dev;
 	struct acpi_device *acpi_dev;
 
-	const struct acpi_device_id video_ids[] = {
+	static const struct acpi_device_id video_ids[] = {
 		{ACPI_VIDEO_HID, 0},
 		{"", 0},
 	};
@@ -134,7 +134,7 @@ static int video_detect_force_vendor(const struct dmi_system_id *d)
 	return 0;
 }
 
-static struct dmi_system_id video_detect_dmi_table[] = {
+static const struct dmi_system_id video_detect_dmi_table[] = {
 	/* On Samsung X360, the BIOS will set a flag (VDRV) if generic
 	 * ACPI backlight device is used. This flag will definitively break
 	 * the backlight interface (even the vendor interface) untill next
-- 
1.7.10.4


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

* [PATCH 12/12] ACPI: Constify ACPI device IDs in documentation
  2015-06-13 12:26 [PATCH 00/12] ACPI: constify patches and other minor fixes Mathias Krause
                   ` (10 preceding siblings ...)
  2015-06-13 12:26 ` [PATCH 11/12] ACPI / video: constify ACPI and DMI id tables Mathias Krause
@ 2015-06-13 12:27 ` Mathias Krause
  2015-06-15 22:49 ` [PATCH 00/12] ACPI: constify patches and other minor fixes Rafael J. Wysocki
  12 siblings, 0 replies; 16+ messages in thread
From: Mathias Krause @ 2015-06-13 12:27 UTC (permalink / raw)
  To: Rafael J. Wysocki, Len Brown; +Cc: linux-acpi, Mathias Krause

ACPI device ID arrays normally don't need to be written to as they're
only ever read. The common usage -- embedding pointers to acpi_device_id
arrays in other data structures -- reference them as 'const', e.g. as in
struct acpi_driver / acpi_scan_handler / device_driver. The matchers are
taking const pointers, too. So it's only natural, to propose using const
arrays. Change the documentation accordingly.

Signed-off-by: Mathias Krause <minipli@googlemail.com>
---
 Documentation/acpi/enumeration.txt |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/Documentation/acpi/enumeration.txt b/Documentation/acpi/enumeration.txt
index 15dfce708ebf..1beaac8433b6 100644
--- a/Documentation/acpi/enumeration.txt
+++ b/Documentation/acpi/enumeration.txt
@@ -42,7 +42,7 @@ Adding ACPI support for an existing driver should be pretty
 straightforward. Here is the simplest example:
 
 	#ifdef CONFIG_ACPI
-	static struct acpi_device_id mydrv_acpi_match[] = {
+	static const struct acpi_device_id mydrv_acpi_match[] = {
 		/* ACPI IDs here */
 		{ }
 	};
@@ -166,7 +166,7 @@ the platform device drivers. Below is an example where we add ACPI support
 to at25 SPI eeprom driver (this is meant for the above ACPI snippet):
 
 	#ifdef CONFIG_ACPI
-	static struct acpi_device_id at25_acpi_match[] = {
+	static const struct acpi_device_id at25_acpi_match[] = {
 		{ "AT25", 0 },
 		{ },
 	};
@@ -230,7 +230,7 @@ Below is an example of how to add ACPI support to the existing mpu3050
 input driver:
 
 	#ifdef CONFIG_ACPI
-	static struct acpi_device_id mpu3050_acpi_match[] = {
+	static const struct acpi_device_id mpu3050_acpi_match[] = {
 		{ "MPU3050", 0 },
 		{ },
 	};
-- 
1.7.10.4


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

* Re: [PATCH 00/12] ACPI: constify patches and other minor fixes
  2015-06-13 12:26 [PATCH 00/12] ACPI: constify patches and other minor fixes Mathias Krause
                   ` (11 preceding siblings ...)
  2015-06-13 12:27 ` [PATCH 12/12] ACPI: Constify ACPI device IDs in documentation Mathias Krause
@ 2015-06-15 22:49 ` Rafael J. Wysocki
  2015-06-16  5:20   ` Mathias Krause
  12 siblings, 1 reply; 16+ messages in thread
From: Rafael J. Wysocki @ 2015-06-15 22:49 UTC (permalink / raw)
  To: Mathias Krause; +Cc: Len Brown, linux-acpi

On Saturday, June 13, 2015 02:26:48 PM Mathias Krause wrote:
> Hi Rafael, Len,
> 
> this series constifies a few variables in the ACPI code that are read
> only and therefore can be const. The main goal is to constify all users
> of struct acpi_device_id, but while digging through the code I found a
> few other places that could be improved too (constifying other variables
> in patches 1, 2, 4 and 9 as adding __init annotations where sensible in
> patch 7 or dropping bogus annotations in patch 3).
> 
> This series only handles the ACPI related bits for the constification of
> struct acpi_device_id but all other users have been changed too (you've
> been Cc'ed on the corresponding patches).
> 
> Please apply!

I've queued up the series for 4.2 except for patches [3/12] and [4/12].

My recollection of the __refdata in the processor driver is that it was needed
for some obscure reason, so that one requires some more thorough code inspection
and the [4/12] gets in the way of something (I'll apply it later when I'm done
with that other thing).


-- 
I speak only for myself.
Rafael J. Wysocki, Intel Open Source Technology Center.

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

* Re: [PATCH 00/12] ACPI: constify patches and other minor fixes
  2015-06-15 22:49 ` [PATCH 00/12] ACPI: constify patches and other minor fixes Rafael J. Wysocki
@ 2015-06-16  5:20   ` Mathias Krause
  2015-06-17 22:16     ` Rafael J. Wysocki
  0 siblings, 1 reply; 16+ messages in thread
From: Mathias Krause @ 2015-06-16  5:20 UTC (permalink / raw)
  To: Rafael J. Wysocki; +Cc: Len Brown, linux-acpi

On 16 June 2015 at 00:49, Rafael J. Wysocki <rjw@rjwysocki.net> wrote:
> On Saturday, June 13, 2015 02:26:48 PM Mathias Krause wrote:
>> this series constifies a few variables in the ACPI code that are read
>> only and therefore can be const. The main goal is to constify all users
>> of struct acpi_device_id, but while digging through the code I found a
>> few other places that could be improved too (constifying other variables
>> in patches 1, 2, 4 and 9 as adding __init annotations where sensible in
>> patch 7 or dropping bogus annotations in patch 3).
>
> I've queued up the series for 4.2 except for patches [3/12] and [4/12].
>
> My recollection of the __refdata in the processor driver is that it was needed
> for some obscure reason, so that one requires some more thorough code inspection

I guess it was needed for the __cpuinit annotation (see e.g.
v3.11-rc1:drivers/acpi/acpi_processor.c). But that one was dropped
during the development of v3.11 in commit fe7bf106ebc2 "acpi: delete
__cpuinit usage from all acpi files", obsoleting the need for the
__refdata annotation.

Should I update the patch description and resend a v2?

> and the [4/12] gets in the way of something (I'll apply it later when I'm done
> with that other thing).

Okay, thanks.


Mathias

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

* Re: [PATCH 00/12] ACPI: constify patches and other minor fixes
  2015-06-16  5:20   ` Mathias Krause
@ 2015-06-17 22:16     ` Rafael J. Wysocki
  0 siblings, 0 replies; 16+ messages in thread
From: Rafael J. Wysocki @ 2015-06-17 22:16 UTC (permalink / raw)
  To: Mathias Krause; +Cc: Len Brown, linux-acpi

On Tuesday, June 16, 2015 07:20:32 AM Mathias Krause wrote:
> On 16 June 2015 at 00:49, Rafael J. Wysocki <rjw@rjwysocki.net> wrote:
> > On Saturday, June 13, 2015 02:26:48 PM Mathias Krause wrote:
> >> this series constifies a few variables in the ACPI code that are read
> >> only and therefore can be const. The main goal is to constify all users
> >> of struct acpi_device_id, but while digging through the code I found a
> >> few other places that could be improved too (constifying other variables
> >> in patches 1, 2, 4 and 9 as adding __init annotations where sensible in
> >> patch 7 or dropping bogus annotations in patch 3).
> >
> > I've queued up the series for 4.2 except for patches [3/12] and [4/12].
> >
> > My recollection of the __refdata in the processor driver is that it was needed
> > for some obscure reason, so that one requires some more thorough code inspection
> 
> I guess it was needed for the __cpuinit annotation (see e.g.
> v3.11-rc1:drivers/acpi/acpi_processor.c). But that one was dropped
> during the development of v3.11 in commit fe7bf106ebc2 "acpi: delete
> __cpuinit usage from all acpi files", obsoleting the need for the
> __refdata annotation.
> 
> Should I update the patch description and resend a v2?

Yes, please.


-- 
I speak only for myself.
Rafael J. Wysocki, Intel Open Source Technology Center.

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

end of thread, other threads:[~2015-06-17 21:50 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-06-13 12:26 [PATCH 00/12] ACPI: constify patches and other minor fixes Mathias Krause
2015-06-13 12:26 ` [PATCH 01/12] ACPI / AC: constify DMI system id table Mathias Krause
2015-06-13 12:26 ` [PATCH 02/12] ACPI / LPSS: constify device descriptors Mathias Krause
2015-06-13 12:26 ` [PATCH 03/12] ACPI / processor: remove bogus __refdata annotation Mathias Krause
2015-06-13 12:26 ` [PATCH 04/12] ACPI / PNP: constify device IDs Mathias Krause
2015-06-13 12:26 ` [PATCH 05/12] ACPI / battery: constify the offset tables Mathias Krause
2015-06-13 12:26 ` [PATCH 06/12] ACPI / battery: minor tweaks to acpi_battery_units() Mathias Krause
2015-06-13 12:26 ` [PATCH 07/12] ACPI / battery: mark DMI table as __initconst Mathias Krause
2015-06-13 12:26 ` [PATCH 08/12] ACPI / HED: constify ACPI device ids Mathias Krause
2015-06-13 12:26 ` [PATCH 09/12] ACPI / processor: constify DMI system id table Mathias Krause
2015-06-13 12:26 ` [PATCH 10/12] ACPI / scan: constify ACPI device ids Mathias Krause
2015-06-13 12:26 ` [PATCH 11/12] ACPI / video: constify ACPI and DMI id tables Mathias Krause
2015-06-13 12:27 ` [PATCH 12/12] ACPI: Constify ACPI device IDs in documentation Mathias Krause
2015-06-15 22:49 ` [PATCH 00/12] ACPI: constify patches and other minor fixes Rafael J. Wysocki
2015-06-16  5:20   ` Mathias Krause
2015-06-17 22:16     ` Rafael J. Wysocki

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.