Discussion:
[PATCH 0/3] Malta/SEAD3 kernel image size patches for 3.18
Markos Chandras
2014-10-09 09:34:18 UTC
Permalink
Hi,

A few patches to reduce the size of the kernel image for Malta and SEAD3 by
improving the dependencies on certain source files.

A different approach for i2c and led patches has been posted before:
http://patchwork.linux-mips.org/patch/5802/

Even though none of the original requests have been addressed, I still feel
these patches do not make things any worse.

Hopefully not too late for 3.18

Markos Chandras (3):
MIPS: Malta: Do not build the malta-amon.c file if CMP is not enabled
MIPS: sead3: Build the I2C related devices if CONFIG_I2C is enabled
MIPS: sead3: Only build the led driver is LEDS_CLASS is enabled

arch/mips/mti-malta/Makefile | 3 ++-
arch/mips/mti-sead3/Makefile | 7 +++----
2 files changed, 5 insertions(+), 5 deletions(-)
--
2.1.2
Markos Chandras
2014-10-09 09:34:19 UTC
Permalink
The malta-amon.c file provides functions to access the YAMON Monitoring
interface to bring up secondary VPEs in case of SMP/CMP. As a
result of which, there is no need to build it if CMP is not used.

Reviewed-by: Paul Burton <***@imgtec.com>
Signed-off-by: Markos Chandras <***@imgtec.com>
---
arch/mips/mti-malta/Makefile | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/arch/mips/mti-malta/Makefile b/arch/mips/mti-malta/Makefile
index b9510ea8db56..6510ace272d4 100644
--- a/arch/mips/mti-malta/Makefile
+++ b/arch/mips/mti-malta/Makefile
@@ -5,8 +5,9 @@
# Copyright (C) 2008 Wind River Systems, Inc.
# written by Ralf Baechle <***@linux-mips.org>
#
-obj-y := malta-amon.o malta-display.o malta-init.o \
+obj-y := malta-display.o malta-init.o \
malta-int.o malta-memory.o malta-platform.o \
malta-reset.o malta-setup.o malta-time.o

+obj-$(CONFIG_MIPS_CMP) += malta-amon.o
obj-$(CONFIG_MIPS_MALTA_PM) += malta-pm.o
--
2.1.2
Markos Chandras
2014-10-09 09:34:20 UTC
Permalink
There is no point building the drivers for the i2c related devices if
CONFIG_I2C is not enabled.

This also fixes a randconfig problem:

arch/mips/mti-sead3/sead3-pic32-i2c-drv.c: In function 'i2c_platform_probe':
arch/mips/mti-sead3/sead3-pic32-i2c-drv.c:345:2: error: implicit declaration of
function 'i2c_add_numbered_adapter' [-Werror=implicit-function-declaration]
ret = i2c_add_numbered_adapter(&priv->adap);
^
arch/mips/mti-sead3/sead3-pic32-i2c-drv.c: In function
'i2c_platform_remove':
arch/mips/mti-sead3/sead3-pic32-i2c-drv.c:361:2: error: implicit declaration
of function 'i2c_del_adapter' [-Werror=implicit-function-declaration]
i2c_del_adapter(&priv->adap);

Reviewed-by: Steven J. Hill <***@imgtec.com>
Signed-off-by: Markos Chandras <***@imgtec.com>
---
arch/mips/mti-sead3/Makefile | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/arch/mips/mti-sead3/Makefile b/arch/mips/mti-sead3/Makefile
index 071786fa234b..a632b9cfe526 100644
--- a/arch/mips/mti-sead3/Makefile
+++ b/arch/mips/mti-sead3/Makefile
@@ -13,11 +13,11 @@ obj-y := sead3-lcd.o sead3-display.o sead3-init.o \
sead3-platform.o sead3-reset.o \
sead3-setup.o sead3-time.o

-obj-y += sead3-i2c-dev.o sead3-i2c.o \
- sead3-pic32-i2c-drv.o sead3-pic32-bus.o \
- leds-sead3.o sead3-leds.o
+obj-y += leds-sead3.o sead3-leds.o

