Merge branch 'fixes-modulesplit' into fixes
[pandora-kernel.git] / drivers / mfd / mc13xxx-core.c
index dd232ea..e9619ac 100644 (file)
@@ -477,7 +477,7 @@ enum mc13xxx_id {
        MC13XXX_ID_INVALID,
 };
 
-const char *mc13xxx_chipname[] = {
+static const char *mc13xxx_chipname[] = {
        [MC13XXX_ID_MC13783] = "mc13783",
        [MC13XXX_ID_MC13892] = "mc13892",
 };
@@ -703,6 +703,11 @@ static int mc13xxx_probe(struct spi_device *spi)
        enum mc13xxx_id id;
        int ret;
 
+       if (!pdata) {
+               dev_err(&spi->dev, "invalid platform data\n");
+               return -EINVAL;
+       }
+
        mc13xxx = kzalloc(sizeof(*mc13xxx), GFP_KERNEL);
        if (!mc13xxx)
                return -ENOMEM;
@@ -759,10 +764,14 @@ err_revision:
        if (pdata->flags & MC13XXX_USE_TOUCHSCREEN)
                mc13xxx_add_subdevice(mc13xxx, "%s-ts");
 
-       if (pdata->flags & MC13XXX_USE_LED)
+       if (pdata->leds)
                mc13xxx_add_subdevice_pdata(mc13xxx, "%s-led",
                                pdata->leds, sizeof(*pdata->leds));
 
+       if (pdata->buttons)
+               mc13xxx_add_subdevice_pdata(mc13xxx, "%s-pwrbutton",
+                               pdata->buttons, sizeof(*pdata->buttons));
+
        return 0;
 }