All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 00/15] Random collection of x86 platform driver cleanups
@ 2014-07-16 17:43 Mathias Krause
  2014-07-16 17:43 ` [PATCH 01/15] MAINTAINERS: Update git URL for x86 platform drivers Mathias Krause
                   ` (14 more replies)
  0 siblings, 15 replies; 21+ messages in thread
From: Mathias Krause @ 2014-07-16 17:43 UTC (permalink / raw)
  To: Matthew Garrett; +Cc: platform-driver-x86, Mathias Krause

Hi Matthew,

this series is a rather random collection of cleanups for the x86
platform drivers. However, my main intention was to mark as much DMI
tables as possible as __initconst so their memory can be released
after initialization is done. This is especially useful for those
tables as they tend to be quite large (see, e.g., patch 2, which moves
~10 kB to the .init sections). Not all of them can be marked this way,
though, as some of the tables are referenced from non-init code, too.

Beside that DMI table markings a few cleanups slipped in I found while
hunting for the former, e.g. constification of r/o data structures or
declaring variables static that are only used within one compilation
unit.

Most important, patch 1 updates the git URL of the MAINTAINERS file,
so others know where to pull from, as well.

Please apply!


Mathias Krause (15):
  MAINTAINERS: Update git URL for x86 platform drivers
  acer-wmi: Mark init data and code as such
  acer-wmi: Mark acer_wmi_keymap[] as __initconst
  acer-wmi: Hide acer_{suspend,resume} for !CONFIG_PM_SLEEP
  alienware-wmi: Mark DMI table as __initconst
  asus-nb-wmi: Constify asus_quirks[] DMI table
  dell-laptop: Mark dell_quirks[] DMI table as __initconst
  eeepc-wmi: Constify asus_quirks[] DMI table
  fujitsu-laptop: Mark fujitsu_dmi_table[] DMI table as __initconst
  fujitsu-tablet: Mark DMI callbacks as __init code
  hp-wmi: Add missing __init annotations to initialization code
  hp_accel: Constify ACPI and DMI tables
  ideapad-laptop: Constify DMI table and other r/o variables
  intel_ips: Make ips_mcp_limits variables static
  thinkpad_acpi: Mark volume_alsa_control_{vol,mute} as __initdata

 MAINTAINERS                           |    2 +-
 drivers/platform/x86/acer-wmi.c       |   48 ++++++++++++++++++---------------
 drivers/platform/x86/alienware-wmi.c  |    4 +--
 drivers/platform/x86/asus-nb-wmi.c    |    2 +-
 drivers/platform/x86/dell-laptop.c    |    6 ++---
 drivers/platform/x86/eeepc-wmi.c      |    2 +-
 drivers/platform/x86/fujitsu-laptop.c |   10 +++----
 drivers/platform/x86/fujitsu-tablet.c |    6 ++---
 drivers/platform/x86/hp-wmi.c         |    6 ++---
 drivers/platform/x86/hp_accel.c       |    4 +--
 drivers/platform/x86/ideapad-laptop.c |    6 ++---
 drivers/platform/x86/intel_ips.c      |    6 ++---
 drivers/platform/x86/thinkpad_acpi.c  |    4 +--
 13 files changed, 56 insertions(+), 50 deletions(-)

-- 
1.7.10.4

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

* [PATCH 01/15] MAINTAINERS: Update git URL for x86 platform drivers
  2014-07-16 17:43 [PATCH 00/15] Random collection of x86 platform driver cleanups Mathias Krause
@ 2014-07-16 17:43 ` Mathias Krause
  2014-07-16 17:43 ` [PATCH 02/15] acer-wmi: Mark init data and code as such Mathias Krause
                   ` (13 subsequent siblings)
  14 siblings, 0 replies; 21+ messages in thread
From: Mathias Krause @ 2014-07-16 17:43 UTC (permalink / raw)
  To: Matthew Garrett; +Cc: platform-driver-x86, Mathias Krause

The repo on kernel.org is no longer available but has a replacement at
cavan.codon.org.uk.

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

diff --git a/MAINTAINERS b/MAINTAINERS
index c411c40d88..4e5554bbc6 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -9956,7 +9956,7 @@ F:	arch/x86/
 X86 PLATFORM DRIVERS
 M:	Matthew Garrett <matthew.garrett@nebula.com>
 L:	platform-driver-x86@vger.kernel.org
-T:	git git://git.kernel.org/pub/scm/linux/kernel/git/mjg59/platform-drivers-x86.git
+T:	git git://cavan.codon.org.uk/platform-drivers-x86.git
 S:	Maintained
 F:	drivers/platform/x86/
 
-- 
1.7.10.4

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

* [PATCH 02/15] acer-wmi: Mark init data and code as such
  2014-07-16 17:43 [PATCH 00/15] Random collection of x86 platform driver cleanups Mathias Krause
  2014-07-16 17:43 ` [PATCH 01/15] MAINTAINERS: Update git URL for x86 platform drivers Mathias Krause
@ 2014-07-16 17:43 ` Mathias Krause
  2014-07-29  3:18   ` joeyli
  2014-07-16 17:43 ` [PATCH 03/15] acer-wmi: Mark acer_wmi_keymap[] as __initconst Mathias Krause
                   ` (12 subsequent siblings)
  14 siblings, 1 reply; 21+ messages in thread
From: Mathias Krause @ 2014-07-16 17:43 UTC (permalink / raw)
  To: Matthew Garrett; +Cc: platform-driver-x86, Mathias Krause, Lee, Chun-Yi

Quite a lot of code and data of acer-wmi.c is only ever used during
initialization. Mark those accordingly -- and constify, where
appropriate -- so the memory can be released afterwards.

All in all those changes move ~10 kB of code and data to the .init
sections, marking them for release after initialization has finished.

Signed-off-by: Mathias Krause <minipli@googlemail.com>
Cc: "Lee, Chun-Yi" <jlee@suse.com>
---
 drivers/platform/x86/acer-wmi.c |   41 ++++++++++++++++++++-------------------
 1 file changed, 21 insertions(+), 20 deletions(-)