obj-$(CONFIG_EARLY_PRINTK) += sead3-console.o
+obj-$(CONFIG_I2C) += sead3-i2c.o sead3-i2c-dev.o \
+ sead3-pic32-bus.o lsead3-pic32-i2c-drv.o
obj-$(CONFIG_USB_EHCI_HCD) += sead3-ehci.o
obj-$(CONFIG_OF) += sead3.dtb.o
--
2.1.2
Ralf Baechle
2014-10-23 18:19:26 UTC
Permalink
Post by Markos Chandras
There is no point building the drivers for the i2c related devices if
CONFIG_I2C is not enabled.
arch/mips/mti-sead3/sead3-pic32-i2c-drv.c:345:2: error: implicit declaration of
function 'i2c_add_numbered_adapter' [-Werror=implicit-function-declaration]
ret = i2c_add_numbered_adapter(&priv->adap);
^
arch/mips/mti-sead3/sead3-pic32-i2c-drv.c: In function
arch/mips/mti-sead3/sead3-pic32-i2c-drv.c:361:2: error: implicit declaration
of function 'i2c_del_adapter' [-Werror=implicit-function-declaration]
i2c_del_adapter(&priv->adap);
The platform devices should always be registered.

And why on earth is there an I2C drivers in arch? That should rather
go to drivers/i2c/busses/.

Ralf
Markos Chandras
2014-10-09 09:34:21 UTC
Permalink
Fixes the following randconfig problem

leds-sead3.c:(.text+0x7dc): undefined reference to `led_classdev_unregister'
leds-sead3.c:(.text+0x7e8): undefined reference to `led_classdev_unregister'

Reviewed-by: Steven J. Hill <***@imgtec.com>
Signed-off-by: Markos Chandras <***@imgtec.com>
---
arch/mips/mti-sead3/Makefile | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/arch/mips/mti-sead3/Makefile b/arch/mips/mti-sead3/Makefile
index a632b9cfe526..10093fc9ebc9 100644
--- a/arch/mips/mti-sead3/Makefile
+++ b/arch/mips/mti-sead3/Makefile
@@ -13,11 +13,10 @@ obj-y := sead3-lcd.o sead3-display.o sead3-init.o \
sead3-platform.o sead3-reset.o \
sead3-setup.o sead3-time.o

-obj-y += leds-sead3.o sead3-leds.o
-
obj-$(CONFIG_EARLY_PRINTK) += sead3-console.o
obj-$(CONFIG_I2C) += sead3-i2c.o sead3-i2c-dev.o \
sead3-pic32-bus.o lsead3-pic32-i2c-drv.o
+obj-$(LEDS_CLASS) += leds-sead3.o sead3-leds.o
obj-$(CONFIG_USB_EHCI_HCD) += sead3-ehci.o
obj-$(CONFIG_OF) += sead3.dtb.o
--
2.1.2
Ralf Baechle
2014-10-23 23:54:16 UTC
Permalink
Post by Markos Chandras
leds-sead3.c:(.text+0x7dc): undefined reference to `led_classdev_unregister'
leds-sead3.c:(.text+0x7e8): undefined reference to `led_classdev_unregister'
Hmm... I think there's a whole lot more broken. Let's start with the
Makefile:

-obj-y += leds-sead3.o sead3-leds.o

Very creative filenames. No way to know in what way foo-bar and bar-foo
are different. But let's take a look at sead3-leds:

[...]
module_init(led_init);

MODULE_AUTHOR("Chris Dearman <***@mips.com>");
MODULE_LICENSE("GPL");
MODULE_DESCRIPTION("LED probe driver for SEAD-3");

But although you were trying to make this a module, this better shouldn't
be one, the devices should always be registered if they're there, driver
enabled or not.

Anyway this should probably become a device_initcall() and all the
module bits should go.

And now let's take a look at sead3-led.. oh wait, that's leds-sead3 -
did I bitch about the filename before? That's a complete device driver
and it blows up primarily because it lives in a directory where it
shouldn't be at all.

Ralf
Ralf Baechle
2014-10-23 22:41:45 UTC
Permalink
This isn't a module and shouldn't be one.