diff --git a/drivers/platform/x86/acer-wmi.c b/drivers/platform/x86/acer-wmi.c
index bbf78b2d6d..31f4da5061 100644
--- a/drivers/platform/x86/acer-wmi.c
+++ b/drivers/platform/x86/acer-wmi.c
@@ -294,7 +294,7 @@ struct quirk_entry {
 
 static struct quirk_entry *quirks;
 
-static void set_quirks(void)
+static void __init set_quirks(void)
 {
 	if (!interface)
 		return;
@@ -306,7 +306,7 @@ static void set_quirks(void)
 		interface->capability |= ACER_CAP_BRIGHTNESS;
 }
 
-static int dmi_matched(const struct dmi_system_id *dmi)
+static int __init dmi_matched(const struct dmi_system_id *dmi)
 {
 	quirks = dmi->driver_data;
 	return 1;
@@ -337,7 +337,7 @@ static struct quirk_entry quirk_lenovo_ideapad_s205 = {
 };
 
 /* The Aspire One has a dummy ACPI-WMI interface - disable it */
-static struct dmi_system_id acer_blacklist[] = {
+static const struct dmi_system_id acer_blacklist[] __initconst = {
 	{
 		.ident = "Acer Aspire One (SSD)",
 		.matches = {
@@ -355,7 +355,7 @@ static struct dmi_system_id acer_blacklist[] = {
 	{}
 };
 
-static struct dmi_system_id acer_quirks[] = {
+static const struct dmi_system_id acer_quirks[] __initconst = {
 	{
 		.callback = dmi_matched,
 		.ident = "Acer Aspire 1360",
@@ -530,14 +530,15 @@ static struct dmi_system_id acer_quirks[] = {
 	{}
 };
 
-static int video_set_backlight_video_vendor(const struct dmi_system_id *d)
+static int __init
+video_set_backlight_video_vendor(const struct dmi_system_id *d)
 {
 	interface->capability &= ~ACER_CAP_BRIGHTNESS;
 	pr_info("Brightness must be controlled by generic video driver\n");
 	return 0;
 }
 
-static const struct dmi_system_id video_vendor_dmi_table[] = {
+static const struct dmi_system_id video_vendor_dmi_table[] __initconst = {
 	{
 		.callback = video_set_backlight_video_vendor,
 		.ident = "Acer TravelMate 4750",
@@ -582,7 +583,7 @@ static const struct dmi_system_id video_vendor_dmi_table[] = {
 };
 
 /* Find which quirks are needed for a particular vendor/ model pair */
-static void find_quirks(void)
+static void __init find_quirks(void)
 {
 	if (!force_series) {
 		dmi_check_system(acer_quirks);
@@ -749,7 +750,7 @@ static acpi_status AMW0_set_u32(u32 value, u32 cap)
 	return wmab_execute(&args, NULL);
 }
 
-static acpi_status AMW0_find_mailled(void)
+static acpi_status __init AMW0_find_mailled(void)
 {
 	struct wmab_args args;
 	struct wmab_ret ret;
@@ -781,16 +782,16 @@ static acpi_status AMW0_find_mailled(void)
 	return AE_OK;
 }
 
-static int AMW0_set_cap_acpi_check_device_found;
+static int AMW0_set_cap_acpi_check_device_found __initdata;
 
-static acpi_status AMW0_set_cap_acpi_check_device_cb(acpi_handle handle,
+static acpi_status __init AMW0_set_cap_acpi_check_device_cb(acpi_handle handle,
 	u32 level, void *context, void **retval)
 {
 	AMW0_set_cap_acpi_check_device_found = 1;
 	return AE_OK;
 }
 
-static const struct acpi_device_id norfkill_ids[] = {
+static const struct acpi_device_id norfkill_ids[] __initconst = {
 	{ "VPC2004", 0},
 	{ "IBM0068", 0},
 	{ "LEN0068", 0},
@@ -798,7 +799,7 @@ static const struct acpi_device_id norfkill_ids[] = {
 	{ "", 0},
 };
 
-static int AMW0_set_cap_acpi_check_device(void)
+static int __init AMW0_set_cap_acpi_check_device(void)
 {
 	const struct acpi_device_id *id;
 
@@ -808,7 +809,7 @@ static int AMW0_set_cap_acpi_check_device(void)
 	return AMW0_set_cap_acpi_check_device_found;
 }
 
-static acpi_status AMW0_set_capabilities(void)
+static acpi_status __init AMW0_set_capabilities(void)
 {
 	struct wmab_args args;
 	struct wmab_ret ret;
@@ -1184,7 +1185,7 @@ static acpi_status wmid_v2_set_u32(u32 value, u32 cap)
 	return wmid3_set_device_status(value, device);
 }
 
-static void type_aa_dmi_decode(const struct dmi_header *header, void *dummy)
+static void __init type_aa_dmi_decode(const struct dmi_header *header, void *d)
 {
 	struct hotkey_function_type_aa *type_aa;
 
@@ -1209,7 +1210,7 @@ static void type_aa_dmi_decode(const struct dmi_header *header, void *dummy)
 	commun_fn_key_number = type_aa->commun_fn_key_number;
 }
 
-static acpi_status WMID_set_capabilities(void)
+static acpi_status __init WMID_set_capabilities(void)
 {
 	struct acpi_buffer out = {ACPI_ALLOCATE_BUFFER, NULL};
 	union acpi_object *obj;
@@ -1777,7 +1778,7 @@ static void acer_wmi_notify(u32 value, void *context)
 	}
 }
 
-static acpi_status
+static acpi_status __init
 wmid3_set_lm_mode(struct lm_input_params *params,
 		  struct lm_return_value *return_value)
 {
@@ -1811,7 +1812,7 @@ wmid3_set_lm_mode(struct lm_input_params *params,
 	return status;
 }
 
-static int acer_wmi_enable_ec_raw(void)
+static int __init acer_wmi_enable_ec_raw(void)
 {
 	struct lm_return_value return_value;
 	acpi_status status;
@@ -1834,7 +1835,7 @@ static int acer_wmi_enable_ec_raw(void)
 	return status;
 }
 
-static int acer_wmi_enable_lm(void)
+static int __init acer_wmi_enable_lm(void)
 {
 	struct lm_return_value return_value;
 	acpi_status status;
@@ -2120,7 +2121,7 @@ static int remove_sysfs(struct platform_device *device)
 	return 0;
 }
 
-static int create_sysfs(void)
+static int __init create_sysfs(void)
 {
 	int retval = -ENOMEM;
 
@@ -2149,7 +2150,7 @@ static void remove_debugfs(void)
 	debugfs_remove(interface->debug.root);
 }
 
-static int create_debugfs(void)
+static int __init create_debugfs(void)
 {
 	interface->debug.root = debugfs_create_dir("acer-wmi", NULL);
 	if (!interface->debug.root) {
-- 
1.7.10.4

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

* [PATCH 03/15] acer-wmi: Mark acer_wmi_keymap[] as __initconst
  2014-07-16 17:43 [PATCH 00/15] Random collection of x86 platform driver cleanups Mathias Krause
  2014-07-16 17:43 ` [PATCH 01/15] MAINTAINERS: Update git URL for x86 platform drivers Mathias Krause
  2014-07-16 17:43 ` [PATCH 02/15] acer-wmi: Mark init data and code as such Mathias Krause
@ 2014-07-16 17:43 ` Mathias Krause
  2014-07-29  3:21   ` joeyli
  2014-07-16 17:43 ` [PATCH 04/15] acer-wmi: Hide acer_{suspend,resume} for !CONFIG_PM_SLEEP Mathias Krause
                   ` (11 subsequent siblings)
  14 siblings, 1 reply; 21+ messages in thread
From: Mathias Krause @ 2014-07-16 17:43 UTC (permalink / raw)
  To: Matthew Garrett; +Cc: platform-driver-x86, Mathias Krause, Lee, Chun-Yi

sparse_keymap_setup() will make a copy of the keymap, so we can release
the master copy after initialization.

Signed-off-by: Mathias Krause <minipli@googlemail.com>
Cc: "Lee, Chun-Yi" <jlee@suse.com>
---
 drivers/platform/x86/acer-wmi.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/platform/x86/acer-wmi.c b/drivers/platform/x86/acer-wmi.c
index 31f4da5061..fde69ee63f 100644
--- a/drivers/platform/x86/acer-wmi.c
+++ b/drivers/platform/x86/acer-wmi.c
@@ -96,7 +96,7 @@ enum acer_wmi_event_ids {
 	WMID_ACCEL_EVENT = 0x5,
 };
 
-static const struct key_entry acer_wmi_keymap[] = {
+static const struct key_entry acer_wmi_keymap[] __initconst = {
 	{KE_KEY, 0x01, {KEY_WLAN} },     /* WiFi */
 	{KE_KEY, 0x03, {KEY_WLAN} },     /* WiFi */
 	{KE_KEY, 0x04, {KEY_WLAN} },     /* WiFi */
-- 
1.7.10.4

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

* [PATCH 04/15] acer-wmi: Hide acer_{suspend,resume} for !CONFIG_PM_SLEEP
  2014-07-16 17:43 [PATCH 00/15] Random collection of x86 platform driver cleanups Mathias Krause
                   ` (2 preceding siblings ...)
  2014-07-16 17:43 ` [PATCH 03/15] acer-wmi: Mark acer_wmi_keymap[] as __initconst Mathias Krause
@ 2014-07-16 17:43 ` Mathias Krause
  2014-07-29  3:21   ` joeyli
  2014-07-16 17:43 ` [PATCH 05/15] alienware-wmi: Mark DMI table as __initconst Mathias Krause
                   ` (10 subsequent siblings)
  14 siblings, 1 reply; 21+ messages in thread
From: Mathias Krause @ 2014-07-16 17:43 UTC (permalink / raw)
  To: Matthew Garrett; +Cc: platform-driver-x86, Mathias Krause, Lee, Chun-Yi

Encapsulate acer_suspend() and acer_resume with #ifdef CONFIG_PM_SLEEP
to get rid of the following warnings:

  ../acer-wmi.c:2046:12: warning: ‘acer_suspend’ defined but not used [-Wunused-function]
  ../acer-wmi.c:2068:12: warning: ‘acer_resume’ defined but not used [-Wunused-function]

Signed-off-by: Mathias Krause <minipli@googlemail.com>
Cc: "Lee, Chun-Yi" <jlee@suse.com>
---
 drivers/platform/x86/acer-wmi.c |    5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/platform/x86/acer-wmi.c b/drivers/platform/x86/acer-wmi.c
index fde69ee63f..0d18c23d66 100644
--- a/drivers/platform/x86/acer-wmi.c
+++ b/drivers/platform/x86/acer-wmi.c
@@ -2044,6 +2044,7 @@ static int acer_platform_remove(struct platform_device *device)
 	return 0;
 }
 
+#ifdef CONFIG_PM_SLEEP
 static int acer_suspend(struct device *dev)
 {
 	u32 value;
@@ -2084,6 +2085,10 @@ static int acer_resume(struct device *dev)
 
 	return 0;
 }
+#else
+#define acer_suspend	NULL
+#define acer_resume	NULL
+#endif
 
 static SIMPLE_DEV_PM_OPS(acer_pm, acer_suspend, acer_resume);
 
-- 
1.7.10.4

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

* [PATCH 05/15] alienware-wmi: Mark DMI table as __initconst
  2014-07-16 17:43 [PATCH 00/15] Random collection of x86 platform driver cleanups Mathias Krause
                   ` (3 preceding siblings ...)
  2014-07-16 17:43 ` [PATCH 04/15] acer-wmi: Hide acer_{suspend,resume} for !CONFIG_PM_SLEEP Mathias Krause
@ 2014-07-16 17:43 ` Mathias Krause
  2014-07-16 17:43 ` [PATCH 06/15] asus-nb-wmi: Constify asus_quirks[] DMI table Mathias Krause
                   ` (9 subsequent siblings)
  14 siblings, 0 replies; 21+ messages in thread
From: Mathias Krause @ 2014-07-16 17:43 UTC (permalink / raw)
  To: Matthew Garrett; +Cc: platform-driver-x86, Mathias Krause

The DMI table is only ever used during initialization. Mark it as
__initconst so its memory can be released appropriately. In turn, the
callback function can be marked with __init, too.

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

diff --git a/drivers/platform/x86/alienware-wmi.c b/drivers/platform/x86/alienware-wmi.c
index 297b664021..cdbaf3c532 100644
--- a/drivers/platform/x86/alienware-wmi.c
+++ b/drivers/platform/x86/alienware-wmi.c
@@ -71,13 +71,13 @@ static struct quirk_entry quirk_x51_family = {
 	.num_zones = 3,
 };
 
-static int dmi_matched(const struct dmi_system_id *dmi)
+static int __init dmi_matched(const struct dmi_system_id *dmi)
 {
 	quirks = dmi->driver_data;
 	return 1;
 }
 
-static struct dmi_system_id alienware_quirks[] = {
+static const struct dmi_system_id alienware_quirks[] __initconst = {
 	{
 	 .callback = dmi_matched,
 	 .ident = "Alienware X51 R1",
-- 
1.7.10.4

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

* [PATCH 06/15] asus-nb-wmi: Constify asus_quirks[] DMI table
  2014-07-16 17:43 [PATCH 00/15] Random collection of x86 platform driver cleanups Mathias Krause
                   ` (4 preceding siblings ...)
  2014-07-16 17:43 ` [PATCH 05/15] alienware-wmi: Mark DMI table as __initconst Mathias Krause
@ 2014-07-16 17:43 ` Mathias Krause
  2014-07-16 17:43 ` [PATCH 07/15] dell-laptop: Mark dell_quirks[] DMI table as __initconst Mathias Krause
                   ` (8 subsequent siblings)
  14 siblings, 0 replies; 21+ messages in thread
From: Mathias Krause @ 2014-07-16 17:43 UTC (permalink / raw)
  To: Matthew Garrett; +Cc: platform-driver-x86, Mathias Krause, Corentin Chary

Constify the asus_quirks[] DMI table. There's no need to have it
writeable during runtime.

Signed-off-by: Mathias Krause <minipli@googlemail.com>
Cc: Corentin Chary <corentin.chary@gmail.com>
---
 drivers/platform/x86/asus-nb-wmi.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/platform/x86/asus-nb-wmi.c b/drivers/platform/x86/asus-nb-wmi.c
index ddf0eefd86..98f68c71b7 100644
--- a/drivers/platform/x86/asus-nb-wmi.c
+++ b/drivers/platform/x86/asus-nb-wmi.c
@@ -80,7 +80,7 @@ static int dmi_matched(const struct dmi_system_id *dmi)
 	return 1;
 }
 
-static struct dmi_system_id asus_quirks[] = {
+static const struct dmi_system_id asus_quirks[] = {
 	{
 		.callback = dmi_matched,
 		.ident = "ASUSTeK COMPUTER INC. X401U",
-- 
1.7.10.4

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

* [PATCH 07/15] dell-laptop: Mark dell_quirks[] DMI table as __initconst
  2014-07-16 17:43 [PATCH 00/15] Random collection of x86 platform driver cleanups Mathias Krause
                   ` (5 preceding siblings ...)
  2014-07-16 17:43 ` [PATCH 06/15] asus-nb-wmi: Constify asus_quirks[] DMI table Mathias Krause
@ 2014-07-16 17:43 ` Mathias Krause
  2014-07-16 17:43 ` [PATCH 08/15] eeepc-wmi: Constify asus_quirks[] DMI table Mathias Krause
                   ` (7 subsequent siblings)
  14 siblings, 0 replies; 21+ messages in thread
From: Mathias Krause @ 2014-07-16 17:43 UTC (permalink / raw)
  To: Matthew Garrett; +Cc: platform-driver-x86, Mathias Krause

The dell_quirks[] DMI table is only ever used during initialization.
Mark it as __initconst so its memory can be released afterwards --
roughly 5.7 kB. In turn, the callback function can be marked with
__init, too.

Also the touchpad_led_init() function can be marked __init as it's only
referenced from dell_init() -- an __init function.

Signed-off-by: Mathias Krause <minipli@googlemail.com>
---
 drivers/platform/x86/dell-laptop.c |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/platform/x86/dell-laptop.c b/drivers/platform/x86/dell-laptop.c
index fed4111ac3..233d2ee598 100644
--- a/drivers/platform/x86/dell-laptop.c
+++ b/drivers/platform/x86/dell-laptop.c
@@ -70,7 +70,7 @@ static struct quirk_entry quirk_dell_vostro_v130 = {
 	.touchpad_led = 1,
 };
 
-static int dmi_matched(const struct dmi_system_id *dmi)
+static int __init dmi_matched(const struct dmi_system_id *dmi)
 {
 	quirks = dmi->driver_data;
 	return 1;
@@ -123,7 +123,7 @@ static const struct dmi_system_id dell_device_table[] __initconst = {
 };
 MODULE_DEVICE_TABLE(dmi, dell_device_table);
 
-static struct dmi_system_id dell_quirks[] = {
+static const struct dmi_system_id dell_quirks[] __initconst = {
 	{
 		.callback = dmi_matched,
 		.ident = "Dell Vostro V130",
@@ -780,7 +780,7 @@ static struct led_classdev touchpad_led = {
 	.flags = LED_CORE_SUSPENDRESUME,
 };
 
-static int touchpad_led_init(struct device *dev)
+static int __init touchpad_led_init(struct device *dev)
 {
 	return led_classdev_register(dev, &touchpad_led);
 }
-- 
1.7.10.4

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

* [PATCH 08/15] eeepc-wmi: Constify asus_quirks[] DMI table
  2014-07-16 17:43 [PATCH 00/15] Random collection of x86 platform driver cleanups Mathias Krause
                   ` (6 preceding siblings ...)
  2014-07-16 17:43 ` [PATCH 07/15] dell-laptop: Mark dell_quirks[] DMI table as __initconst Mathias Krause
@ 2014-07-16 17:43 ` Mathias Krause
  2014-07-16 17:43 ` [PATCH 09/15] fujitsu-laptop: Mark fujitsu_dmi_table[] DMI table as __initconst Mathias Krause
                   ` (6 subsequent siblings)
  14 siblings, 0 replies; 21+ messages in thread
From: Mathias Krause @ 2014-07-16 17:43 UTC (permalink / raw)
  To: Matthew Garrett; +Cc: platform-driver-x86, Mathias Krause, Corentin Chary

Constify the asus_quirks[] DMI table. There's no need to have it
writeable during runtime.

Signed-off-by: Mathias Krause <minipli@googlemail.com>
Cc: Corentin Chary <corentin.chary@gmail.com>
---
 drivers/platform/x86/eeepc-wmi.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/platform/x86/eeepc-wmi.c b/drivers/platform/x86/eeepc-wmi.c
index 6112933f62..14fd2ecb06 100644
--- a/drivers/platform/x86/eeepc-wmi.c
+++ b/drivers/platform/x86/eeepc-wmi.c
@@ -145,7 +145,7 @@ static int dmi_matched(const struct dmi_system_id *dmi)
 	return 1;
 }
 
-static struct dmi_system_id asus_quirks[] = {
+static const struct dmi_system_id asus_quirks[] = {
 	{
 		.callback = dmi_matched,
 		.ident = "ASUSTeK Computer INC. 1000H",
-- 
1.7.10.4

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

* [PATCH 09/15] fujitsu-laptop: Mark fujitsu_dmi_table[] DMI table as __initconst
  2014-07-16 17:43 [PATCH 00/15] Random collection of x86 platform driver cleanups Mathias Krause
                   ` (7 preceding siblings ...)
  2014-07-16 17:43 ` [PATCH 08/15] eeepc-wmi: Constify asus_quirks[] DMI table Mathias Krause
@ 2014-07-16 17:43 ` Mathias Krause
  2014-07-16 22:59   ` Jonathan Woithe
  2014-07-16 17:43 ` [PATCH 10/15] fujitsu-tablet: Mark DMI callbacks as __init code Mathias Krause
                   ` (5 subsequent siblings)
  14 siblings, 1 reply; 21+ messages in thread
From: Mathias Krause @ 2014-07-16 17:43 UTC (permalink / raw)
  To: Matthew Garrett; +Cc: platform-driver-x86, Mathias Krause, Jonathan Woithe

The DMI table is only ever used during initialization. Mark it as
__initconst so its memory can be released afterwards -- roughly 1.5 kB.
In turn, the callback functions can be marked with __init, too.

Signed-off-by: Mathias Krause <minipli@googlemail.com>
Cc: Jonathan Woithe <jwoithe@just42.net>
---
 drivers/platform/x86/fujitsu-laptop.c |   10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/platform/x86/fujitsu-laptop.c b/drivers/platform/x86/fujitsu-laptop.c
index e6f336270c..e9345f12ce 100644
--- a/drivers/platform/x86/fujitsu-laptop.c
+++ b/drivers/platform/x86/fujitsu-laptop.c
@@ -564,7 +564,7 @@ static struct platform_driver fujitsupf_driver = {
 		   }
 };
 
-static void dmi_check_cb_common(const struct dmi_system_id *id)
+static void __init dmi_check_cb_common(const struct dmi_system_id *id)
 {
 	pr_info("Identified laptop model '%s'\n", id->ident);
 	if (use_alt_lcd_levels == -1) {
@@ -578,7 +578,7 @@ static void dmi_check_cb_common(const struct dmi_system_id *id)
 	}
 }
 
-static int dmi_check_cb_s6410(const struct dmi_system_id *id)
+static int __init dmi_check_cb_s6410(const struct dmi_system_id *id)
 {
 	dmi_check_cb_common(id);
 	fujitsu->keycode1 = KEY_SCREENLOCK;	/* "Lock" */
@@ -586,7 +586,7 @@ static int dmi_check_cb_s6410(const struct dmi_system_id *id)
 	return 1;
 }
 
-static int dmi_check_cb_s6420(const struct dmi_system_id *id)
+static int __init dmi_check_cb_s6420(const struct dmi_system_id *id)
 {
 	dmi_check_cb_common(id);
 	fujitsu->keycode1 = KEY_SCREENLOCK;	/* "Lock" */
@@ -594,7 +594,7 @@ static int dmi_check_cb_s6420(const struct dmi_system_id *id)
 	return 1;
 }
 
-static int dmi_check_cb_p8010(const struct dmi_system_id *id)
+static int __init dmi_check_cb_p8010(const struct dmi_system_id *id)
 {
 	dmi_check_cb_common(id);
 	fujitsu->keycode1 = KEY_HELP;	/* "Support" */
@@ -603,7 +603,7 @@ static int dmi_check_cb_p8010(const struct dmi_system_id *id)
 	return 1;
 }
 
-static struct dmi_system_id fujitsu_dmi_table[] = {
+static const struct dmi_system_id fujitsu_dmi_table[] __initconst = {
 	{
 	 .ident = "Fujitsu Siemens S6410",
 	 .matches = {
-- 
1.7.10.4

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

* [PATCH 10/15] fujitsu-tablet: Mark DMI callbacks as __init code
  2014-07-16 17:43 [PATCH 00/15] Random collection of x86 platform driver cleanups Mathias Krause
                   ` (8 preceding siblings ...)
  2014-07-16 17:43 ` [PATCH 09/15] fujitsu-laptop: Mark fujitsu_dmi_table[] DMI table as __initconst Mathias Krause
@ 2014-07-16 17:43 ` Mathias Krause
  2014-07-16 17:43 ` [PATCH 11/15] hp-wmi: Add missing __init annotations to initialization code Mathias Krause
                   ` (4 subsequent siblings)
  14 siblings, 0 replies; 21+ messages in thread
From: Mathias Krause @ 2014-07-16 17:43 UTC (permalink / raw)
  To: Matthew Garrett; +Cc: platform-driver-x86, Mathias Krause, Robert Gerlach

The DMI table is already marked as __initconst, so can be the callback
functions as they're only used in that context.

Signed-off-by: Mathias Krause <minipli@googlemail.com>
Cc: Robert Gerlach <khnz@gmx.de>
---
 drivers/platform/x86/fujitsu-tablet.c |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/platform/x86/fujitsu-tablet.c b/drivers/platform/x86/fujitsu-tablet.c
index c3784bacea..53bdbb01bd 100644
--- a/drivers/platform/x86/fujitsu-tablet.c
+++ b/drivers/platform/x86/fujitsu-tablet.c
@@ -315,21 +315,21 @@ static irqreturn_t fujitsu_interrupt(int irq, void *dev_id)
 	return IRQ_HANDLED;
 }
 
-static void fujitsu_dmi_common(const struct dmi_system_id *dmi)
+static void __init fujitsu_dmi_common(const struct dmi_system_id *dmi)
 {
 	pr_info("%s\n", dmi->ident);
 	memcpy(fujitsu.config.keymap, dmi->driver_data,
 			sizeof(fujitsu.config.keymap));
 }
 
-static int fujitsu_dmi_lifebook(const struct dmi_system_id *dmi)
+static int __init fujitsu_dmi_lifebook(const struct dmi_system_id *dmi)
 {
 	fujitsu_dmi_common(dmi);
 	fujitsu.config.quirks |= INVERT_TABLET_MODE_BIT;
 	return 1;
 }
 
-static int fujitsu_dmi_stylistic(const struct dmi_system_id *dmi)
+static int __init fujitsu_dmi_stylistic(const struct dmi_system_id *dmi)
 {
 	fujitsu_dmi_common(dmi);
 	fujitsu.config.quirks |= FORCE_TABLET_MODE_IF_UNDOCK;
-- 
1.7.10.4

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

* [PATCH 11/15] hp-wmi: Add missing __init annotations to initialization code
  2014-07-16 17:43 [PATCH 00/15] Random collection of x86 platform driver cleanups Mathias Krause
                   ` (9 preceding siblings ...)
  2014-07-16 17:43 ` [PATCH 10/15] fujitsu-tablet: Mark DMI callbacks as __init code Mathias Krause
@ 2014-07-16 17:43 ` Mathias Krause
  2014-07-16 17:43 ` [PATCH 12/15] hp_accel: Constify ACPI and DMI tables Mathias Krause
                   ` (3 subsequent siblings)
  14 siblings, 0 replies; 21+ messages in thread
From: Mathias Krause @ 2014-07-16 17:43 UTC (permalink / raw)
  To: Matthew Garrett; +Cc: platform-driver-x86, Mathias Krause

These functions are only called from other initialization routines, so
can be marked __init, too.

Signed-off-by: Mathias Krause <minipli@googlemail.com>
---
 drivers/platform/x86/hp-wmi.c |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/platform/x86/hp-wmi.c b/drivers/platform/x86/hp-wmi.c
index 484a8673b8..4c559640dc 100644
--- a/drivers/platform/x86/hp-wmi.c
+++ b/drivers/platform/x86/hp-wmi.c
@@ -295,7 +295,7 @@ static int hp_wmi_tablet_state(void)
 	return (state & 0x4) ? 1 : 0;
 }
 
-static int hp_wmi_bios_2009_later(void)
+static int __init hp_wmi_bios_2009_later(void)
 {
 	int state = 0;
 	int ret = hp_wmi_perform_query(HPWMI_FEATURE_QUERY, 0, &state,
@@ -704,7 +704,7 @@ static void cleanup_sysfs(struct platform_device *device)
 	device_remove_file(&device->dev, &dev_attr_postcode);
 }
 
-static int hp_wmi_rfkill_setup(struct platform_device *device)
+static int __init hp_wmi_rfkill_setup(struct platform_device *device)
 {
 	int err;
 	int wireless = 0;
@@ -806,7 +806,7 @@ register_wifi_error:
 	return err;
 }
 
-static int hp_wmi_rfkill2_setup(struct platform_device *device)
+static int __init hp_wmi_rfkill2_setup(struct platform_device *device)
 {
 	int err, i;
 	struct bios_rfkill2_state state;
-- 
1.7.10.4

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

* [PATCH 12/15] hp_accel: Constify ACPI and DMI tables
  2014-07-16 17:43 [PATCH 00/15] Random collection of x86 platform driver cleanups Mathias Krause
                   ` (10 preceding siblings ...)
  2014-07-16 17:43 ` [PATCH 11/15] hp-wmi: Add missing __init annotations to initialization code Mathias Krause
@ 2014-07-16 17:43 ` Mathias Krause
  2014-07-16 17:43 ` [PATCH 13/15] ideapad-laptop: Constify DMI table and other r/o variables Mathias Krause
                   ` (2 subsequent siblings)
  14 siblings, 0 replies; 21+ messages in thread
From: Mathias Krause @ 2014-07-16 17:43 UTC (permalink / raw)
  To: Matthew Garrett; +Cc: platform-driver-x86, Mathias Krause, Eric Piel

Constify the lis3lv02d_device_ids[] ACPI and the lis3lv02d_dmi_ids[] DMI
tables. There's no need to have them writeable during runtime.

Signed-off-by: Mathias Krause <minipli@googlemail.com>
Cc: Eric Piel <eric.piel@tremplin-utc.net>
---
 drivers/platform/x86/hp_accel.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/platform/x86/hp_accel.c b/drivers/platform/x86/hp_accel.c
index 3dc934438c..13e14ec1d3 100644
--- a/drivers/platform/x86/hp_accel.c
+++ b/drivers/platform/x86/hp_accel.c
@@ -74,7 +74,7 @@ static inline void delayed_sysfs_set(struct led_classdev *led_cdev,
 /* HP-specific accelerometer driver ------------------------------------ */
 
 /* For automatic insertion of the module */
-static struct acpi_device_id lis3lv02d_device_ids[] = {
+static const struct acpi_device_id lis3lv02d_device_ids[] = {
 	{"HPQ0004", 0}, /* HP Mobile Data Protection System PNP */
 	{"HPQ6000", 0}, /* HP Mobile Data Protection System PNP */
 	{"HPQ6007", 0}, /* HP Mobile Data Protection System PNP */
@@ -192,7 +192,7 @@ DEFINE_CONV(xy_swap_yz_inverted, 2, -1, -3);
 	},						\
 	.driver_data = &lis3lv02d_axis_##_axis		\
 }
-static struct dmi_system_id lis3lv02d_dmi_ids[] = {
+static const struct dmi_system_id lis3lv02d_dmi_ids[] = {
 	/* product names are truncated to match all kinds of a same model */
 	AXIS_DMI_MATCH("NC64x0", "HP Compaq nc64", x_inverted),
 	AXIS_DMI_MATCH("NC84x0", "HP Compaq nc84", z_inverted),
-- 
1.7.10.4

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

* [PATCH 13/15] ideapad-laptop: Constify DMI table and other r/o variables
  2014-07-16 17:43 [PATCH 00/15] Random collection of x86 platform driver cleanups Mathias Krause
                   ` (11 preceding siblings ...)
  2014-07-16 17:43 ` [PATCH 12/15] hp_accel: Constify ACPI and DMI tables Mathias Krause
@ 2014-07-16 17:43 ` Mathias Krause
  2014-07-16 17:43 ` [PATCH 14/15] intel_ips: Make ips_mcp_limits variables static Mathias Krause
  2014-07-16 17:43 ` [PATCH 15/15] thinkpad_acpi: Mark volume_alsa_control_{vol,mute} as __initdata Mathias Krause
  14 siblings, 0 replies; 21+ messages in thread
From: Mathias Krause @ 2014-07-16 17:43 UTC (permalink / raw)
  To: Matthew Garrett; +Cc: platform-driver-x86, Mathias Krause, Ike Panhc

Constify the rfkill_blacklist[] DMI table, the ideapad_rfk_data[] table
and the ideapad_attribute_group attribute group. There's no need to have
them writeable during runtime.

Signed-off-by: Mathias Krause <minipli@googlemail.com>
Cc: Ike Panhc <ike.pan@canonical.com>
---
 drivers/platform/x86/ideapad-laptop.c |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/platform/x86/ideapad-laptop.c b/drivers/platform/x86/ideapad-laptop.c
index b4c495a62e..3966b81172 100644
--- a/drivers/platform/x86/ideapad-laptop.c
+++ b/drivers/platform/x86/ideapad-laptop.c
@@ -439,7 +439,7 @@ static umode_t ideapad_is_visible(struct kobject *kobj,
 	return supported ? attr->mode : 0;
 }
 
-static struct attribute_group ideapad_attribute_group = {
+static const struct attribute_group ideapad_attribute_group = {
 	.is_visible = ideapad_is_visible,
 	.attrs = ideapad_attributes
 };
@@ -454,7 +454,7 @@ struct ideapad_rfk_data {
 	int type;
 };
 
-const struct ideapad_rfk_data ideapad_rfk_data[] = {
+static const struct ideapad_rfk_data ideapad_rfk_data[] = {
 	{ "ideapad_wlan",    CFG_WIFI_BIT, VPCCMD_W_WIFI, RFKILL_TYPE_WLAN },
 	{ "ideapad_bluetooth", CFG_BT_BIT, VPCCMD_W_BT, RFKILL_TYPE_BLUETOOTH },
 	{ "ideapad_3g",        CFG_3G_BIT, VPCCMD_W_3G, RFKILL_TYPE_WWAN },
@@ -822,7 +822,7 @@ static void ideapad_acpi_notify(acpi_handle handle, u32 event, void *data)
 }
 
 /* Blacklist for devices where the ideapad rfkill interface does not work */
-static struct dmi_system_id rfkill_blacklist[] = {
+static const struct dmi_system_id rfkill_blacklist[] = {
 	/* The Lenovo Yoga 2 11 always reports everything as blocked */
 	{
 		.ident = "Lenovo Yoga 2 11",
-- 
1.7.10.4

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

* [PATCH 14/15] intel_ips: Make ips_mcp_limits variables static
  2014-07-16 17:43 [PATCH 00/15] Random collection of x86 platform driver cleanups Mathias Krause
                   ` (12 preceding siblings ...)
  2014-07-16 17:43 ` [PATCH 13/15] ideapad-laptop: Constify DMI table and other r/o variables Mathias Krause
@ 2014-07-16 17:43 ` Mathias Krause
  2014-07-16 17:43 ` [PATCH 15/15] thinkpad_acpi: Mark volume_alsa_control_{vol,mute} as __initdata Mathias Krause
  14 siblings, 0 replies; 21+ messages in thread
From: Mathias Krause @ 2014-07-16 17:43 UTC (permalink / raw)
  To: Matthew Garrett; +Cc: platform-driver-x86, Mathias Krause

These variables don't need to be visible outside of this compilation
unit, make them static.

Signed-off-by: Mathias Krause <minipli@googlemail.com>
---
 drivers/platform/x86/intel_ips.c |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/platform/x86/intel_ips.c b/drivers/platform/x86/intel_ips.c
index 18dcb58ba9..b3b49d516e 100644
--- a/drivers/platform/x86/intel_ips.c
+++ b/drivers/platform/x86/intel_ips.c
@@ -269,7 +269,7 @@ struct ips_mcp_limits {
 
 /* Max temps are -10 degrees C to avoid PROCHOT# */
 
-struct ips_mcp_limits ips_sv_limits = {
+static struct ips_mcp_limits ips_sv_limits = {
 	.mcp_power_limit = 35000,
 	.core_power_limit = 29000,
 	.mch_power_limit = 20000,
@@ -277,7 +277,7 @@ struct ips_mcp_limits ips_sv_limits = {
 	.mch_temp_limit = 90
 };
 
-struct ips_mcp_limits ips_lv_limits = {
+static struct ips_mcp_limits ips_lv_limits = {
 	.mcp_power_limit = 25000,
 	.core_power_limit = 21000,
 	.mch_power_limit = 13000,
@@ -285,7 +285,7 @@ struct ips_mcp_limits ips_lv_limits = {
 	.mch_temp_limit = 90
 };
 
-struct ips_mcp_limits ips_ulv_limits = {
+static struct ips_mcp_limits ips_ulv_limits = {
 	.mcp_power_limit = 18000,
 	.core_power_limit = 14000,
 	.mch_power_limit = 11000,
-- 
1.7.10.4

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

* [PATCH 15/15] thinkpad_acpi: Mark volume_alsa_control_{vol,mute} as __initdata
  2014-07-16 17:43 [PATCH 00/15] Random collection of x86 platform driver cleanups Mathias Krause
                   ` (13 preceding siblings ...)
  2014-07-16 17:43 ` [PATCH 14/15] intel_ips: Make ips_mcp_limits variables static Mathias Krause
@ 2014-07-16 17:43 ` Mathias Krause
  2014-07-16 19:03   ` Henrique de Moraes Holschuh
  14 siblings, 1 reply; 21+ messages in thread
From: Mathias Krause @ 2014-07-16 17:43 UTC (permalink / raw)
  To: Matthew Garrett
  Cc: platform-driver-x86, Mathias Krause, Henrique de Moraes Holschuh

Mark volume_alsa_control_vol and volume_alsa_control_mute as __initdata,
as snd_ctl_new1() will copy the relevant parts, so there is no need to
keep the master copies around after initialization.

Signed-off-by: Mathias Krause <minipli@googlemail.com>
Cc: Henrique de Moraes Holschuh <ibm-acpi@hmh.eng.br>
---
 drivers/platform/x86/thinkpad_acpi.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/platform/x86/thinkpad_acpi.c b/drivers/platform/x86/thinkpad_acpi.c
index d82f196e3c..0f48cade28 100644
--- a/drivers/platform/x86/thinkpad_acpi.c
+++ b/drivers/platform/x86/thinkpad_acpi.c
@@ -6860,7 +6860,7 @@ static int volume_alsa_mute_put(struct snd_kcontrol *kcontrol,
 	return volume_alsa_set_mute(!ucontrol->value.integer.value[0]);
 }
 
-static struct snd_kcontrol_new volume_alsa_control_vol = {
+static struct snd_kcontrol_new volume_alsa_control_vol __initdata = {
 	.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
 	.name = "Console Playback Volume",
 	.index = 0,
@@ -6869,7 +6869,7 @@ static struct snd_kcontrol_new volume_alsa_control_vol = {
 	.get = volume_alsa_vol_get,
 };
 
-static struct snd_kcontrol_new volume_alsa_control_mute = {
+static struct snd_kcontrol_new volume_alsa_control_mute __initdata = {
 	.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
 	.name = "Console Playback Switch",
 	.index = 0,
-- 
1.7.10.4

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

* Re: [PATCH 15/15] thinkpad_acpi: Mark volume_alsa_control_{vol,mute} as __initdata
  2014-07-16 17:43 ` [PATCH 15/15] thinkpad_acpi: Mark volume_alsa_control_{vol,mute} as __initdata Mathias Krause
@ 2014-07-16 19:03   ` Henrique de Moraes Holschuh
  0 siblings, 0 replies; 21+ messages in thread
From: Henrique de Moraes Holschuh @ 2014-07-16 19:03 UTC (permalink / raw)
  To: Mathias Krause
  Cc: Matthew Garrett, platform-driver-x86, Henrique de Moraes Holschuh

On Wed, 16 Jul 2014, Mathias Krause wrote:
> Mark volume_alsa_control_vol and volume_alsa_control_mute as __initdata,
> as snd_ctl_new1() will copy the relevant parts, so there is no need to
> keep the master copies around after initialization.
> 
> Signed-off-by: Mathias Krause <minipli@googlemail.com>
> Cc: Henrique de Moraes Holschuh <ibm-acpi@hmh.eng.br>

Acked-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>

> ---
>  drivers/platform/x86/thinkpad_acpi.c |    4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/platform/x86/thinkpad_acpi.c b/drivers/platform/x86/thinkpad_acpi.c
> index d82f196e3c..0f48cade28 100644
> --- a/drivers/platform/x86/thinkpad_acpi.c
> +++ b/drivers/platform/x86/thinkpad_acpi.c
> @@ -6860,7 +6860,7 @@ static int volume_alsa_mute_put(struct snd_kcontrol *kcontrol,
>  	return volume_alsa_set_mute(!ucontrol->value.integer.value[0]);
>  }
>  
> -static struct snd_kcontrol_new volume_alsa_control_vol = {
> +static struct snd_kcontrol_new volume_alsa_control_vol __initdata = {
>  	.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
>  	.name = "Console Playback Volume",
>  	.index = 0,
> @@ -6869,7 +6869,7 @@ static struct snd_kcontrol_new volume_alsa_control_vol = {
>  	.get = volume_alsa_vol_get,
>  };
>  
> -static struct snd_kcontrol_new volume_alsa_control_mute = {
> +static struct snd_kcontrol_new volume_alsa_control_mute __initdata = {
>  	.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
>  	.name = "Console Playback Switch",
>  	.index = 0,

-- 
  "One disk to rule them all, One disk to find them. One disk to bring
  them all and in the darkness grind them. In the Land of Redmond
  where the shadows lie." -- The Silicon Valley Tarot
  Henrique Holschuh

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

* Re: [PATCH 09/15] fujitsu-laptop: Mark fujitsu_dmi_table[] DMI table as __initconst
  2014-07-16 17:43 ` [PATCH 09/15] fujitsu-laptop: Mark fujitsu_dmi_table[] DMI table as __initconst Mathias Krause
@ 2014-07-16 22:59   ` Jonathan Woithe
  0 siblings, 0 replies; 21+ messages in thread
From: Jonathan Woithe @ 2014-07-16 22:59 UTC (permalink / raw)
  To: Mathias Krause; +Cc: Matthew Garrett, platform-driver-x86, jwoithe

Looks fine to me.

Acked-by: Jonathan Woithe <jwoithe@just42.net>

On Wed, Jul 16, 2014 at 07:43:11PM +0200, Mathias Krause wrote:
> The DMI table is only ever used during initialization. Mark it as
> __initconst so its memory can be released afterwards -- roughly 1.5 kB.
> In turn, the callback functions can be marked with __init, too.
> 
> Signed-off-by: Mathias Krause <minipli@googlemail.com>
> Cc: Jonathan Woithe <jwoithe@just42.net>
> ---
>  drivers/platform/x86/fujitsu-laptop.c |   10 +++++-----
>  1 file changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/platform/x86/fujitsu-laptop.c b/drivers/platform/x86/fujitsu-laptop.c
> index e6f336270c..e9345f12ce 100644
> --- a/drivers/platform/x86/fujitsu-laptop.c
> +++ b/drivers/platform/x86/fujitsu-laptop.c
> @@ -564,7 +564,7 @@ static struct platform_driver fujitsupf_driver = {
>  		   }
>  };
>  
> -static void dmi_check_cb_common(const struct dmi_system_id *id)
> +static void __init dmi_check_cb_common(const struct dmi_system_id *id)
>  {
>  	pr_info("Identified laptop model '%s'\n", id->ident);
>  	if (use_alt_lcd_levels == -1) {
> @@ -578,7 +578,7 @@ static void dmi_check_cb_common(const struct dmi_system_id *id)
>  	}
>  }
>  
> -static int dmi_check_cb_s6410(const struct dmi_system_id *id)
> +static int __init dmi_check_cb_s6410(const struct dmi_system_id *id)
>  {
>  	dmi_check_cb_common(id);
>  	fujitsu->keycode1 = KEY_SCREENLOCK;	/* "Lock" */
> @@ -586,7 +586,7 @@ static int dmi_check_cb_s6410(const struct dmi_system_id *id)
>  	return 1;
>  }
>  
> -static int dmi_check_cb_s6420(const struct dmi_system_id *id)
> +static int __init dmi_check_cb_s6420(const struct dmi_system_id *id)
>  {
>  	dmi_check_cb_common(id);
>  	fujitsu->keycode1 = KEY_SCREENLOCK;	/* "Lock" */
> @@ -594,7 +594,7 @@ static int dmi_check_cb_s6420(const struct dmi_system_id *id)
>  	return 1;
>  }
>  
> -static int dmi_check_cb_p8010(const struct dmi_system_id *id)
> +static int __init dmi_check_cb_p8010(const struct dmi_system_id *id)
>  {
>  	dmi_check_cb_common(id);
>  	fujitsu->keycode1 = KEY_HELP;	/* "Support" */
> @@ -603,7 +603,7 @@ static int dmi_check_cb_p8010(const struct dmi_system_id *id)
>  	return 1;
>  }
>  
> -static struct dmi_system_id fujitsu_dmi_table[] = {
> +static const struct dmi_system_id fujitsu_dmi_table[] __initconst = {
>  	{
>  	 .ident = "Fujitsu Siemens S6410",
>  	 .matches = {
> -- 
> 1.7.10.4

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

* Re: [PATCH 02/15] acer-wmi: Mark init data and code as such
  2014-07-16 17:43 ` [PATCH 02/15] acer-wmi: Mark init data and code as such Mathias Krause
@ 2014-07-29  3:18   ` joeyli
  0 siblings, 0 replies; 21+ messages in thread
From: joeyli @ 2014-07-29  3:18 UTC (permalink / raw)
  To: Mathias Krause; +Cc: Matthew Garrett, platform-driver-x86

On Wed, Jul 16, 2014 at 07:43:04PM +0200, Mathias Krause wrote:
> Quite a lot of code and data of acer-wmi.c is only ever used during
> initialization. Mark those accordingly -- and constify, where
> appropriate -- so the memory can be released afterwards.
> 
> All in all those changes move ~10 kB of code and data to the .init
> sections, marking them for release after initialization has finished.
> 
> Signed-off-by: Mathias Krause <minipli@googlemail.com>
> Cc: "Lee, Chun-Yi" <jlee@suse.com>

This patch good to me.

Signed-off-by: "Lee, Chun-Yi" <jlee@suse.com>


Thanks a lot!
Joey Lee

> ---
>  drivers/platform/x86/acer-wmi.c |   41 ++++++++++++++++++++-------------------
>  1 file changed, 21 insertions(+), 20 deletions(-)
> 
> diff --git a/drivers/platform/x86/acer-wmi.c b/drivers/platform/x86/acer-wmi.c
> index bbf78b2d6d..31f4da5061 100644
> --- a/drivers/platform/x86/acer-wmi.c
> +++ b/drivers/platform/x86/acer-wmi.c
> @@ -294,7 +294,7 @@ struct quirk_entry {
>  
>  static struct quirk_entry *quirks;
>  
> -static void set_quirks(void)
> +static void __init set_quirks(void)
>  {
>  	if (!interface)
>  		return;
> @@ -306,7 +306,7 @@ static void set_quirks(void)
>  		interface->capability |= ACER_CAP_BRIGHTNESS;
>  }
>  
> -static int dmi_matched(const struct dmi_system_id *dmi)
> +static int __init dmi_matched(const struct dmi_system_id *dmi)
>  {
>  	quirks = dmi->driver_data;
>  	return 1;
> @@ -337,7 +337,7 @@ static struct quirk_entry quirk_lenovo_ideapad_s205 = {
>  };
>  
>  /* The Aspire One has a dummy ACPI-WMI interface - disable it */
> -static struct dmi_system_id acer_blacklist[] = {
> +static const struct dmi_system_id acer_blacklist[] __initconst = {
>  	{
>  		.ident = "Acer Aspire One (SSD)",
>  		.matches = {
> @@ -355,7 +355,7 @@ static struct dmi_system_id acer_blacklist[] = {
>  	{}
>  };
>  
> -static struct dmi_system_id acer_quirks[] = {
> +static const struct dmi_system_id acer_quirks[] __initconst = {
>  	{
>  		.callback = dmi_matched,
>  		.ident = "Acer Aspire 1360",
> @@ -530,14 +530,15 @@ static struct dmi_system_id acer_quirks[] = {
>  	{}
>  };
>  
> -static int video_set_backlight_video_vendor(const struct dmi_system_id *d)
> +static int __init
> +video_set_backlight_video_vendor(const struct dmi_system_id *d)
>  {
>  	interface->capability &= ~ACER_CAP_BRIGHTNESS;
>  	pr_info("Brightness must be controlled by generic video driver\n");
>  	return 0;
>  }
>  
> -static const struct dmi_system_id video_vendor_dmi_table[] = {
> +static const struct dmi_system_id video_vendor_dmi_table[] __initconst = {
>  	{
>  		.callback = video_set_backlight_video_vendor,
>  		.ident = "Acer TravelMate 4750",
> @@ -582,7 +583,7 @@ static const struct dmi_system_id video_vendor_dmi_table[] = {
>  };
>  
>  /* Find which quirks are needed for a particular vendor/ model pair */
> -static void find_quirks(void)
> +static void __init find_quirks(void)
>  {
>  	if (!force_series) {
>  		dmi_check_system(acer_quirks);
> @@ -749,7 +750,7 @@ static acpi_status AMW0_set_u32(u32 value, u32 cap)
>  	return wmab_execute(&args, NULL);
>  }
>  
> -static acpi_status AMW0_find_mailled(void)
> +static acpi_status __init AMW0_find_mailled(void)
>  {
>  	struct wmab_args args;
>  	struct wmab_ret ret;
> @@ -781,16 +782,16 @@ static acpi_status AMW0_find_mailled(void)
>  	return AE_OK;
>  }
>  
> -static int AMW0_set_cap_acpi_check_device_found;
> +static int AMW0_set_cap_acpi_check_device_found __initdata;
>  
> -static acpi_status AMW0_set_cap_acpi_check_device_cb(acpi_handle handle,
> +static acpi_status __init AMW0_set_cap_acpi_check_device_cb(acpi_handle handle,
>  	u32 level, void *context, void **retval)
>  {
>  	AMW0_set_cap_acpi_check_device_found = 1;
>  	return AE_OK;
>  }
>  
> -static const struct acpi_device_id norfkill_ids[] = {
> +static const struct acpi_device_id norfkill_ids[] __initconst = {
>  	{ "VPC2004", 0},
>  	{ "IBM0068", 0},
>  	{ "LEN0068", 0},
> @@ -798,7 +799,7 @@ static const struct acpi_device_id norfkill_ids[] = {
>  	{ "", 0},
>  };
>  
> -static int AMW0_set_cap_acpi_check_device(void)
> +static int __init AMW0_set_cap_acpi_check_device(void)
>  {
>  	const struct acpi_device_id *id;
>  
> @@ -808,7 +809,7 @@ static int AMW0_set_cap_acpi_check_device(void)
>  	return AMW0_set_cap_acpi_check_device_found;
>  }
>  
> -static acpi_status AMW0_set_capabilities(void)
> +static acpi_status __init AMW0_set_capabilities(void)
>  {
>  	struct wmab_args args;
>  	struct wmab_ret ret;
> @@ -1184,7 +1185,7 @@ static acpi_status wmid_v2_set_u32(u32 value, u32 cap)
>  	return wmid3_set_device_status(value, device);
>  }
>  
> -static void type_aa_dmi_decode(const struct dmi_header *header, void *dummy)
> +static void __init type_aa_dmi_decode(const struct dmi_header *header, void *d)
>  {
>  	struct hotkey_function_type_aa *type_aa;
>  
> @@ -1209,7 +1210,7 @@ static void type_aa_dmi_decode(const struct dmi_header *header, void *dummy)
>  	commun_fn_key_number = type_aa->commun_fn_key_number;
>  }
>  
> -static acpi_status WMID_set_capabilities(void)
> +static acpi_status __init WMID_set_capabilities(void)
>  {
>  	struct acpi_buffer out = {ACPI_ALLOCATE_BUFFER, NULL};
>  	union acpi_object *obj;
> @@ -1777,7 +1778,7 @@ static void acer_wmi_notify(u32 value, void *context)
>  	}
>  }
>  
> -static acpi_status
> +static acpi_status __init
>  wmid3_set_lm_mode(struct lm_input_params *params,
>  		  struct lm_return_value *return_value)
>  {
> @@ -1811,7 +1812,7 @@ wmid3_set_lm_mode(struct lm_input_params *params,
>  	return status;
>  }
>  
> -static int acer_wmi_enable_ec_raw(void)
> +static int __init acer_wmi_enable_ec_raw(void)
>  {
>  	struct lm_return_value return_value;
>  	acpi_status status;
> @@ -1834,7 +1835,7 @@ static int acer_wmi_enable_ec_raw(void)
>  	return status;
>  }
>  
> -static int acer_wmi_enable_lm(void)
> +static int __init acer_wmi_enable_lm(void)
>  {
>  	struct lm_return_value return_value;
>  	acpi_status status;
> @@ -2120,7 +2121,7 @@ static int remove_sysfs(struct platform_device *device)
>  	return 0;
>  }
>  
> -static int create_sysfs(void)
> +static int __init create_sysfs(void)
>  {
>  	int retval = -ENOMEM;
>  
> @@ -2149,7 +2150,7 @@ static void remove_debugfs(void)
>  	debugfs_remove(interface->debug.root);
>  }
>  
> -static int create_debugfs(void)
> +static int __init create_debugfs(void)
>  {
>  	interface->debug.root = debugfs_create_dir("acer-wmi", NULL);
>  	if (!interface->debug.root) {
> -- 
> 1.7.10.4
> 

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

* Re: [PATCH 03/15] acer-wmi: Mark acer_wmi_keymap[] as __initconst
  2014-07-16 17:43 ` [PATCH 03/15] acer-wmi: Mark acer_wmi_keymap[] as __initconst Mathias Krause
@ 2014-07-29  3:21   ` joeyli
  0 siblings, 0 replies; 21+ messages in thread
From: joeyli @ 2014-07-29  3:21 UTC (permalink / raw)
  To: Mathias Krause; +Cc: Matthew Garrett, platform-driver-x86

On Wed, Jul 16, 2014 at 07:43:05PM +0200, Mathias Krause wrote:
> sparse_keymap_setup() will make a copy of the keymap, so we can release
> the master copy after initialization.
> 
> Signed-off-by: Mathias Krause <minipli@googlemail.com>
> Cc: "Lee, Chun-Yi" <jlee@suse.com>

Signed-off-by: "Lee, Chun-Yi" <jlee@suse.com>


Thanks a lot!
Joey Lee

> ---
>  drivers/platform/x86/acer-wmi.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/platform/x86/acer-wmi.c b/drivers/platform/x86/acer-wmi.c
> index 31f4da5061..fde69ee63f 100644
> --- a/drivers/platform/x86/acer-wmi.c
> +++ b/drivers/platform/x86/acer-wmi.c
> @@ -96,7 +96,7 @@ enum acer_wmi_event_ids {
>  	WMID_ACCEL_EVENT = 0x5,
>  };
>  
> -static const struct key_entry acer_wmi_keymap[] = {
> +static const struct key_entry acer_wmi_keymap[] __initconst = {
>  	{KE_KEY, 0x01, {KEY_WLAN} },     /* WiFi */
>  	{KE_KEY, 0x03, {KEY_WLAN} },     /* WiFi */
>  	{KE_KEY, 0x04, {KEY_WLAN} },     /* WiFi */
> -- 
> 1.7.10.4
> 

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

* Re: [PATCH 04/15] acer-wmi: Hide acer_{suspend,resume} for !CONFIG_PM_SLEEP
  2014-07-16 17:43 ` [PATCH 04/15] acer-wmi: Hide acer_{suspend,resume} for !CONFIG_PM_SLEEP Mathias Krause
@ 2014-07-29  3:21   ` joeyli
  0 siblings, 0 replies; 21+ messages in thread
From: joeyli @ 2014-07-29  3:21 UTC (permalink / raw)
  To: Mathias Krause; +Cc: Matthew Garrett, platform-driver-x86

On Wed, Jul 16, 2014 at 07:43:06PM +0200, Mathias Krause wrote:
> Encapsulate acer_suspend() and acer_resume with #ifdef CONFIG_PM_SLEEP
> to get rid of the following warnings:
> 
>   ../acer-wmi.c:2046:12: warning: ‘acer_suspend’ defined but not used [-Wunused-function]
>   ../acer-wmi.c:2068:12: warning: ‘acer_resume’ defined but not used [-Wunused-function]
> 
> Signed-off-by: Mathias Krause <minipli@googlemail.com>
> Cc: "Lee, Chun-Yi" <jlee@suse.com>

Signed-off-by: "Lee, Chun-Yi" <jlee@suse.com>


Thanks a lot!
Joey Lee

> ---
>  drivers/platform/x86/acer-wmi.c |    5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/drivers/platform/x86/acer-wmi.c b/drivers/platform/x86/acer-wmi.c
> index fde69ee63f..0d18c23d66 100644
> --- a/drivers/platform/x86/acer-wmi.c
> +++ b/drivers/platform/x86/acer-wmi.c
> @@ -2044,6 +2044,7 @@ static int acer_platform_remove(struct platform_device *device)
>  	return 0;
>  }
>  
> +#ifdef CONFIG_PM_SLEEP
>  static int acer_suspend(struct device *dev)
>  {
>  	u32 value;
> @@ -2084,6 +2085,10 @@ static int acer_resume(struct device *dev)
>  
>  	return 0;
>  }
> +#else
> +#define acer_suspend	NULL
> +#define acer_resume	NULL
> +#endif
>  
>  static SIMPLE_DEV_PM_OPS(acer_pm, acer_suspend, acer_resume);
>  
> -- 
> 1.7.10.4
> 

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

end of thread, other threads:[~2014-07-29  3:27 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-07-16 17:43 [PATCH 00/15] Random collection of x86 platform driver cleanups Mathias Krause
2014-07-16 17:43 ` [PATCH 01/15] MAINTAINERS: Update git URL for x86 platform drivers Mathias Krause
2014-07-16 17:43 ` [PATCH 02/15] acer-wmi: Mark init data and code as such Mathias Krause
2014-07-29  3:18   ` joeyli
2014-07-16 17:43 ` [PATCH 03/15] acer-wmi: Mark acer_wmi_keymap[] as __initconst Mathias Krause
2014-07-29  3:21   ` joeyli
2014-07-16 17:43 ` [PATCH 04/15] acer-wmi: Hide acer_{suspend,resume} for !CONFIG_PM_SLEEP Mathias Krause
2014-07-29  3:21   ` joeyli
2014-07-16 17:43 ` [PATCH 05/15] alienware-wmi: Mark DMI table as __initconst Mathias Krause
2014-07-16 17:43 ` [PATCH 06/15] asus-nb-wmi: Constify asus_quirks[] DMI table Mathias Krause
2014-07-16 17:43 ` [PATCH 07/15] dell-laptop: Mark dell_quirks[] DMI table as __initconst Mathias Krause
2014-07-16 17:43 ` [PATCH 08/15] eeepc-wmi: Constify asus_quirks[] DMI table Mathias Krause
2014-07-16 17:43 ` [PATCH 09/15] fujitsu-laptop: Mark fujitsu_dmi_table[] DMI table as __initconst Mathias Krause
2014-07-16 22:59   ` Jonathan Woithe
2014-07-16 17:43 ` [PATCH 10/15] fujitsu-tablet: Mark DMI callbacks as __init code Mathias Krause
2014-07-16 17:43 ` [PATCH 11/15] hp-wmi: Add missing __init annotations to initialization code Mathias Krause
2014-07-16 17:43 ` [PATCH 12/15] hp_accel: Constify ACPI and DMI tables Mathias Krause
2014-07-16 17:43 ` [PATCH 13/15] ideapad-laptop: Constify DMI table and other r/o variables Mathias Krause
2014-07-16 17:43 ` [PATCH 14/15] intel_ips: Make ips_mcp_limits variables static Mathias Krause
2014-07-16 17:43 ` [PATCH 15/15] thinkpad_acpi: Mark volume_alsa_control_{vol,mute} as __initdata Mathias Krause
2014-07-16 19:03   ` Henrique de Moraes Holschuh

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.