Signed-off-by: Ralf Baechle <***@linux-mips.org>
---
arch/mips/mti-sead3/sead3-leds.c | 8 ++------
1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/arch/mips/mti-sead3/sead3-leds.c b/arch/mips/mti-sead3/sead3-leds.c
index 20102a6..c427c57 100644
--- a/arch/mips/mti-sead3/sead3-leds.c
+++ b/arch/mips/mti-sead3/sead3-leds.c
@@ -5,7 +5,7 @@
*
* Copyright (C) 2012 MIPS Technologies, Inc. All rights reserved.
*/
-#include <linux/module.h>
+#include <linux/init.h>
#include <linux/leds.h>
#include <linux/platform_device.h>

@@ -76,8 +76,4 @@ static int __init led_init(void)
return platform_device_register(&fled_device);
}

-module_init(led_init);
-
-MODULE_AUTHOR("Chris Dearman <***@mips.com>");
-MODULE_LICENSE("GPL");
-MODULE_DESCRIPTION("LED probe driver for SEAD-3");
+device_initcall(led_init);
--
1.9.3
Ralf Baechle
2014-10-23 23:32:25 UTC
Permalink
Signed-off-by: Ralf Baechle <***@linux-mips.org>
---
arch/mips/mti-sead3/leds-sead3.c | 19 +------------------
arch/mips/mti-sead3/sead3-leds.c | 18 ++++++++++++++----
2 files changed, 15 insertions(+), 22 deletions(-)

diff --git a/arch/mips/mti-sead3/leds-sead3.c b/arch/mips/mti-sead3/leds-sead3.c
index 0a168c9..e5632e6 100644
--- a/arch/mips/mti-sead3/leds-sead3.c
+++ b/arch/mips/mti-sead3/leds-sead3.c
@@ -15,8 +15,6 @@

#define DRVNAME "sead3-led"

-static struct platform_device *pdev;
-
static void sead3_pled_set(struct led_classdev *led_cdev,
enum led_brightness value)
{
@@ -76,26 +74,11 @@ static struct platform_driver sead3_led_driver = {

static int __init sead3_led_init(void)
{
- int ret;
-
- ret = platform_driver_register(&sead3_led_driver);
- if (ret < 0)
- goto out;
-
- pdev = platform_device_register_simple(DRVNAME, -1, NULL, 0);
- if (IS_ERR(pdev)) {
- ret = PTR_ERR(pdev);
- platform_driver_unregister(&sead3_led_driver);
- goto out;
- }
-
-out:
- return ret;
+ return platform_driver_register(&sead3_led_driver);
}

static void __exit sead3_led_exit(void)
{
- platform_device_unregister(pdev);
platform_driver_unregister(&sead3_led_driver);
}

diff --git a/arch/mips/mti-sead3/sead3-leds.c b/arch/mips/mti-sead3/sead3-leds.c
index c427c57..c6fa3e4 100644
--- a/arch/mips/mti-sead3/sead3-leds.c
+++ b/arch/mips/mti-sead3/sead3-leds.c
@@ -70,10 +70,20 @@ static struct platform_device fled_device = {
.resource = fled_resources
};

-static int __init led_init(void)
+static struct platform_device sead3_led_device = {
+ .name = "sead3-led",
+ .id = -1,
+};
+
+struct platform_device *sead3_led_devices[] = {
+ &pled_device,
+ &fled_device,
+ &sead3_led_device,
+};
+
+static int __init sead3_led_init(void)
{
- platform_device_register(&pled_device);
- return platform_device_register(&fled_device);
+ return platform_add_devices(sead3_led_devices, ARRAY_SIZE(sead3_led_devices));
}

-device_initcall(led_init);
+device_initcall(sead3_led_init);
--
1.9.3
Ralf Baechle
2014-10-23 23:50:46 UTC
Permalink
Fixes the following randconfig problem

leds-sead3.c:(.text+0x7dc): undefined reference to `led_classdev_unregister'
leds-sead3.c:(.text+0x7e8): undefined reference to `led_classdev_unregister'

Signed-off-by: Ralf Baechle <***@linux-mips.org>
---
arch/mips/mti-sead3/Makefile | 2 +-
arch/mips/mti-sead3/leds-sead3.c | 90 ----------------------------------------
drivers/leds/Kconfig | 9 ++++
drivers/leds/Makefile | 1 +
drivers/leds/leds-sead3.c | 90 ++++++++++++++++++++++++++++++++++++++++
5 files changed, 101 insertions(+), 91 deletions(-)
delete mode 100644 arch/mips/mti-sead3/leds-sead3.c
create mode 100644 drivers/leds/leds-sead3.c

diff --git a/arch/mips/mti-sead3/Makefile b/arch/mips/mti-sead3/Makefile
index febf433..aa8a857 100644
--- a/arch/mips/mti-sead3/Makefile
+++ b/arch/mips/mti-sead3/Makefile
@@ -15,7 +15,7 @@ obj-y := sead3-lcd.o sead3-display.o sead3-init.o \

obj-y += sead3-i2c-dev.o sead3-i2c.o \
sead3-pic32-i2c-drv.o sead3-pic32-bus.o \
- leds-sead3.o sead3-leds.o
+ sead3-leds.o

obj-$(CONFIG_EARLY_PRINTK) += sead3-console.o
obj-$(CONFIG_USB_EHCI_HCD) += sead3-ehci.o
diff --git a/arch/mips/mti-sead3/leds-sead3.c b/arch/mips/mti-sead3/leds-sead3.c
deleted file mode 100644
index e5632e6..0000000
--- a/arch/mips/mti-sead3/leds-sead3.c
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
- * This file is subject to the terms and conditions of the GNU General Public
- * License. See the file "COPYING" in the main directory of this archive
- * for more details.
- *
- * Copyright (C) 2012 MIPS Technologies, Inc. All rights reserved.
- */
-#include <linux/kernel.h>
-#include <linux/module.h>
-#include <linux/init.h>
-#include <linux/platform_device.h>
-#include <linux/leds.h>
-#include <linux/err.h>
-#include <linux/io.h>
-
-#define DRVNAME "sead3-led"
-
-static void sead3_pled_set(struct led_classdev *led_cdev,
- enum led_brightness value)
-{
- pr_debug("sead3_pled_set\n");
- writel(value, (void __iomem *)0xBF000210); /* FIXME */
-}
-
-static void sead3_fled_set(struct led_classdev *led_cdev,
- enum led_brightness value)
-{
- pr_debug("sead3_fled_set\n");
- writel(value, (void __iomem *)0xBF000218); /* FIXME */
-}
-
-static struct led_classdev sead3_pled = {
- .name = "sead3::pled",
- .brightness_set = sead3_pled_set,
- .flags = LED_CORE_SUSPENDRESUME,
-};
-
-static struct led_classdev sead3_fled = {
- .name = "sead3::fled",
- .brightness_set = sead3_fled_set,
- .flags = LED_CORE_SUSPENDRESUME,
-};
-
-static int sead3_led_probe(struct platform_device *pdev)
-{
- int ret;
-
- ret = led_classdev_register(&pdev->dev, &sead3_pled);
- if (ret < 0)
- return ret;
-
- ret = led_classdev_register(&pdev->dev, &sead3_fled);
- if (ret < 0)
- led_classdev_unregister(&sead3_pled);
-
- return ret;
-}
-
-static int sead3_led_remove(struct platform_device *pdev)
-{
- led_classdev_unregister(&sead3_pled);
- led_classdev_unregister(&sead3_fled);
- return 0;
-}
-
-static struct platform_driver sead3_led_driver = {
- .probe = sead3_led_probe,
- .remove = sead3_led_remove,
- .driver = {
- .name = DRVNAME,
- .owner = THIS_MODULE,
- },
-};
-
-static int __init sead3_led_init(void)
-{
- return platform_driver_register(&sead3_led_driver);
-}
-
-static void __exit sead3_led_exit(void)
-{
- platform_driver_unregister(&sead3_led_driver);
-}
-
-module_init(sead3_led_init);
-module_exit(sead3_led_exit);
-
-MODULE_AUTHOR("Kristian Kielhofner <***@krisk.org>");
-MODULE_DESCRIPTION("SEAD3 LED driver");
-MODULE_LICENSE("GPL");
diff --git a/drivers/leds/Kconfig b/drivers/leds/Kconfig
index a210338..b86aa85 100644
--- a/drivers/leds/Kconfig
+++ b/drivers/leds/Kconfig
@@ -477,6 +477,15 @@ config LEDS_MENF21BMC
This driver can also be built as a module. If so the module
will be called leds-menf21bmc.

+config LEDS_SEAD3
+ tristate "LED support for the MIPS SEAD 3 board"
+ depends on LEDS_CLASS && MIPS_SEAD3
+ help
+ Say Y here to include support for the MEN 14F021P00 BMC LEDs.
+
+ This driver can also be built as a module. If so the module
+ will be called leds-sead3.
+
comment "LED driver for blink(1) USB RGB LED is under Special HID drivers (HID_THINGM)"

config LEDS_BLINKM
diff --git a/drivers/leds/Makefile b/drivers/leds/Makefile
index a2b1647..4f22241 100644
--- a/drivers/leds/Makefile
+++ b/drivers/leds/Makefile
@@ -56,6 +56,7 @@ obj-$(CONFIG_LEDS_BLINKM) += leds-blinkm.o
obj-$(CONFIG_LEDS_SYSCON) += leds-syscon.o
obj-$(CONFIG_LEDS_VERSATILE) += leds-versatile.o
obj-$(CONFIG_LEDS_MENF21BMC) += leds-menf21bmc.o
+obj-$(CONFIG_LEDS_SEAD3) += leds-sead3.o

# LED SPI Drivers
obj-$(CONFIG_LEDS_DAC124S085) += leds-dac124s085.o
diff --git a/drivers/leds/leds-sead3.c b/drivers/leds/leds-sead3.c
new file mode 100644
index 0000000..0cf79f5
--- /dev/null
+++ b/drivers/leds/leds-sead3.c
@@ -0,0 +1,90 @@
+/*
+ * This file is subject to the terms and conditions of the GNU General Public
+ * License. See the file "COPYING" in the main directory of this archive
+ * for more details.
+ *
+ * Copyright (C) 2012 MIPS Technologies, Inc. All rights reserved.
+ */
+#include <linux/kernel.h>
+#include <linux/module.h>
+#include <linux/init.h>
+#include <linux/platform_device.h>
+#include <linux/leds.h>
+#include <linux/err.h>
+#include <linux/io.h>
+
+static void sead3_pled_set(struct led_classdev *led_cdev,
+ enum led_brightness value)
+{
+ pr_debug("sead3_pled_set\n");
+ writel(value, (void __iomem *)0xBF000210); /* FIXME */
+}
+
+static void sead3_fled_set(struct led_classdev *led_cdev,
+ enum led_brightness value)
+{
+ pr_debug("sead3_fled_set\n");
+ writel(value, (void __iomem *)0xBF000218); /* FIXME */
+}
+
+static struct led_classdev sead3_pled = {
+ .name = "sead3::pled",
+ .brightness_set = sead3_pled_set,
+ .flags = LED_CORE_SUSPENDRESUME,
+};
+
+static struct led_classdev sead3_fled = {
+ .name = "sead3::fled",
+ .brightness_set = sead3_fled_set,
+ .flags = LED_CORE_SUSPENDRESUME,
+};
+
+static int sead3_led_probe(struct platform_device *pdev)
+{
+ int ret;
+
+ ret = led_classdev_register(&pdev->dev, &sead3_pled);
+ if (ret < 0)
+ return ret;
+
+ ret = led_classdev_register(&pdev->dev, &sead3_fled);
+ if (ret < 0)
+ led_classdev_unregister(&sead3_pled);
+
+ return ret;
+}
+
+static int sead3_led_remove(struct platform_device *pdev)
+{
+ led_classdev_unregister(&sead3_pled);
+ led_classdev_unregister(&sead3_fled);
+
+ return 0;
+}
+
+static struct platform_driver sead3_led_driver = {
+ .probe = sead3_led_probe,
+ .remove = sead3_led_remove,
+ .driver = {
+ .name = "sead3-led",
+ .owner = THIS_MODULE,
+ },
+};
+
+static int __init sead3_led_init(void)
+{
+ return platform_driver_register(&sead3_led_driver);
+}
+
+static void __exit sead3_led_exit(void)
+{
+ platform_driver_unregister(&sead3_led_driver);
+}
+
+module_init(sead3_led_init);
+module_exit(sead3_led_exit);
+
+MODULE_LICENSE("GPL");
+MODULE_DESCRIPTION("SEAD3 LED driver");
+MODULE_AUTHOR("Kristian Kielhofner <***@krisk.org>");
+MODULE_ALIAS("platform:sead3-led");
--
1.9.3
Loading...