[PATCH] extcon: Add support for qcom SPMI PMIC USB id detection hardware

2016-06-25 Thread Stephen Boyd
Some Qualcomm PMICs have a misc device that performs USB id pin
detection via an interrupt. When the interrupt triggers, we
should read the interrupt line to see if it has gone high or low.
If the interrupt is low then the ID pin is grounded, and if the
interrupt is high then the ID pin is being held high.

Cc: Roger Quadros 
Cc: Chanwoo Choi 
Signed-off-by: Stephen Boyd 
---
 .../bindings/extcon/qcom,pm8941-misc.txt   |  41 +
 drivers/extcon/Kconfig |   6 +
 drivers/extcon/Makefile|   1 +
 drivers/extcon/extcon-qcom-spmi-misc.c | 170 +
 4 files changed, 218 insertions(+)
 create mode 100644 
Documentation/devicetree/bindings/extcon/qcom,pm8941-misc.txt
 create mode 100644 drivers/extcon/extcon-qcom-spmi-misc.c

diff --git a/Documentation/devicetree/bindings/extcon/qcom,pm8941-misc.txt 
b/Documentation/devicetree/bindings/extcon/qcom,pm8941-misc.txt
new file mode 100644
index ..35383adb10f1
--- /dev/null
+++ b/Documentation/devicetree/bindings/extcon/qcom,pm8941-misc.txt
@@ -0,0 +1,41 @@
+Qualcomm's PM8941 USB ID Extcon device
+
+Some Qualcomm PMICs have a "misc" module that can be used to detect when
+the USB ID pin has been pulled low or high.
+
+PROPERTIES
+
+- compatible:
+Usage: required
+Value type: 
+Definition: Should contain "qcom,pm8941-misc";
+
+- reg:
+Usage: required
+Value type: 
+Definition: Should contain the offset to the misc address space
+
+- interrupts:
+Usage: required
+Value type: 
+Definition: Should contain the usb id interrupt
+
+- interrupt-names:
+Usage: required
+Value type: 
+Definition: Should contain the string "usb_id" for the usb id interrupt
+
+Example:
+
+   pmic {
+   usb_id: misc@900 {
+   compatible = "qcom,pm8941-misc";
+   reg = <0x900>;
+   interrupts = <0x0 0x9 0 IRQ_TYPE_EDGE_BOTH>;
+   interrupt-names = "usb_id";
+   };
+   }
+
+   usb-controller {
+   extcon = <_id>;
+   };
diff --git a/drivers/extcon/Kconfig b/drivers/extcon/Kconfig
index 3d89e60a3e71..b2ee47cb10ca 100644
--- a/drivers/extcon/Kconfig
+++ b/drivers/extcon/Kconfig
@@ -119,6 +119,12 @@ config EXTCON_SM5502
  Silicon Mitus SM5502. The SM5502 is a USB port accessory
  detector and switch.
 
+config EXTCON_QCOM_SPMI_MISC
+   tristate "Qualcomm USB extcon support"
+   help
+ Say Y here to enable SPMI PMIC based USB cable detection
+ support on Qualcomm PMICs such as PM8941.
+
 config EXTCON_USB_GPIO
tristate "USB GPIO extcon support"
depends on GPIOLIB || COMPILE_TEST
diff --git a/drivers/extcon/Makefile b/drivers/extcon/Makefile
index 2a0e4f45d5b2..8cf6eb068d34 100644
--- a/drivers/extcon/Makefile
+++ b/drivers/extcon/Makefile
@@ -15,4 +15,5 @@ obj-$(CONFIG_EXTCON_MAX8997)  += extcon-max8997.o
 obj-$(CONFIG_EXTCON_PALMAS)+= extcon-palmas.o
 obj-$(CONFIG_EXTCON_RT8973A)   += extcon-rt8973a.o
 obj-$(CONFIG_EXTCON_SM5502)+= extcon-sm5502.o
+obj-$(CONFIG_EXTCON_QCOM_SPMI_MISC) += extcon-qcom-spmi-misc.o
 obj-$(CONFIG_EXTCON_USB_GPIO)  += extcon-usb-gpio.o
diff --git a/drivers/extcon/extcon-qcom-spmi-misc.c 
b/drivers/extcon/extcon-qcom-spmi-misc.c
new file mode 100644
index ..f0ec6f1541e1
--- /dev/null
+++ b/drivers/extcon/extcon-qcom-spmi-misc.c
@@ -0,0 +1,170 @@
+/**
+ * Based on extcon-usb-gpio.c
+ *
+ * Copyright (C) 2015 Texas Instruments Incorporated - http://www.ti.com
+ * Author: Roger Quadros 
+ *
+ * Copyright (C) 2016 Linaro Ltd
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#define USB_ID_DEBOUNCE_MS 5   /* ms */
+
+struct qcom_usb_extcon_info {
+   struct extcon_dev *edev;
+   int irq;
+   struct delayed_work wq_detcable;
+   unsigned long debounce_jiffies;
+};
+
+static const unsigned int qcom_usb_extcon_cable[] = {
+   EXTCON_USB_HOST,
+   EXTCON_NONE,
+};
+
+static void qcom_usb_extcon_detect_cable(struct work_struct *work)
+{
+   bool id;
+   int ret;
+   struct qcom_usb_extcon_info *info = container_of(to_delayed_work(work),
+   struct qcom_usb_extcon_info,
+   wq_detcable);
+
+   /* check ID and update cable state 

[PATCH] extcon: Add support for qcom SPMI PMIC USB id detection hardware

2016-06-25 Thread Stephen Boyd
Some Qualcomm PMICs have a misc device that performs USB id pin
detection via an interrupt. When the interrupt triggers, we
should read the interrupt line to see if it has gone high or low.
If the interrupt is low then the ID pin is grounded, and if the
interrupt is high then the ID pin is being held high.

Cc: Roger Quadros 
Cc: Chanwoo Choi 
Signed-off-by: Stephen Boyd 
---
 .../bindings/extcon/qcom,pm8941-misc.txt   |  41 +
 drivers/extcon/Kconfig |   6 +
 drivers/extcon/Makefile|   1 +
 drivers/extcon/extcon-qcom-spmi-misc.c | 170 +
 4 files changed, 218 insertions(+)
 create mode 100644 
Documentation/devicetree/bindings/extcon/qcom,pm8941-misc.txt
 create mode 100644 drivers/extcon/extcon-qcom-spmi-misc.c

diff --git a/Documentation/devicetree/bindings/extcon/qcom,pm8941-misc.txt 
b/Documentation/devicetree/bindings/extcon/qcom,pm8941-misc.txt
new file mode 100644
index ..35383adb10f1
--- /dev/null
+++ b/Documentation/devicetree/bindings/extcon/qcom,pm8941-misc.txt
@@ -0,0 +1,41 @@
+Qualcomm's PM8941 USB ID Extcon device
+
+Some Qualcomm PMICs have a "misc" module that can be used to detect when
+the USB ID pin has been pulled low or high.
+
+PROPERTIES
+
+- compatible:
+Usage: required
+Value type: 
+Definition: Should contain "qcom,pm8941-misc";
+
+- reg:
+Usage: required
+Value type: 
+Definition: Should contain the offset to the misc address space
+
+- interrupts:
+Usage: required
+Value type: 
+Definition: Should contain the usb id interrupt
+
+- interrupt-names:
+Usage: required
+Value type: 
+Definition: Should contain the string "usb_id" for the usb id interrupt
+
+Example:
+
+   pmic {
+   usb_id: misc@900 {
+   compatible = "qcom,pm8941-misc";
+   reg = <0x900>;
+   interrupts = <0x0 0x9 0 IRQ_TYPE_EDGE_BOTH>;
+   interrupt-names = "usb_id";
+   };
+   }
+
+   usb-controller {
+   extcon = <_id>;
+   };
diff --git a/drivers/extcon/Kconfig b/drivers/extcon/Kconfig
index 3d89e60a3e71..b2ee47cb10ca 100644
--- a/drivers/extcon/Kconfig
+++ b/drivers/extcon/Kconfig
@@ -119,6 +119,12 @@ config EXTCON_SM5502
  Silicon Mitus SM5502. The SM5502 is a USB port accessory
  detector and switch.
 
+config EXTCON_QCOM_SPMI_MISC
+   tristate "Qualcomm USB extcon support"
+   help
+ Say Y here to enable SPMI PMIC based USB cable detection
+ support on Qualcomm PMICs such as PM8941.
+
 config EXTCON_USB_GPIO
tristate "USB GPIO extcon support"
depends on GPIOLIB || COMPILE_TEST
diff --git a/drivers/extcon/Makefile b/drivers/extcon/Makefile
index 2a0e4f45d5b2..8cf6eb068d34 100644
--- a/drivers/extcon/Makefile
+++ b/drivers/extcon/Makefile
@@ -15,4 +15,5 @@ obj-$(CONFIG_EXTCON_MAX8997)  += extcon-max8997.o
 obj-$(CONFIG_EXTCON_PALMAS)+= extcon-palmas.o
 obj-$(CONFIG_EXTCON_RT8973A)   += extcon-rt8973a.o
 obj-$(CONFIG_EXTCON_SM5502)+= extcon-sm5502.o
+obj-$(CONFIG_EXTCON_QCOM_SPMI_MISC) += extcon-qcom-spmi-misc.o
 obj-$(CONFIG_EXTCON_USB_GPIO)  += extcon-usb-gpio.o
diff --git a/drivers/extcon/extcon-qcom-spmi-misc.c 
b/drivers/extcon/extcon-qcom-spmi-misc.c
new file mode 100644
index ..f0ec6f1541e1
--- /dev/null
+++ b/drivers/extcon/extcon-qcom-spmi-misc.c
@@ -0,0 +1,170 @@
+/**
+ * Based on extcon-usb-gpio.c
+ *
+ * Copyright (C) 2015 Texas Instruments Incorporated - http://www.ti.com
+ * Author: Roger Quadros 
+ *
+ * Copyright (C) 2016 Linaro Ltd
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#define USB_ID_DEBOUNCE_MS 5   /* ms */
+
+struct qcom_usb_extcon_info {
+   struct extcon_dev *edev;
+   int irq;
+   struct delayed_work wq_detcable;
+   unsigned long debounce_jiffies;
+};
+
+static const unsigned int qcom_usb_extcon_cable[] = {
+   EXTCON_USB_HOST,
+   EXTCON_NONE,
+};
+
+static void qcom_usb_extcon_detect_cable(struct work_struct *work)
+{
+   bool id;
+   int ret;
+   struct qcom_usb_extcon_info *info = container_of(to_delayed_work(work),
+   struct qcom_usb_extcon_info,
+   wq_detcable);
+
+   /* check ID and update cable state */
+   ret = irq_get_irqchip_state(info->irq, IRQCHIP_STATE_LINE_LEVEL, );

[PATCH] power: qcom_smbb: Make an extcon for usb cable detection

2016-06-25 Thread Stephen Boyd
On these PMICs the usb cable connection/disconnection is
indicated by the usb-valid interrupt being high or low
respectively. Let's make an extcon for that, so we can notify usb
drivers of the cable state.

Cc: Bjorn Andersson 
Cc: Chanwoo Choi 
Signed-off-by: Stephen Boyd 
---
 drivers/power/qcom_smbb.c | 21 +
 1 file changed, 21 insertions(+)

diff --git a/drivers/power/qcom_smbb.c b/drivers/power/qcom_smbb.c
index 5eb1e9e543e2..b5896ba2a602 100644
--- a/drivers/power/qcom_smbb.c
+++ b/drivers/power/qcom_smbb.c
@@ -34,6 +34,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #define SMBB_CHG_VMAX  0x040
 #define SMBB_CHG_VSAFE 0x041
@@ -111,6 +112,7 @@ struct smbb_charger {
unsigned int revision;
unsigned int addr;
struct device *dev;
+   struct extcon_dev *edev;
 
bool dc_disabled;
bool jeita_ext_temp;
@@ -125,6 +127,11 @@ struct smbb_charger {
struct regmap *regmap;
 };
 
+static const unsigned int smbb_usb_extcon_cable[] = {
+   EXTCON_USB,
+   EXTCON_NONE,
+};
+
 static int smbb_vbat_weak_fn(unsigned int index)
 {
return 210 + index * 10;
@@ -371,6 +378,8 @@ static irqreturn_t smbb_usb_valid_handler(int irq, void 
*_data)
struct smbb_charger *chg = _data;
 
smbb_set_line_flag(chg, irq, STATUS_USBIN_VALID);
+   extcon_set_cable_state_(chg->edev, EXTCON_USB,
+   chg->status & STATUS_USBIN_VALID);
power_supply_changed(chg->usb_psy);
 
return IRQ_HANDLED;
@@ -849,6 +858,18 @@ static int smbb_charger_probe(struct platform_device *pdev)
return PTR_ERR(chg->usb_psy);
}
 
+   chg->edev = devm_extcon_dev_allocate(>dev, smbb_usb_extcon_cable);
+   if (IS_ERR(chg->edev)) {
+   dev_err(>dev, "failed to allocate extcon device\n");
+   return -ENOMEM;
+   }
+
+   rc = devm_extcon_dev_register(>dev, chg->edev);
+   if (rc < 0) {
+   dev_err(>dev, "failed to register extcon device\n");
+   return rc;
+   }
+
if (!chg->dc_disabled) {
dc_cfg.drv_data = chg;
dc_cfg.supplied_to = smbb_bif;
-- 
2.9.0.rc2.8.ga28705d



[PATCH] power: qcom_smbb: Make an extcon for usb cable detection

2016-06-25 Thread Stephen Boyd
On these PMICs the usb cable connection/disconnection is
indicated by the usb-valid interrupt being high or low
respectively. Let's make an extcon for that, so we can notify usb
drivers of the cable state.

Cc: Bjorn Andersson 
Cc: Chanwoo Choi 
Signed-off-by: Stephen Boyd 
---
 drivers/power/qcom_smbb.c | 21 +
 1 file changed, 21 insertions(+)

diff --git a/drivers/power/qcom_smbb.c b/drivers/power/qcom_smbb.c
index 5eb1e9e543e2..b5896ba2a602 100644
--- a/drivers/power/qcom_smbb.c
+++ b/drivers/power/qcom_smbb.c
@@ -34,6 +34,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #define SMBB_CHG_VMAX  0x040
 #define SMBB_CHG_VSAFE 0x041
@@ -111,6 +112,7 @@ struct smbb_charger {
unsigned int revision;
unsigned int addr;
struct device *dev;
+   struct extcon_dev *edev;
 
bool dc_disabled;
bool jeita_ext_temp;
@@ -125,6 +127,11 @@ struct smbb_charger {
struct regmap *regmap;
 };
 
+static const unsigned int smbb_usb_extcon_cable[] = {
+   EXTCON_USB,
+   EXTCON_NONE,
+};
+
 static int smbb_vbat_weak_fn(unsigned int index)
 {
return 210 + index * 10;
@@ -371,6 +378,8 @@ static irqreturn_t smbb_usb_valid_handler(int irq, void 
*_data)
struct smbb_charger *chg = _data;
 
smbb_set_line_flag(chg, irq, STATUS_USBIN_VALID);
+   extcon_set_cable_state_(chg->edev, EXTCON_USB,
+   chg->status & STATUS_USBIN_VALID);
power_supply_changed(chg->usb_psy);
 
return IRQ_HANDLED;
@@ -849,6 +858,18 @@ static int smbb_charger_probe(struct platform_device *pdev)
return PTR_ERR(chg->usb_psy);
}
 
+   chg->edev = devm_extcon_dev_allocate(>dev, smbb_usb_extcon_cable);
+   if (IS_ERR(chg->edev)) {
+   dev_err(>dev, "failed to allocate extcon device\n");
+   return -ENOMEM;
+   }
+
+   rc = devm_extcon_dev_register(>dev, chg->edev);
+   if (rc < 0) {
+   dev_err(>dev, "failed to register extcon device\n");
+   return rc;
+   }
+
if (!chg->dc_disabled) {
dc_cfg.drv_data = chg;
dc_cfg.supplied_to = smbb_bif;
-- 
2.9.0.rc2.8.ga28705d



[PATCH 1/3] regulator: qcom_spmi: Add support for S4 supply on pm8941

2016-06-25 Thread Stephen Boyd
The S4 supply is sometimes called the boost regulator because it
outputs 5V. Typically it's connected to the 5vs1 and 5vs2
switches for use in USB OTG and HDMI applications. Add support
for this regulator which was mistakenly left out from the initial
submission of this driver.

Cc: Bjorn Andersson 
Fixes: e92a4047419c ("regulator: Add QCOM SPMI regulator driver")
Signed-off-by: Stephen Boyd 
---
 Documentation/devicetree/bindings/regulator/qcom,spmi-regulator.txt | 4 ++--
 drivers/regulator/qcom_spmi-regulator.c | 1 +
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git 
a/Documentation/devicetree/bindings/regulator/qcom,spmi-regulator.txt 
b/Documentation/devicetree/bindings/regulator/qcom,spmi-regulator.txt
index 46c6f3ed1a1c..3e827bb9a56d 100644
--- a/Documentation/devicetree/bindings/regulator/qcom,spmi-regulator.txt
+++ b/Documentation/devicetree/bindings/regulator/qcom,spmi-regulator.txt
@@ -113,8 +113,8 @@ pm8916:
l14, l15, l16, l17, l18
 
 pm8941:
-   s1, s2, s3, l1, l2, l3, l4, l5, l6, l7, l8, l9, l10, l11, l12, l13, l14,
-   l15, l16, l17, l18, l19, l20, l21, l22, l23, l24, lvs1, lvs2, lvs3,
+   s1, s2, s3, s4, l1, l2, l3, l4, l5, l6, l7, l8, l9, l10, l11, l12, l13,
+   l14, l15, l16, l17, l18, l19, l20, l21, l22, l23, l24, lvs1, lvs2, lvs3,
mvs1, mvs2
 
 pm8994:
diff --git a/drivers/regulator/qcom_spmi-regulator.c 
b/drivers/regulator/qcom_spmi-regulator.c
index 84cce21e98cd..fe09407b150b 100644
--- a/drivers/regulator/qcom_spmi-regulator.c
+++ b/drivers/regulator/qcom_spmi-regulator.c
@@ -1496,6 +1496,7 @@ static const struct spmi_regulator_data 
pm8941_regulators[] = {
{ "s1", 0x1400, "vdd_s1", },
{ "s2", 0x1700, "vdd_s2", },
{ "s3", 0x1a00, "vdd_s3", },
+   { "s4", 0xa000, },
{ "l1", 0x4000, "vdd_l1_l3", },
{ "l2", 0x4100, "vdd_l2_lvs_1_2_3", },
{ "l3", 0x4200, "vdd_l1_l3", },
-- 
2.9.0.rc2.8.ga28705d



[PATCH 1/3] regulator: qcom_spmi: Add support for S4 supply on pm8941

2016-06-25 Thread Stephen Boyd
The S4 supply is sometimes called the boost regulator because it
outputs 5V. Typically it's connected to the 5vs1 and 5vs2
switches for use in USB OTG and HDMI applications. Add support
for this regulator which was mistakenly left out from the initial
submission of this driver.

Cc: Bjorn Andersson 
Fixes: e92a4047419c ("regulator: Add QCOM SPMI regulator driver")
Signed-off-by: Stephen Boyd 
---
 Documentation/devicetree/bindings/regulator/qcom,spmi-regulator.txt | 4 ++--
 drivers/regulator/qcom_spmi-regulator.c | 1 +
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git 
a/Documentation/devicetree/bindings/regulator/qcom,spmi-regulator.txt 
b/Documentation/devicetree/bindings/regulator/qcom,spmi-regulator.txt
index 46c6f3ed1a1c..3e827bb9a56d 100644
--- a/Documentation/devicetree/bindings/regulator/qcom,spmi-regulator.txt
+++ b/Documentation/devicetree/bindings/regulator/qcom,spmi-regulator.txt
@@ -113,8 +113,8 @@ pm8916:
l14, l15, l16, l17, l18
 
 pm8941:
-   s1, s2, s3, l1, l2, l3, l4, l5, l6, l7, l8, l9, l10, l11, l12, l13, l14,
-   l15, l16, l17, l18, l19, l20, l21, l22, l23, l24, lvs1, lvs2, lvs3,
+   s1, s2, s3, s4, l1, l2, l3, l4, l5, l6, l7, l8, l9, l10, l11, l12, l13,
+   l14, l15, l16, l17, l18, l19, l20, l21, l22, l23, l24, lvs1, lvs2, lvs3,
mvs1, mvs2
 
 pm8994:
diff --git a/drivers/regulator/qcom_spmi-regulator.c 
b/drivers/regulator/qcom_spmi-regulator.c
index 84cce21e98cd..fe09407b150b 100644
--- a/drivers/regulator/qcom_spmi-regulator.c
+++ b/drivers/regulator/qcom_spmi-regulator.c
@@ -1496,6 +1496,7 @@ static const struct spmi_regulator_data 
pm8941_regulators[] = {
{ "s1", 0x1400, "vdd_s1", },
{ "s2", 0x1700, "vdd_s2", },
{ "s3", 0x1a00, "vdd_s3", },
+   { "s4", 0xa000, },
{ "l1", 0x4000, "vdd_l1_l3", },
{ "l2", 0x4100, "vdd_l2_lvs_1_2_3", },
{ "l3", 0x4200, "vdd_l1_l3", },
-- 
2.9.0.rc2.8.ga28705d



[PATCH 0/3] Update pm8941 spmi regulators for USB OTG

2016-06-25 Thread Stephen Boyd
While rewriting the USB support for MSM SoCs I ran into a few
minor bugs with the pm8941 regulator driver that hadn't been found
before. These patches are part of a larger series that allows me
to get proper USB OTG support working on the apq8074 dragonboard.

Stephen Boyd (3):
  regulator: qcom_spmi: Add support for S4 supply on pm8941
  regulator: qcom_spmi: Update mvs1/mvs2 switches on pm8941
  regulator: qcom_spmi: Add support for get_mode/set_mode on switches

 .../devicetree/bindings/regulator/qcom,spmi-regulator.txt  | 6 +++---
 drivers/regulator/qcom_spmi-regulator.c| 7 +--
 2 files changed, 8 insertions(+), 5 deletions(-)

-- 
2.9.0.rc2.8.ga28705d



[PATCH 3/3] regulator: qcom_spmi: Add support for get_mode/set_mode on switches

2016-06-25 Thread Stephen Boyd
The voltage switches support mode switching, so add support for
these ops to those types of regulators.

Cc: Bjorn Andersson 
Fixes: e92a4047419c ("regulator: Add QCOM SPMI regulator driver")
Signed-off-by: Stephen Boyd 
---
 drivers/regulator/qcom_spmi-regulator.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/regulator/qcom_spmi-regulator.c 
b/drivers/regulator/qcom_spmi-regulator.c
index 43f8f20b82e9..16c5f84e06a7 100644
--- a/drivers/regulator/qcom_spmi-regulator.c
+++ b/drivers/regulator/qcom_spmi-regulator.c
@@ -1085,6 +1085,8 @@ static struct regulator_ops spmi_vs_ops = {
.set_pull_down  = spmi_regulator_common_set_pull_down,
.set_soft_start = spmi_regulator_common_set_soft_start,
.set_over_current_protection = spmi_regulator_vs_ocp,
+   .set_mode   = spmi_regulator_common_set_mode,
+   .get_mode   = spmi_regulator_common_get_mode,
 };
 
 static struct regulator_ops spmi_boost_ops = {
-- 
2.9.0.rc2.8.ga28705d



[PATCH 2/3] regulator: qcom_spmi: Update mvs1/mvs2 switches on pm8941

2016-06-25 Thread Stephen Boyd
The mvs1 and mvs2 switches are actually called 5vs1 and 5vs2 on
some datasheets. Let's rename them to match the datasheets and
also match the RPM based regulator driver which calls these by
their 5vs names (see qcom_smd-regulator.c). There aren't any
users of these regulators so far, so there aren't any concerns of
DT ABI breakage here. While we're here making updates to the
switches, also mandate usage of the OCP irq for these switches
too.

Cc: Bjorn Andersson 
Fixes: e92a4047419c ("regulator: Add QCOM SPMI regulator driver")
Signed-off-by: Stephen Boyd 
---
 Documentation/devicetree/bindings/regulator/qcom,spmi-regulator.txt | 2 +-
 drivers/regulator/qcom_spmi-regulator.c | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git 
a/Documentation/devicetree/bindings/regulator/qcom,spmi-regulator.txt 
b/Documentation/devicetree/bindings/regulator/qcom,spmi-regulator.txt
index 3e827bb9a56d..0fa3b0fac129 100644
--- a/Documentation/devicetree/bindings/regulator/qcom,spmi-regulator.txt
+++ b/Documentation/devicetree/bindings/regulator/qcom,spmi-regulator.txt
@@ -115,7 +115,7 @@ pm8916:
 pm8941:
s1, s2, s3, s4, l1, l2, l3, l4, l5, l6, l7, l8, l9, l10, l11, l12, l13,
l14, l15, l16, l17, l18, l19, l20, l21, l22, l23, l24, lvs1, lvs2, lvs3,
-   mvs1, mvs2
+   5vs1, 5vs2
 
 pm8994:
s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11, s12, l1, l2, l3, l4, l5,
diff --git a/drivers/regulator/qcom_spmi-regulator.c 
b/drivers/regulator/qcom_spmi-regulator.c
index fe09407b150b..43f8f20b82e9 100644
--- a/drivers/regulator/qcom_spmi-regulator.c
+++ b/drivers/regulator/qcom_spmi-regulator.c
@@ -1524,8 +1524,8 @@ static const struct spmi_regulator_data 
pm8941_regulators[] = {
{ "lvs1", 0x8000, "vdd_l2_lvs_1_2_3", },
{ "lvs2", 0x8100, "vdd_l2_lvs_1_2_3", },
{ "lvs3", 0x8200, "vdd_l2_lvs_1_2_3", },
-   { "mvs1", 0x8300, "vin_5vs", },
-   { "mvs2", 0x8400, "vin_5vs", },
+   { "5vs1", 0x8300, "vin_5vs", "ocp-5vs1", },
+   { "5vs2", 0x8400, "vin_5vs", "ocp-5vs2", },
{ }
 };
 
-- 
2.9.0.rc2.8.ga28705d



[PATCH 0/3] Update pm8941 spmi regulators for USB OTG

2016-06-25 Thread Stephen Boyd
While rewriting the USB support for MSM SoCs I ran into a few
minor bugs with the pm8941 regulator driver that hadn't been found
before. These patches are part of a larger series that allows me
to get proper USB OTG support working on the apq8074 dragonboard.

Stephen Boyd (3):
  regulator: qcom_spmi: Add support for S4 supply on pm8941
  regulator: qcom_spmi: Update mvs1/mvs2 switches on pm8941
  regulator: qcom_spmi: Add support for get_mode/set_mode on switches

 .../devicetree/bindings/regulator/qcom,spmi-regulator.txt  | 6 +++---
 drivers/regulator/qcom_spmi-regulator.c| 7 +--
 2 files changed, 8 insertions(+), 5 deletions(-)

-- 
2.9.0.rc2.8.ga28705d



[PATCH 3/3] regulator: qcom_spmi: Add support for get_mode/set_mode on switches

2016-06-25 Thread Stephen Boyd
The voltage switches support mode switching, so add support for
these ops to those types of regulators.

Cc: Bjorn Andersson 
Fixes: e92a4047419c ("regulator: Add QCOM SPMI regulator driver")
Signed-off-by: Stephen Boyd 
---
 drivers/regulator/qcom_spmi-regulator.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/regulator/qcom_spmi-regulator.c 
b/drivers/regulator/qcom_spmi-regulator.c
index 43f8f20b82e9..16c5f84e06a7 100644
--- a/drivers/regulator/qcom_spmi-regulator.c
+++ b/drivers/regulator/qcom_spmi-regulator.c
@@ -1085,6 +1085,8 @@ static struct regulator_ops spmi_vs_ops = {
.set_pull_down  = spmi_regulator_common_set_pull_down,
.set_soft_start = spmi_regulator_common_set_soft_start,
.set_over_current_protection = spmi_regulator_vs_ocp,
+   .set_mode   = spmi_regulator_common_set_mode,
+   .get_mode   = spmi_regulator_common_get_mode,
 };
 
 static struct regulator_ops spmi_boost_ops = {
-- 
2.9.0.rc2.8.ga28705d



[PATCH 2/3] regulator: qcom_spmi: Update mvs1/mvs2 switches on pm8941

2016-06-25 Thread Stephen Boyd
The mvs1 and mvs2 switches are actually called 5vs1 and 5vs2 on
some datasheets. Let's rename them to match the datasheets and
also match the RPM based regulator driver which calls these by
their 5vs names (see qcom_smd-regulator.c). There aren't any
users of these regulators so far, so there aren't any concerns of
DT ABI breakage here. While we're here making updates to the
switches, also mandate usage of the OCP irq for these switches
too.

Cc: Bjorn Andersson 
Fixes: e92a4047419c ("regulator: Add QCOM SPMI regulator driver")
Signed-off-by: Stephen Boyd 
---
 Documentation/devicetree/bindings/regulator/qcom,spmi-regulator.txt | 2 +-
 drivers/regulator/qcom_spmi-regulator.c | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git 
a/Documentation/devicetree/bindings/regulator/qcom,spmi-regulator.txt 
b/Documentation/devicetree/bindings/regulator/qcom,spmi-regulator.txt
index 3e827bb9a56d..0fa3b0fac129 100644
--- a/Documentation/devicetree/bindings/regulator/qcom,spmi-regulator.txt
+++ b/Documentation/devicetree/bindings/regulator/qcom,spmi-regulator.txt
@@ -115,7 +115,7 @@ pm8916:
 pm8941:
s1, s2, s3, s4, l1, l2, l3, l4, l5, l6, l7, l8, l9, l10, l11, l12, l13,
l14, l15, l16, l17, l18, l19, l20, l21, l22, l23, l24, lvs1, lvs2, lvs3,
-   mvs1, mvs2
+   5vs1, 5vs2
 
 pm8994:
s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11, s12, l1, l2, l3, l4, l5,
diff --git a/drivers/regulator/qcom_spmi-regulator.c 
b/drivers/regulator/qcom_spmi-regulator.c
index fe09407b150b..43f8f20b82e9 100644
--- a/drivers/regulator/qcom_spmi-regulator.c
+++ b/drivers/regulator/qcom_spmi-regulator.c
@@ -1524,8 +1524,8 @@ static const struct spmi_regulator_data 
pm8941_regulators[] = {
{ "lvs1", 0x8000, "vdd_l2_lvs_1_2_3", },
{ "lvs2", 0x8100, "vdd_l2_lvs_1_2_3", },
{ "lvs3", 0x8200, "vdd_l2_lvs_1_2_3", },
-   { "mvs1", 0x8300, "vin_5vs", },
-   { "mvs2", 0x8400, "vin_5vs", },
+   { "5vs1", 0x8300, "vin_5vs", "ocp-5vs1", },
+   { "5vs2", 0x8400, "vin_5vs", "ocp-5vs2", },
{ }
 };
 
-- 
2.9.0.rc2.8.ga28705d



[PATCH] usb: ulpi: Automatically set driver::owner with ulpi_driver_register()

2016-06-25 Thread Stephen Boyd
Let's follow other driver registration functions and
automatically set the driver's owner member to THIS_MODULE when
ulpi_driver_register() is called. This allows ulpi driver writers
to forget about this boiler plate detail and avoids common bugs
in the process.

Cc: Heikki Krogerus 
Signed-off-by: Stephen Boyd 
---
 drivers/usb/common/ulpi.c   | 5 +++--
 include/linux/ulpi/driver.h | 6 +-
 2 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/drivers/usb/common/ulpi.c b/drivers/usb/common/ulpi.c
index a6b2a150b176..4e15e2b9f4b4 100644
--- a/drivers/usb/common/ulpi.c
+++ b/drivers/usb/common/ulpi.c
@@ -148,16 +148,17 @@ static struct device_type ulpi_dev_type = {
  *
  * Registers a driver with the ULPI bus.
  */
-int ulpi_register_driver(struct ulpi_driver *drv)
+int __ulpi_register_driver(struct ulpi_driver *drv, struct module *module)
 {
if (!drv->probe)
return -EINVAL;
 
+   drv->driver.owner = module;
drv->driver.bus = _bus;
 
return driver_register(>driver);
 }
-EXPORT_SYMBOL_GPL(ulpi_register_driver);
+EXPORT_SYMBOL_GPL(__ulpi_register_driver);
 
 /**
  * ulpi_unregister_driver - unregister a driver with the ULPI bus
diff --git a/include/linux/ulpi/driver.h b/include/linux/ulpi/driver.h
index 388f6e08b9d4..80b36ca12e80 100644
--- a/include/linux/ulpi/driver.h
+++ b/include/linux/ulpi/driver.h
@@ -47,7 +47,11 @@ struct ulpi_driver {
 
 #define to_ulpi_driver(d) container_of(d, struct ulpi_driver, driver)
 
-int ulpi_register_driver(struct ulpi_driver *drv);
+/*
+ * use a macro to avoid include chaining to get THIS_MODULE
+ */
+#define ulpi_register_driver(drv) __ulpi_register_driver(drv, THIS_MODULE)
+int __ulpi_register_driver(struct ulpi_driver *drv, struct module *module);
 void ulpi_unregister_driver(struct ulpi_driver *drv);
 
 #define module_ulpi_driver(__ulpi_driver) \
-- 
2.9.0.rc2.8.ga28705d



[PATCH] usb: ulpi: Automatically set driver::owner with ulpi_driver_register()

2016-06-25 Thread Stephen Boyd
Let's follow other driver registration functions and
automatically set the driver's owner member to THIS_MODULE when
ulpi_driver_register() is called. This allows ulpi driver writers
to forget about this boiler plate detail and avoids common bugs
in the process.

Cc: Heikki Krogerus 
Signed-off-by: Stephen Boyd 
---
 drivers/usb/common/ulpi.c   | 5 +++--
 include/linux/ulpi/driver.h | 6 +-
 2 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/drivers/usb/common/ulpi.c b/drivers/usb/common/ulpi.c
index a6b2a150b176..4e15e2b9f4b4 100644
--- a/drivers/usb/common/ulpi.c
+++ b/drivers/usb/common/ulpi.c
@@ -148,16 +148,17 @@ static struct device_type ulpi_dev_type = {
  *
  * Registers a driver with the ULPI bus.
  */
-int ulpi_register_driver(struct ulpi_driver *drv)
+int __ulpi_register_driver(struct ulpi_driver *drv, struct module *module)
 {
if (!drv->probe)
return -EINVAL;
 
+   drv->driver.owner = module;
drv->driver.bus = _bus;
 
return driver_register(>driver);
 }
-EXPORT_SYMBOL_GPL(ulpi_register_driver);
+EXPORT_SYMBOL_GPL(__ulpi_register_driver);
 
 /**
  * ulpi_unregister_driver - unregister a driver with the ULPI bus
diff --git a/include/linux/ulpi/driver.h b/include/linux/ulpi/driver.h
index 388f6e08b9d4..80b36ca12e80 100644
--- a/include/linux/ulpi/driver.h
+++ b/include/linux/ulpi/driver.h
@@ -47,7 +47,11 @@ struct ulpi_driver {
 
 #define to_ulpi_driver(d) container_of(d, struct ulpi_driver, driver)
 
-int ulpi_register_driver(struct ulpi_driver *drv);
+/*
+ * use a macro to avoid include chaining to get THIS_MODULE
+ */
+#define ulpi_register_driver(drv) __ulpi_register_driver(drv, THIS_MODULE)
+int __ulpi_register_driver(struct ulpi_driver *drv, struct module *module);
 void ulpi_unregister_driver(struct ulpi_driver *drv);
 
 #define module_ulpi_driver(__ulpi_driver) \
-- 
2.9.0.rc2.8.ga28705d



[PATCH] usb: misc: Add driver for usb4604

2016-06-25 Thread Stephen Boyd
This is a minimal driver to support bringing a usb4604 device
from microchip out of reset and into hub mode. The usb4604 device
is related to the usb3503 device, but it didn't seem close enough
to warrant putting both into the same file. This patch borrows
some of the usb3503 structure and trims it down to just handle
the optional reset gpio and adds the i2c command to put the
device into hub mode.

Datasheet: http://ww1.microchip.com/downloads/en/DeviceDoc/1716A.pdf
Cc: 
Signed-off-by: Stephen Boyd 
---
 Documentation/devicetree/bindings/usb/usb4604.txt |  19 +++
 drivers/usb/misc/Kconfig  |   6 +
 drivers/usb/misc/Makefile |   1 +
 drivers/usb/misc/usb4604.c| 175 ++
 4 files changed, 201 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/usb/usb4604.txt
 create mode 100644 drivers/usb/misc/usb4604.c

diff --git a/Documentation/devicetree/bindings/usb/usb4604.txt 
b/Documentation/devicetree/bindings/usb/usb4604.txt
new file mode 100644
index ..82506d17712c
--- /dev/null
+++ b/Documentation/devicetree/bindings/usb/usb4604.txt
@@ -0,0 +1,19 @@
+SMSC USB4604 High-Speed Hub Controller
+
+Required properties:
+- compatible: Should be "smsc,usb4604"
+
+Optional properties:
+- reg: Specifies the i2c slave address, it is required and should be 0x2d
+   if I2C is used.
+- reset-gpios: Should specify GPIO for reset.
+- initial-mode: Should specify initial mode.
+(1 for HUB mode, 2 for STANDBY mode)
+
+Examples:
+   usb-hub@2d {
+   compatible = "smsc,usb4604";
+   reg = <0x2d>;
+   reset-gpios = < 5 1>;
+   initial-mode = <1>;
+   };
diff --git a/drivers/usb/misc/Kconfig b/drivers/usb/misc/Kconfig
index e9e5ae521fa6..ac9ca570b26d 100644
--- a/drivers/usb/misc/Kconfig
+++ b/drivers/usb/misc/Kconfig
@@ -249,6 +249,12 @@ config USB_HSIC_USB3503
help
  This option enables support for SMSC USB3503 HSIC to USB 2.0 Driver.
 
+config USB_HSIC_USB4604
+   tristate "USB4604 HSIC to USB20 Driver"
+   depends on I2C
+   help
+ This option enables support for SMSC USB4604 HSIC to USB 2.0 Driver.
+
 config USB_LINK_LAYER_TEST
tristate "USB Link Layer Test driver"
help
diff --git a/drivers/usb/misc/Makefile b/drivers/usb/misc/Makefile
index 2769cf6351b4..95e897dff681 100644
--- a/drivers/usb/misc/Makefile
+++ b/drivers/usb/misc/Makefile
@@ -25,6 +25,7 @@ obj-$(CONFIG_USB_USS720)  += uss720.o
 obj-$(CONFIG_USB_SEVSEG)   += usbsevseg.o
 obj-$(CONFIG_USB_YUREX)+= yurex.o
 obj-$(CONFIG_USB_HSIC_USB3503) += usb3503.o
+obj-$(CONFIG_USB_HSIC_USB4604) += usb4604.o
 obj-$(CONFIG_USB_CHAOSKEY) += chaoskey.o
 obj-$(CONFIG_UCSI) += ucsi.o
 
diff --git a/drivers/usb/misc/usb4604.c b/drivers/usb/misc/usb4604.c
new file mode 100644
index ..e9f37fb746ac
--- /dev/null
+++ b/drivers/usb/misc/usb4604.c
@@ -0,0 +1,175 @@
+/*
+ * Driver for SMSC USB4604 USB HSIC 4-port 2.0 hub controller driver
+ * Based on usb3503 driver
+ *
+ * Copyright (c) 2012-2013 Dongjin Kim (tobet...@gmail.com)
+ * Copyright (c) 2016 Linaro Ltd.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+
+enum usb4604_mode {
+   USB4604_MODE_UNKNOWN,
+   USB4604_MODE_HUB,
+   USB4604_MODE_STANDBY,
+};
+
+struct usb4604 {
+   enum usb4604_mode   mode;
+   struct device   *dev;
+   struct gpio_desc*gpio_reset;
+};
+
+static void usb4604_reset(struct usb4604 *hub, int state)
+{
+   gpiod_set_value_cansleep(hub->gpio_reset, state);
+
+   /* Wait for i2c logic to come up */
+   if (state)
+   msleep(250);
+}
+
+static int usb4604_connect(struct usb4604 *hub)
+{
+   struct device *dev = hub->dev;
+   struct i2c_client *client = to_i2c_client(dev);
+   int err;
+   u8 connect_cmd[] = { 0xaa, 0x55, 0x00 };
+
+   usb4604_reset(hub, 1);
+
+   err = i2c_master_send(client, connect_cmd, ARRAY_SIZE(connect_cmd));
+   if (err < 0) {
+   usb4604_reset(hub, 0);
+   return err;
+   }
+
+   hub->mode = USB4604_MODE_HUB;
+   dev_dbg(dev, "switched to HUB mode\n");
+
+   return 0;
+}
+
+static int usb4604_switch_mode(struct usb4604 *hub, enum 

[PATCH] usb: misc: Add driver for usb4604

2016-06-25 Thread Stephen Boyd
This is a minimal driver to support bringing a usb4604 device
from microchip out of reset and into hub mode. The usb4604 device
is related to the usb3503 device, but it didn't seem close enough
to warrant putting both into the same file. This patch borrows
some of the usb3503 structure and trims it down to just handle
the optional reset gpio and adds the i2c command to put the
device into hub mode.

Datasheet: http://ww1.microchip.com/downloads/en/DeviceDoc/1716A.pdf
Cc: 
Signed-off-by: Stephen Boyd 
---
 Documentation/devicetree/bindings/usb/usb4604.txt |  19 +++
 drivers/usb/misc/Kconfig  |   6 +
 drivers/usb/misc/Makefile |   1 +
 drivers/usb/misc/usb4604.c| 175 ++
 4 files changed, 201 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/usb/usb4604.txt
 create mode 100644 drivers/usb/misc/usb4604.c

diff --git a/Documentation/devicetree/bindings/usb/usb4604.txt 
b/Documentation/devicetree/bindings/usb/usb4604.txt
new file mode 100644
index ..82506d17712c
--- /dev/null
+++ b/Documentation/devicetree/bindings/usb/usb4604.txt
@@ -0,0 +1,19 @@
+SMSC USB4604 High-Speed Hub Controller
+
+Required properties:
+- compatible: Should be "smsc,usb4604"
+
+Optional properties:
+- reg: Specifies the i2c slave address, it is required and should be 0x2d
+   if I2C is used.
+- reset-gpios: Should specify GPIO for reset.
+- initial-mode: Should specify initial mode.
+(1 for HUB mode, 2 for STANDBY mode)
+
+Examples:
+   usb-hub@2d {
+   compatible = "smsc,usb4604";
+   reg = <0x2d>;
+   reset-gpios = < 5 1>;
+   initial-mode = <1>;
+   };
diff --git a/drivers/usb/misc/Kconfig b/drivers/usb/misc/Kconfig
index e9e5ae521fa6..ac9ca570b26d 100644
--- a/drivers/usb/misc/Kconfig
+++ b/drivers/usb/misc/Kconfig
@@ -249,6 +249,12 @@ config USB_HSIC_USB3503
help
  This option enables support for SMSC USB3503 HSIC to USB 2.0 Driver.
 
+config USB_HSIC_USB4604
+   tristate "USB4604 HSIC to USB20 Driver"
+   depends on I2C
+   help
+ This option enables support for SMSC USB4604 HSIC to USB 2.0 Driver.
+
 config USB_LINK_LAYER_TEST
tristate "USB Link Layer Test driver"
help
diff --git a/drivers/usb/misc/Makefile b/drivers/usb/misc/Makefile
index 2769cf6351b4..95e897dff681 100644
--- a/drivers/usb/misc/Makefile
+++ b/drivers/usb/misc/Makefile
@@ -25,6 +25,7 @@ obj-$(CONFIG_USB_USS720)  += uss720.o
 obj-$(CONFIG_USB_SEVSEG)   += usbsevseg.o
 obj-$(CONFIG_USB_YUREX)+= yurex.o
 obj-$(CONFIG_USB_HSIC_USB3503) += usb3503.o
+obj-$(CONFIG_USB_HSIC_USB4604) += usb4604.o
 obj-$(CONFIG_USB_CHAOSKEY) += chaoskey.o
 obj-$(CONFIG_UCSI) += ucsi.o
 
diff --git a/drivers/usb/misc/usb4604.c b/drivers/usb/misc/usb4604.c
new file mode 100644
index ..e9f37fb746ac
--- /dev/null
+++ b/drivers/usb/misc/usb4604.c
@@ -0,0 +1,175 @@
+/*
+ * Driver for SMSC USB4604 USB HSIC 4-port 2.0 hub controller driver
+ * Based on usb3503 driver
+ *
+ * Copyright (c) 2012-2013 Dongjin Kim (tobet...@gmail.com)
+ * Copyright (c) 2016 Linaro Ltd.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+
+enum usb4604_mode {
+   USB4604_MODE_UNKNOWN,
+   USB4604_MODE_HUB,
+   USB4604_MODE_STANDBY,
+};
+
+struct usb4604 {
+   enum usb4604_mode   mode;
+   struct device   *dev;
+   struct gpio_desc*gpio_reset;
+};
+
+static void usb4604_reset(struct usb4604 *hub, int state)
+{
+   gpiod_set_value_cansleep(hub->gpio_reset, state);
+
+   /* Wait for i2c logic to come up */
+   if (state)
+   msleep(250);
+}
+
+static int usb4604_connect(struct usb4604 *hub)
+{
+   struct device *dev = hub->dev;
+   struct i2c_client *client = to_i2c_client(dev);
+   int err;
+   u8 connect_cmd[] = { 0xaa, 0x55, 0x00 };
+
+   usb4604_reset(hub, 1);
+
+   err = i2c_master_send(client, connect_cmd, ARRAY_SIZE(connect_cmd));
+   if (err < 0) {
+   usb4604_reset(hub, 0);
+   return err;
+   }
+
+   hub->mode = USB4604_MODE_HUB;
+   dev_dbg(dev, "switched to HUB mode\n");
+
+   return 0;
+}
+
+static int usb4604_switch_mode(struct usb4604 *hub, enum usb4604_mode mode)
+{
+   struct device *dev = 

Re: [PATCH] locking/osq: Drop the overload of osq lock

2016-06-25 Thread panxinhui

> 在 2016年6月26日,03:20,Peter Zijlstra  写道:
> 
> On Sun, Jun 26, 2016 at 01:27:56AM +0800, panxinhui wrote:
 Would that not have issues where the owner cpu is kept running but the
 spinner (ie. _this_ vcpu) gets preempted? I would think that in that
 case we too want to stop spinning.
 
>>> 
>> do  you mean that the spinner detect itself had yield out during the
>> big spin loop?
>> 
>> It is very possible to happen.  BUT if spinner(on this vcpu) yield
>> out, the next spinner would break the spin loop.  AND if spinner
>> detect itself yield out once, it’s very possible to get the osq lock
>> soon as long as the ower vcpu is running.
>> 
>> SO I think we need just check the owner vcpu’s yield_count.
> 
> I had a quick look at KVM and it looks like it only has
> kvm_cpu::preempted, which would suggest the interface boqun proposed.
> 
> We'll have to look at many of the other virt platforms as well to see
> what they can do.
> 
> We could also provide _both_ interfaces and a platform can implement
> whichever variant (or both) it can.
> 
the kvm code on ppc has implemented  yield_count.
It let me feel a little relaxed. :)

looks like we could  introduce the interface like below.

bool vcpu_is_preempted(int cpu)
{
return arch_vcpu_is_preempted(cpu);
}

#ifdef arch_vcpu_has_yield_count 
bool vcpu_has_preemtped_once(int cpu, unsigned int yield_count)
 {
return arch_get_vcpu_yield_count() != yield_count;
}

#else
bool vcpu_has_preemtped_once(int cpu, unsigned int yield_count)
{
/*just let called know it is preepmpted*/
return vcpu_is_preempted(cpu);
}
#endif




[PATCH 2/2] pinctrl: qcom: msm8974: Add hsic_ctl pinmux

2016-06-25 Thread Stephen Boyd
The msm8974 pinctrl variant has a couple USB HSIC "glue"
registers that let us mux between the pinctrl register settings
or the HSIC core settings for the HSIC pins (gpio 144 and gpio
145). Support this method of operation by adding hsic_data and
hsic_strobe pins that can select between hsic_ctl and gpio
functions. This allows us to toggle the hsic pin configuration
over to the HSIC core at runtime.

Cc: Bjorn Andersson 
Signed-off-by: Stephen Boyd 
---
 .../bindings/pinctrl/qcom,msm8974-pinctrl.txt  |  5 ++-
 drivers/pinctrl/qcom/pinctrl-msm8x74.c | 43 +-
 2 files changed, 46 insertions(+), 2 deletions(-)

diff --git a/Documentation/devicetree/bindings/pinctrl/qcom,msm8974-pinctrl.txt 
b/Documentation/devicetree/bindings/pinctrl/qcom,msm8974-pinctrl.txt
index e4d6a9d20f7d..453bd7c76d6b 100644
--- a/Documentation/devicetree/bindings/pinctrl/qcom,msm8974-pinctrl.txt
+++ b/Documentation/devicetree/bindings/pinctrl/qcom,msm8974-pinctrl.txt
@@ -49,6 +49,9 @@ Valid values for pins are:
   sdc1_clk, sdc1_cmd, sdc1_data, sdc2_clk, sdc2_cmd, sdc2_data
 Supports bias and drive-strength
 
+  hsic_data, hsic_strobe
+Supports only mux
+
 Valid values for function are:
   cci_i2c0, cci_i2c1, uim1, uim2, uim_batt_alarm,
   blsp_uim1, blsp_uart1, blsp_i2c1, blsp_spi1,
@@ -70,7 +73,7 @@ Valid values for function are:
   cam_mckl0, cam_mclk1, cam_mclk2, cam_mclk3, mdp_vsync, hdmi_cec, hdmi_ddc,
   hdmi_hpd, edp_hpd, gp_pdm0, gp_pdm1, gp_pdm2, gp_pdm3, gp0_clk, gp1_clk,
   gp_mn, tsif1, tsif2, hsic, grfc, audio_ref_clk, qua_mi2s, pri_mi2s, 
spkr_mi2s,
-  ter_mi2s, sec_mi2s, bt, fm, wlan, slimbus, gpio
+  ter_mi2s, sec_mi2s, bt, fm, wlan, slimbus, hsic_ctl, gpio
 
   (Note that this is not yet the complete list of functions)
 
diff --git a/drivers/pinctrl/qcom/pinctrl-msm8x74.c 
b/drivers/pinctrl/qcom/pinctrl-msm8x74.c
index 46fe6ad5f97e..9eb63d3403d4 100644
--- a/drivers/pinctrl/qcom/pinctrl-msm8x74.c
+++ b/drivers/pinctrl/qcom/pinctrl-msm8x74.c
@@ -172,6 +172,8 @@ static const struct pinctrl_pin_desc msm8x74_pins[] = {
PINCTRL_PIN(149, "SDC2_CLK"),
PINCTRL_PIN(150, "SDC2_CMD"),
PINCTRL_PIN(151, "SDC2_DATA"),
+   PINCTRL_PIN(152, "HSIC_STROBE"),
+   PINCTRL_PIN(153, "HSIC_DATA"),
 };
 
 #define DECLARE_MSM_GPIO_PINS(pin) static const unsigned int 
gpio##pin##_pins[] = { pin }
@@ -328,6 +330,8 @@ static const unsigned int sdc1_data_pins[] = { 148 };
 static const unsigned int sdc2_clk_pins[] = { 149 };
 static const unsigned int sdc2_cmd_pins[] = { 150 };
 static const unsigned int sdc2_data_pins[] = { 151 };
+static const unsigned int hsic_strobe_pins[] = { 152 };
+static const unsigned int hsic_data_pins[] = { 153 };
 
 #define FUNCTION(fname)\
[MSM_MUX_##fname] = {   \
@@ -399,6 +403,37 @@ static const unsigned int sdc2_data_pins[] = { 151 };
.intr_detection_width = -1, \
}
 
+#define HSIC_PINGROUP(pg_name, ctl)\
+   {   \
+   .name = #pg_name,   \
+   .pins = pg_name##_pins, \
+   .npins = ARRAY_SIZE(pg_name##_pins),\
+   .funcs = (int[]){   \
+   MSM_MUX_gpio,   \
+   MSM_MUX_hsic_ctl,   \
+   },  \
+   .nfuncs = 2,\
+   .ctl_reg = ctl, \
+   .io_reg = 0,\
+   .intr_cfg_reg = 0,  \
+   .intr_status_reg = 0,   \
+   .intr_target_reg = 0,   \
+   .mux_bit = 25,  \
+   .pull_bit = -1, \
+   .drv_bit = -1,  \
+   .oe_bit = -1,   \
+   .in_bit = -1,   \
+   .out_bit = -1,  \
+   .intr_enable_bit = -1,  \
+   .intr_status_bit = -1,  \
+   .intr_target_bit = -1,  \
+   .intr_target_kpss_val = -1, \
+   .intr_raw_status_bit = -1,  \
+   .intr_polarity_bit = -1,\
+   .intr_detection_bit = -1,   \
+   .intr_detection_width = -1, \
+   }
+
 /*
  * TODO: Add the rest of the possible functions and fill out
  * the pingroup table below.
@@ -509,6 +544,7 @@ enum msm8x74_functions {
MSM_MUX_fm,
MSM_MUX_wlan,
MSM_MUX_slimbus,
+   MSM_MUX_hsic_ctl,
MSM_MUX_NA,
 

[PATCH 0/2] Support HSIC "pins" on msm8974 tlmm

2016-06-25 Thread Stephen Boyd
This is part of a larger patch series that adds support for the
USB HSIC controller on msm8974 based SoCs. The first patch here
is a minor fix for a problem that isn't happening yet but could
happen in the future. The second patch adds an hsic pin so
we can configure the hsic bits that live in the TLMM register
space.

Stephen Boyd (2):
  pinctrl: qcom: Clear all function selection bits
  pinctrl: qcom: msm8974: Add hsic_ctl pinmux

 .../bindings/pinctrl/qcom,msm8974-pinctrl.txt  |  5 ++-
 drivers/pinctrl/qcom/pinctrl-msm.c |  6 ++-
 drivers/pinctrl/qcom/pinctrl-msm8x74.c | 43 +-
 3 files changed, 50 insertions(+), 4 deletions(-)

-- 
2.9.0.rc2.8.ga28705d



[PATCH 1/2] pinctrl: qcom: Clear all function selection bits

2016-06-25 Thread Stephen Boyd
The function selection bitfield is not always 3 bits wide.
Sometimes it is 4 bits wide. Let's use the npins struct member to
determine how many bits wide the function selection bitfield is
so we clear the correct amount of bits in the register while
remuxing the pins.

Cc: Bjorn Andersson 
Signed-off-by: Stephen Boyd 
---
 drivers/pinctrl/qcom/pinctrl-msm.c | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/pinctrl/qcom/pinctrl-msm.c 
b/drivers/pinctrl/qcom/pinctrl-msm.c
index 1a44e1d03390..51c42d746883 100644
--- a/drivers/pinctrl/qcom/pinctrl-msm.c
+++ b/drivers/pinctrl/qcom/pinctrl-msm.c
@@ -29,6 +29,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include "../core.h"
 #include "../pinconf.h"
@@ -138,10 +139,11 @@ static int msm_pinmux_set_mux(struct pinctrl_dev *pctldev,
struct msm_pinctrl *pctrl = pinctrl_dev_get_drvdata(pctldev);
const struct msm_pingroup *g;
unsigned long flags;
-   u32 val;
+   u32 val, mask;
int i;
 
g = >soc->groups[group];
+   mask = GENMASK(g->mux_bit + order_base_2(g->nfuncs) - 1, g->mux_bit);
 
for (i = 0; i < g->nfuncs; i++) {
if (g->funcs[i] == function)
@@ -154,7 +156,7 @@ static int msm_pinmux_set_mux(struct pinctrl_dev *pctldev,
spin_lock_irqsave(>lock, flags);
 
val = readl(pctrl->regs + g->ctl_reg);
-   val &= ~(0x7 << g->mux_bit);
+   val &= mask;
val |= i << g->mux_bit;
writel(val, pctrl->regs + g->ctl_reg);
 
-- 
2.9.0.rc2.8.ga28705d



Re: [PATCH] locking/osq: Drop the overload of osq lock

2016-06-25 Thread panxinhui

> 在 2016年6月26日,03:20,Peter Zijlstra  写道:
> 
> On Sun, Jun 26, 2016 at 01:27:56AM +0800, panxinhui wrote:
 Would that not have issues where the owner cpu is kept running but the
 spinner (ie. _this_ vcpu) gets preempted? I would think that in that
 case we too want to stop spinning.
 
>>> 
>> do  you mean that the spinner detect itself had yield out during the
>> big spin loop?
>> 
>> It is very possible to happen.  BUT if spinner(on this vcpu) yield
>> out, the next spinner would break the spin loop.  AND if spinner
>> detect itself yield out once, it’s very possible to get the osq lock
>> soon as long as the ower vcpu is running.
>> 
>> SO I think we need just check the owner vcpu’s yield_count.
> 
> I had a quick look at KVM and it looks like it only has
> kvm_cpu::preempted, which would suggest the interface boqun proposed.
> 
> We'll have to look at many of the other virt platforms as well to see
> what they can do.
> 
> We could also provide _both_ interfaces and a platform can implement
> whichever variant (or both) it can.
> 
the kvm code on ppc has implemented  yield_count.
It let me feel a little relaxed. :)

looks like we could  introduce the interface like below.

bool vcpu_is_preempted(int cpu)
{
return arch_vcpu_is_preempted(cpu);
}

#ifdef arch_vcpu_has_yield_count 
bool vcpu_has_preemtped_once(int cpu, unsigned int yield_count)
 {
return arch_get_vcpu_yield_count() != yield_count;
}

#else
bool vcpu_has_preemtped_once(int cpu, unsigned int yield_count)
{
/*just let called know it is preepmpted*/
return vcpu_is_preempted(cpu);
}
#endif




[PATCH 2/2] pinctrl: qcom: msm8974: Add hsic_ctl pinmux

2016-06-25 Thread Stephen Boyd
The msm8974 pinctrl variant has a couple USB HSIC "glue"
registers that let us mux between the pinctrl register settings
or the HSIC core settings for the HSIC pins (gpio 144 and gpio
145). Support this method of operation by adding hsic_data and
hsic_strobe pins that can select between hsic_ctl and gpio
functions. This allows us to toggle the hsic pin configuration
over to the HSIC core at runtime.

Cc: Bjorn Andersson 
Signed-off-by: Stephen Boyd 
---
 .../bindings/pinctrl/qcom,msm8974-pinctrl.txt  |  5 ++-
 drivers/pinctrl/qcom/pinctrl-msm8x74.c | 43 +-
 2 files changed, 46 insertions(+), 2 deletions(-)

diff --git a/Documentation/devicetree/bindings/pinctrl/qcom,msm8974-pinctrl.txt 
b/Documentation/devicetree/bindings/pinctrl/qcom,msm8974-pinctrl.txt
index e4d6a9d20f7d..453bd7c76d6b 100644
--- a/Documentation/devicetree/bindings/pinctrl/qcom,msm8974-pinctrl.txt
+++ b/Documentation/devicetree/bindings/pinctrl/qcom,msm8974-pinctrl.txt
@@ -49,6 +49,9 @@ Valid values for pins are:
   sdc1_clk, sdc1_cmd, sdc1_data, sdc2_clk, sdc2_cmd, sdc2_data
 Supports bias and drive-strength
 
+  hsic_data, hsic_strobe
+Supports only mux
+
 Valid values for function are:
   cci_i2c0, cci_i2c1, uim1, uim2, uim_batt_alarm,
   blsp_uim1, blsp_uart1, blsp_i2c1, blsp_spi1,
@@ -70,7 +73,7 @@ Valid values for function are:
   cam_mckl0, cam_mclk1, cam_mclk2, cam_mclk3, mdp_vsync, hdmi_cec, hdmi_ddc,
   hdmi_hpd, edp_hpd, gp_pdm0, gp_pdm1, gp_pdm2, gp_pdm3, gp0_clk, gp1_clk,
   gp_mn, tsif1, tsif2, hsic, grfc, audio_ref_clk, qua_mi2s, pri_mi2s, 
spkr_mi2s,
-  ter_mi2s, sec_mi2s, bt, fm, wlan, slimbus, gpio
+  ter_mi2s, sec_mi2s, bt, fm, wlan, slimbus, hsic_ctl, gpio
 
   (Note that this is not yet the complete list of functions)
 
diff --git a/drivers/pinctrl/qcom/pinctrl-msm8x74.c 
b/drivers/pinctrl/qcom/pinctrl-msm8x74.c
index 46fe6ad5f97e..9eb63d3403d4 100644
--- a/drivers/pinctrl/qcom/pinctrl-msm8x74.c
+++ b/drivers/pinctrl/qcom/pinctrl-msm8x74.c
@@ -172,6 +172,8 @@ static const struct pinctrl_pin_desc msm8x74_pins[] = {
PINCTRL_PIN(149, "SDC2_CLK"),
PINCTRL_PIN(150, "SDC2_CMD"),
PINCTRL_PIN(151, "SDC2_DATA"),
+   PINCTRL_PIN(152, "HSIC_STROBE"),
+   PINCTRL_PIN(153, "HSIC_DATA"),
 };
 
 #define DECLARE_MSM_GPIO_PINS(pin) static const unsigned int 
gpio##pin##_pins[] = { pin }
@@ -328,6 +330,8 @@ static const unsigned int sdc1_data_pins[] = { 148 };
 static const unsigned int sdc2_clk_pins[] = { 149 };
 static const unsigned int sdc2_cmd_pins[] = { 150 };
 static const unsigned int sdc2_data_pins[] = { 151 };
+static const unsigned int hsic_strobe_pins[] = { 152 };
+static const unsigned int hsic_data_pins[] = { 153 };
 
 #define FUNCTION(fname)\
[MSM_MUX_##fname] = {   \
@@ -399,6 +403,37 @@ static const unsigned int sdc2_data_pins[] = { 151 };
.intr_detection_width = -1, \
}
 
+#define HSIC_PINGROUP(pg_name, ctl)\
+   {   \
+   .name = #pg_name,   \
+   .pins = pg_name##_pins, \
+   .npins = ARRAY_SIZE(pg_name##_pins),\
+   .funcs = (int[]){   \
+   MSM_MUX_gpio,   \
+   MSM_MUX_hsic_ctl,   \
+   },  \
+   .nfuncs = 2,\
+   .ctl_reg = ctl, \
+   .io_reg = 0,\
+   .intr_cfg_reg = 0,  \
+   .intr_status_reg = 0,   \
+   .intr_target_reg = 0,   \
+   .mux_bit = 25,  \
+   .pull_bit = -1, \
+   .drv_bit = -1,  \
+   .oe_bit = -1,   \
+   .in_bit = -1,   \
+   .out_bit = -1,  \
+   .intr_enable_bit = -1,  \
+   .intr_status_bit = -1,  \
+   .intr_target_bit = -1,  \
+   .intr_target_kpss_val = -1, \
+   .intr_raw_status_bit = -1,  \
+   .intr_polarity_bit = -1,\
+   .intr_detection_bit = -1,   \
+   .intr_detection_width = -1, \
+   }
+
 /*
  * TODO: Add the rest of the possible functions and fill out
  * the pingroup table below.
@@ -509,6 +544,7 @@ enum msm8x74_functions {
MSM_MUX_fm,
MSM_MUX_wlan,
MSM_MUX_slimbus,
+   MSM_MUX_hsic_ctl,
MSM_MUX_NA,
 };
 
@@ -534,7 +570,8 @@ static const char * const 

[PATCH 0/2] Support HSIC "pins" on msm8974 tlmm

2016-06-25 Thread Stephen Boyd
This is part of a larger patch series that adds support for the
USB HSIC controller on msm8974 based SoCs. The first patch here
is a minor fix for a problem that isn't happening yet but could
happen in the future. The second patch adds an hsic pin so
we can configure the hsic bits that live in the TLMM register
space.

Stephen Boyd (2):
  pinctrl: qcom: Clear all function selection bits
  pinctrl: qcom: msm8974: Add hsic_ctl pinmux

 .../bindings/pinctrl/qcom,msm8974-pinctrl.txt  |  5 ++-
 drivers/pinctrl/qcom/pinctrl-msm.c |  6 ++-
 drivers/pinctrl/qcom/pinctrl-msm8x74.c | 43 +-
 3 files changed, 50 insertions(+), 4 deletions(-)

-- 
2.9.0.rc2.8.ga28705d



[PATCH 1/2] pinctrl: qcom: Clear all function selection bits

2016-06-25 Thread Stephen Boyd
The function selection bitfield is not always 3 bits wide.
Sometimes it is 4 bits wide. Let's use the npins struct member to
determine how many bits wide the function selection bitfield is
so we clear the correct amount of bits in the register while
remuxing the pins.

Cc: Bjorn Andersson 
Signed-off-by: Stephen Boyd 
---
 drivers/pinctrl/qcom/pinctrl-msm.c | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/pinctrl/qcom/pinctrl-msm.c 
b/drivers/pinctrl/qcom/pinctrl-msm.c
index 1a44e1d03390..51c42d746883 100644
--- a/drivers/pinctrl/qcom/pinctrl-msm.c
+++ b/drivers/pinctrl/qcom/pinctrl-msm.c
@@ -29,6 +29,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include "../core.h"
 #include "../pinconf.h"
@@ -138,10 +139,11 @@ static int msm_pinmux_set_mux(struct pinctrl_dev *pctldev,
struct msm_pinctrl *pctrl = pinctrl_dev_get_drvdata(pctldev);
const struct msm_pingroup *g;
unsigned long flags;
-   u32 val;
+   u32 val, mask;
int i;
 
g = >soc->groups[group];
+   mask = GENMASK(g->mux_bit + order_base_2(g->nfuncs) - 1, g->mux_bit);
 
for (i = 0; i < g->nfuncs; i++) {
if (g->funcs[i] == function)
@@ -154,7 +156,7 @@ static int msm_pinmux_set_mux(struct pinctrl_dev *pctldev,
spin_lock_irqsave(>lock, flags);
 
val = readl(pctrl->regs + g->ctl_reg);
-   val &= ~(0x7 << g->mux_bit);
+   val &= mask;
val |= i << g->mux_bit;
writel(val, pctrl->regs + g->ctl_reg);
 
-- 
2.9.0.rc2.8.ga28705d



Re: [PATCH] locking/osq: Drop the overload of osq lock

2016-06-25 Thread panxinhui

> 在 2016年6月26日,03:12,Peter Zijlstra  写道:
> 
> On Sun, Jun 26, 2016 at 01:27:51AM +0800, panxinhui wrote:
> 
>> by the way I still think mutex_unlock has a big overload too. 
> 
> Do you mean overhead?
> 
oh, maybe you are right. 
mutex_unlock ’s implementation uses inc_return variant on  ppc, and that’s 
expensive. I am thinking of using  cmpxchg instead. 


Re: [PATCH] locking/osq: Drop the overload of osq lock

2016-06-25 Thread panxinhui

> 在 2016年6月26日,03:12,Peter Zijlstra  写道:
> 
> On Sun, Jun 26, 2016 at 01:27:51AM +0800, panxinhui wrote:
> 
>> by the way I still think mutex_unlock has a big overload too. 
> 
> Do you mean overhead?
> 
oh, maybe you are right. 
mutex_unlock ’s implementation uses inc_return variant on  ppc, and that’s 
expensive. I am thinking of using  cmpxchg instead. 


vgacon.c:undefined reference to `screen_info'

2016-06-25 Thread kbuild test robot
Hi,

It's probably a bug fix that unveils the link errors.

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 
master
head:   da2f6aba4a21f8da3331e5251a117c52764da579
commit: f69405ce6c0fc9f4a039011007371b31f80b470d openrisc: include: asm: 
Kbuild: add default "vga.h"
date:   2 years, 8 months ago
config: openrisc-alldefconfig (attached as .config)
compiler: or32-linux-gcc (GCC) 4.5.1-or32-1.0rc1
reproduce:
wget 
https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross
 -O ~/bin/make.cross
chmod +x ~/bin/make.cross
git checkout f69405ce6c0fc9f4a039011007371b31f80b470d
# save the attached .config to linux build tree
make.cross ARCH=openrisc 

All errors (new ones prefixed by >>):

   drivers/built-in.o: In function `vgacon_save_screen':
>> vgacon.c:(.text+0x20e0): undefined reference to `screen_info'
   vgacon.c:(.text+0x20e8): undefined reference to `screen_info'
   drivers/built-in.o: In function `vgacon_init':
   vgacon.c:(.text+0x284c): undefined reference to `screen_info'
   vgacon.c:(.text+0x2850): undefined reference to `screen_info'
   drivers/built-in.o: In function `vgacon_startup':
   vgacon.c:(.text+0x28d8): undefined reference to `screen_info'
   drivers/built-in.o:vgacon.c:(.text+0x28f0): more undefined references to 
`screen_info' follow

---
0-DAY kernel test infrastructureOpen Source Technology Center
https://lists.01.org/pipermail/kbuild-all   Intel Corporation


.config.gz
Description: Binary data


vgacon.c:undefined reference to `screen_info'

2016-06-25 Thread kbuild test robot
Hi,

It's probably a bug fix that unveils the link errors.

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 
master
head:   da2f6aba4a21f8da3331e5251a117c52764da579
commit: f69405ce6c0fc9f4a039011007371b31f80b470d openrisc: include: asm: 
Kbuild: add default "vga.h"
date:   2 years, 8 months ago
config: openrisc-alldefconfig (attached as .config)
compiler: or32-linux-gcc (GCC) 4.5.1-or32-1.0rc1
reproduce:
wget 
https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross
 -O ~/bin/make.cross
chmod +x ~/bin/make.cross
git checkout f69405ce6c0fc9f4a039011007371b31f80b470d
# save the attached .config to linux build tree
make.cross ARCH=openrisc 

All errors (new ones prefixed by >>):

   drivers/built-in.o: In function `vgacon_save_screen':
>> vgacon.c:(.text+0x20e0): undefined reference to `screen_info'
   vgacon.c:(.text+0x20e8): undefined reference to `screen_info'
   drivers/built-in.o: In function `vgacon_init':
   vgacon.c:(.text+0x284c): undefined reference to `screen_info'
   vgacon.c:(.text+0x2850): undefined reference to `screen_info'
   drivers/built-in.o: In function `vgacon_startup':
   vgacon.c:(.text+0x28d8): undefined reference to `screen_info'
   drivers/built-in.o:vgacon.c:(.text+0x28f0): more undefined references to 
`screen_info' follow

---
0-DAY kernel test infrastructureOpen Source Technology Center
https://lists.01.org/pipermail/kbuild-all   Intel Corporation


.config.gz
Description: Binary data


[sched] a550c94136: BUG: unable to handle kernel NULL pointer dereference at (null)

2016-06-25 Thread kernel test robot


FYI, we noticed the following commit:

https://git.kernel.org/pub/scm/linux/kernel/git/luto/linux.git x86/vmap_stack
commit a550c94136a5253a727e3af39f306b8c55b1721e ("sched: Free the stack early 
if CONFIG_THREAD_INFO_IN_TASK")


on test machine: vm-lkp-wsx03-quantal-x86_64: 2 threads qemu-system-x86_64 
-enable-kvm -cpu Haswell,+smep,+smap with 360M memory

caused below changes:


+--+++
|  | 87194cac13 | a550c94136 |
+--+++
| boot_successes   | 47 | 0  |
| boot_failures| 0  | 45 |
| BUG:unable_to_handle_kernel  | 0  | 39 |
| Oops | 0  | 16 |
| RIP:__schedule   | 0  | 10 |
| RIP:number   | 0  | 5  |
| backtrace:do_wait| 0  | 9  |
| backtrace:SyS_wait4  | 0  | 9  |
| PANIC:double_fault   | 0  | 28 |
| RIP:symbol_string| 0  | 11 |
| Kernel_panic-not_syncing:Machine_halted  | 0  | 28 |
| WARNING:at_mm/vmalloc.c:#__vunmap| 0  | 2  |
| RIP:io_serial_out| 0  | 8  |
| Kernel_panic-not_syncing:Fatal_exception | 0  | 13 |
| RIP:queued_spin_lock_slowpath| 0  | 1  |
| RIP:io_serial_in | 0  | 4  |
| RIP:vmalloc_fault| 0  | 2  |
| backtrace:smpboot_thread_fn  | 0  | 2  |
| RIP:__lock_acquire   | 0  | 3  |
| backtrace:async_run_entry_fn | 0  | 3  |
| BUG:kernel_test_hang | 0  | 1  |
| backtrace:compat_SyS_wait4   | 0  | 2  |
| RIP:cont_add | 0  | 1  |
| backtrace:core_sys_select| 0  | 1  |
| backtrace:SyS_select | 0  | 1  |
| backtrace:vfs_read   | 0  | 1  |
| backtrace:SyS_read   | 0  | 1  |
| RIP:no_context   | 0  | 1  |
| invoked_oom-killer:gfp_mask=0x   | 0  | 1  |
| Mem-Info | 0  | 1  |
| Out_of_memory:Kill_process   | 0  | 1  |
| BUG:Bad_page_map_in_process  | 0  | 1  |
| backtrace:oom_reaper | 0  | 1  |
+--+++



[   14.266586] Freeing unused kernel memory: 384K (8800023a - 
88000240)
[   14.329680] random: init urandom read with 6 bits of entropy available
[   14.417506] hwclock
[   14.420263] BUG: unable to handle kernel NULL pointer dereference at 
  (null)
[   14.420267] IP: [<  (null)>]   (null)
[   14.420292] PGD 0 
[   14.420321] BUG: unable to handle kernel NULL pointer dereference at 
  (null)
[   14.420357] IP: [] no_context+0x2c5/0x382
[   14.420359] PGD 0 
[   14.420387] BUG: unable to handle kernel NULL pointer dereference at 
  (null)
[   14.420394] IP: [] no_context+0x2c5/0x382
[   14.420397] PGD 0 
[   14.420424] BUG: unable to handle kernel NULL pointer dereference at 
  (null)
[   14.420451] IP: [] no_context+0x2c5/0x382
[   14.420454] PGD 0 
[   14.420460] BUG: unable to handle kernel NULL p
[   14.420487] IP: [] no_context+0x2c5/0x382
[   14.420490] PGD 0 
[   14.420517] BUG: unable to handle kernel NULL pointer dereference at 
  (null)
[   14.420524] IP: [] no_context+0x2c5/0x382
[   14.420526] PGD 0 
[   14.420552] BUG: unable to handle kernel NULL pointer dereference at 
  (null)
[   14.420559] IP: [] no_context+0x2c5/0x382
[   14.420582] PGD 0 
[   14.420588] BUG: unable to handle kernel NULL pointer dereference at 
  (null)
[   14.420615] IP: [] no_context+0x2c5/0x382
[   14.420618] PGD 0 
[   14.420645] BUG: unable to handle kernel NULL pointer dereference at 
  (null)
[   14.420651] IP: [] no_context+0x2c5/0x382
[   14.420654] PGD 0 
[   14.420681] BUG: unable to handle kernel NULL pointer dereference at 
  (null)
[   14.420687] IP: [] no_context+0x2c5/0x382
[   14.420710] PGD 0 
[   14.420716] BUG: unable to handle kernel NULL pointer dereference at 
  (null)
[   14.420744] IP: [] no_context+0x2c5/0x382
[   14.420746] PGD 0 
[   14.420752] BUG: unable to handle kernel NULL pointer dereference at 
  (null)
[   

[sched] a550c94136: BUG: unable to handle kernel NULL pointer dereference at (null)

2016-06-25 Thread kernel test robot


FYI, we noticed the following commit:

https://git.kernel.org/pub/scm/linux/kernel/git/luto/linux.git x86/vmap_stack
commit a550c94136a5253a727e3af39f306b8c55b1721e ("sched: Free the stack early 
if CONFIG_THREAD_INFO_IN_TASK")


on test machine: vm-lkp-wsx03-quantal-x86_64: 2 threads qemu-system-x86_64 
-enable-kvm -cpu Haswell,+smep,+smap with 360M memory

caused below changes:


+--+++
|  | 87194cac13 | a550c94136 |
+--+++
| boot_successes   | 47 | 0  |
| boot_failures| 0  | 45 |
| BUG:unable_to_handle_kernel  | 0  | 39 |
| Oops | 0  | 16 |
| RIP:__schedule   | 0  | 10 |
| RIP:number   | 0  | 5  |
| backtrace:do_wait| 0  | 9  |
| backtrace:SyS_wait4  | 0  | 9  |
| PANIC:double_fault   | 0  | 28 |
| RIP:symbol_string| 0  | 11 |
| Kernel_panic-not_syncing:Machine_halted  | 0  | 28 |
| WARNING:at_mm/vmalloc.c:#__vunmap| 0  | 2  |
| RIP:io_serial_out| 0  | 8  |
| Kernel_panic-not_syncing:Fatal_exception | 0  | 13 |
| RIP:queued_spin_lock_slowpath| 0  | 1  |
| RIP:io_serial_in | 0  | 4  |
| RIP:vmalloc_fault| 0  | 2  |
| backtrace:smpboot_thread_fn  | 0  | 2  |
| RIP:__lock_acquire   | 0  | 3  |
| backtrace:async_run_entry_fn | 0  | 3  |
| BUG:kernel_test_hang | 0  | 1  |
| backtrace:compat_SyS_wait4   | 0  | 2  |
| RIP:cont_add | 0  | 1  |
| backtrace:core_sys_select| 0  | 1  |
| backtrace:SyS_select | 0  | 1  |
| backtrace:vfs_read   | 0  | 1  |
| backtrace:SyS_read   | 0  | 1  |
| RIP:no_context   | 0  | 1  |
| invoked_oom-killer:gfp_mask=0x   | 0  | 1  |
| Mem-Info | 0  | 1  |
| Out_of_memory:Kill_process   | 0  | 1  |
| BUG:Bad_page_map_in_process  | 0  | 1  |
| backtrace:oom_reaper | 0  | 1  |
+--+++



[   14.266586] Freeing unused kernel memory: 384K (8800023a - 
88000240)
[   14.329680] random: init urandom read with 6 bits of entropy available
[   14.417506] hwclock
[   14.420263] BUG: unable to handle kernel NULL pointer dereference at 
  (null)
[   14.420267] IP: [<  (null)>]   (null)
[   14.420292] PGD 0 
[   14.420321] BUG: unable to handle kernel NULL pointer dereference at 
  (null)
[   14.420357] IP: [] no_context+0x2c5/0x382
[   14.420359] PGD 0 
[   14.420387] BUG: unable to handle kernel NULL pointer dereference at 
  (null)
[   14.420394] IP: [] no_context+0x2c5/0x382
[   14.420397] PGD 0 
[   14.420424] BUG: unable to handle kernel NULL pointer dereference at 
  (null)
[   14.420451] IP: [] no_context+0x2c5/0x382
[   14.420454] PGD 0 
[   14.420460] BUG: unable to handle kernel NULL p
[   14.420487] IP: [] no_context+0x2c5/0x382
[   14.420490] PGD 0 
[   14.420517] BUG: unable to handle kernel NULL pointer dereference at 
  (null)
[   14.420524] IP: [] no_context+0x2c5/0x382
[   14.420526] PGD 0 
[   14.420552] BUG: unable to handle kernel NULL pointer dereference at 
  (null)
[   14.420559] IP: [] no_context+0x2c5/0x382
[   14.420582] PGD 0 
[   14.420588] BUG: unable to handle kernel NULL pointer dereference at 
  (null)
[   14.420615] IP: [] no_context+0x2c5/0x382
[   14.420618] PGD 0 
[   14.420645] BUG: unable to handle kernel NULL pointer dereference at 
  (null)
[   14.420651] IP: [] no_context+0x2c5/0x382
[   14.420654] PGD 0 
[   14.420681] BUG: unable to handle kernel NULL pointer dereference at 
  (null)
[   14.420687] IP: [] no_context+0x2c5/0x382
[   14.420710] PGD 0 
[   14.420716] BUG: unable to handle kernel NULL pointer dereference at 
  (null)
[   14.420744] IP: [] no_context+0x2c5/0x382
[   14.420746] PGD 0 
[   14.420752] BUG: unable to handle kernel NULL pointer dereference at 
  (null)
[   

[PATCH] geneve: fix max_mtu setting

2016-06-25 Thread Haishuang Yan
For ipv6+udp+geneve encapsulation data, the max_mtu should subtract
sizeof(ipv6hdr), instead of sizeof(iphdr).

Signed-off-by: Haishuang Yan 
---
 drivers/net/geneve.c | 9 +++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/drivers/net/geneve.c b/drivers/net/geneve.c
index aa61708..c676d23 100644
--- a/drivers/net/geneve.c
+++ b/drivers/net/geneve.c
@@ -1036,12 +1036,17 @@ static netdev_tx_t geneve_xmit(struct sk_buff *skb, 
struct net_device *dev)
 
 static int __geneve_change_mtu(struct net_device *dev, int new_mtu, bool 
strict)
 {
+   struct geneve_dev *geneve = netdev_priv(dev);
/* The max_mtu calculation does not take account of GENEVE
 * options, to avoid excluding potentially valid
 * configurations.
 */
-   int max_mtu = IP_MAX_MTU - GENEVE_BASE_HLEN - sizeof(struct iphdr)
-   - dev->hard_header_len;
+   int max_mtu = IP_MAX_MTU - GENEVE_BASE_HLEN - dev->hard_header_len;
+
+   if (geneve->remote.sa.sa_family == AF_INET)
+   max_mtu -= sizeof(struct iphdr);
+   else
+   max_mtu -= sizeof(struct ipv6hdr);
 
if (new_mtu < 68)
return -EINVAL;
-- 
1.8.3.1





[PATCH] geneve: fix max_mtu setting

2016-06-25 Thread Haishuang Yan
For ipv6+udp+geneve encapsulation data, the max_mtu should subtract
sizeof(ipv6hdr), instead of sizeof(iphdr).

Signed-off-by: Haishuang Yan 
---
 drivers/net/geneve.c | 9 +++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/drivers/net/geneve.c b/drivers/net/geneve.c
index aa61708..c676d23 100644
--- a/drivers/net/geneve.c
+++ b/drivers/net/geneve.c
@@ -1036,12 +1036,17 @@ static netdev_tx_t geneve_xmit(struct sk_buff *skb, 
struct net_device *dev)
 
 static int __geneve_change_mtu(struct net_device *dev, int new_mtu, bool 
strict)
 {
+   struct geneve_dev *geneve = netdev_priv(dev);
/* The max_mtu calculation does not take account of GENEVE
 * options, to avoid excluding potentially valid
 * configurations.
 */
-   int max_mtu = IP_MAX_MTU - GENEVE_BASE_HLEN - sizeof(struct iphdr)
-   - dev->hard_header_len;
+   int max_mtu = IP_MAX_MTU - GENEVE_BASE_HLEN - dev->hard_header_len;
+
+   if (geneve->remote.sa.sa_family == AF_INET)
+   max_mtu -= sizeof(struct iphdr);
+   else
+   max_mtu -= sizeof(struct ipv6hdr);
 
if (new_mtu < 68)
return -EINVAL;
-- 
1.8.3.1





RE: [PATCH 1/4][RFC v2] PM / sleep: Avoid accessing frozen_cpus if it is NULL

2016-06-25 Thread Chen, Yu C

> -Original Message-
> From: Chen, Yu C
> Sent: Sunday, June 26, 2016 9:17 AM
> To: 'Pavel Machek'
> Cc: linux...@vger.kernel.org; x...@kernel.org; Rafael J. Wysocki; Len Brown;
> Peter Zijlstra; H. Peter Anvin; Borislav Petkov; Brian Gerst; Thomas Gleixner;
> Ingo Molnar; Varun Koyyalagunta; linux-kernel@vger.kernel.org
> Subject: RE: [PATCH 1/4][RFC v2] PM / sleep: Avoid accessing frozen_cpus if it
> is NULL
> 
> Hi,
> 
> > -Original Message-
> > From: Pavel Machek [mailto:pa...@ucw.cz]
> > Sent: Sunday, June 26, 2016 12:51 AM
> > To: Chen, Yu C
> > Cc: linux...@vger.kernel.org; x...@kernel.org; Rafael J. Wysocki; Len
> > Brown; Peter Zijlstra; H. Peter Anvin; Borislav Petkov; Brian Gerst;
> > Thomas Gleixner; Ingo Molnar; Varun Koyyalagunta;
> > linux-kernel@vger.kernel.org
> > Subject: Re: [PATCH 1/4][RFC v2] PM / sleep: Avoid accessing
> > frozen_cpus if it is NULL
> >
[cut]
> >
> > I'd say that whoever allocates frozen_cpus should just abort the
> > hibernation if there's not enough memory for the operation...? This
> > seems like checking for the problem too late.
> >
> The allocation of frozen_cpus is alloc_frozen_cpus, which is in 
> core_initcall, and
> do_initcall during boot up  seems not to care about the return value from 
> these
> functions.  So I think either we add the check in disable_nonboot_cpus, or we
> can set noresume = 1 and nohibernate = 1 if alloc_frozen_cpus fails.
> 
Besides, disable_nonboot_cpus is not only used for hibernation, but also for
suspend to ram, kexec, etc, so it might be better to check before we use
it, thus to avoid introducing new flags IMO.

thanks,
Yu


RE: [PATCH 1/4][RFC v2] PM / sleep: Avoid accessing frozen_cpus if it is NULL

2016-06-25 Thread Chen, Yu C

> -Original Message-
> From: Chen, Yu C
> Sent: Sunday, June 26, 2016 9:17 AM
> To: 'Pavel Machek'
> Cc: linux...@vger.kernel.org; x...@kernel.org; Rafael J. Wysocki; Len Brown;
> Peter Zijlstra; H. Peter Anvin; Borislav Petkov; Brian Gerst; Thomas Gleixner;
> Ingo Molnar; Varun Koyyalagunta; linux-kernel@vger.kernel.org
> Subject: RE: [PATCH 1/4][RFC v2] PM / sleep: Avoid accessing frozen_cpus if it
> is NULL
> 
> Hi,
> 
> > -Original Message-
> > From: Pavel Machek [mailto:pa...@ucw.cz]
> > Sent: Sunday, June 26, 2016 12:51 AM
> > To: Chen, Yu C
> > Cc: linux...@vger.kernel.org; x...@kernel.org; Rafael J. Wysocki; Len
> > Brown; Peter Zijlstra; H. Peter Anvin; Borislav Petkov; Brian Gerst;
> > Thomas Gleixner; Ingo Molnar; Varun Koyyalagunta;
> > linux-kernel@vger.kernel.org
> > Subject: Re: [PATCH 1/4][RFC v2] PM / sleep: Avoid accessing
> > frozen_cpus if it is NULL
> >
[cut]
> >
> > I'd say that whoever allocates frozen_cpus should just abort the
> > hibernation if there's not enough memory for the operation...? This
> > seems like checking for the problem too late.
> >
> The allocation of frozen_cpus is alloc_frozen_cpus, which is in 
> core_initcall, and
> do_initcall during boot up  seems not to care about the return value from 
> these
> functions.  So I think either we add the check in disable_nonboot_cpus, or we
> can set noresume = 1 and nohibernate = 1 if alloc_frozen_cpus fails.
> 
Besides, disable_nonboot_cpus is not only used for hibernation, but also for
suspend to ram, kexec, etc, so it might be better to check before we use
it, thus to avoid introducing new flags IMO.

thanks,
Yu


Re: [PATCH V2 13/63] clocksource/drivers/bcm2835_timer: Convert init function to return error

2016-06-25 Thread Eric Anholt
Daniel Lezcano  writes:

> The init functions do not return any error. They behave as the following:
>
>  - panic, thus leading to a kernel crash while another timer may work and
>make the system boot up correctly
>
>  or
>
>  - print an error and let the caller unaware if the state of the system
>
> Change that by converting the init functions to return an error conforming
> to the CLOCKSOURCE_OF_RET prototype.
>
> Proper error handling (rollback, errno value) will be changed later case
> by case, thus this change just return back an error or success in the init
> function.
>
> Signed-off-by: Daniel Lezcano 

For the bcm2835 changes here and in 63/63:

Acked-by: Eric Anholt 


signature.asc
Description: PGP signature


Re: [PATCH V2 13/63] clocksource/drivers/bcm2835_timer: Convert init function to return error

2016-06-25 Thread Eric Anholt
Daniel Lezcano  writes:

> The init functions do not return any error. They behave as the following:
>
>  - panic, thus leading to a kernel crash while another timer may work and
>make the system boot up correctly
>
>  or
>
>  - print an error and let the caller unaware if the state of the system
>
> Change that by converting the init functions to return an error conforming
> to the CLOCKSOURCE_OF_RET prototype.
>
> Proper error handling (rollback, errno value) will be changed later case
> by case, thus this change just return back an error or success in the init
> function.
>
> Signed-off-by: Daniel Lezcano 

For the bcm2835 changes here and in 63/63:

Acked-by: Eric Anholt 


signature.asc
Description: PGP signature


Re: powerpc/fadump: trivial fix of spelling mistake, clean up message

2016-06-25 Thread Michael Ellerman
On Fri, 2016-24-06 at 17:43:00 UTC, Colin King wrote:
> From: Colin Ian King 
> 
> trivial fix to spelling mistake "rgistration" and minor clean up
> of the printk error message

Can you also:
 - use pr_err()
 - unsplit the message, ie. keep the string all on one line.

cheers


Re: powerpc/fadump: trivial fix of spelling mistake, clean up message

2016-06-25 Thread Michael Ellerman
On Fri, 2016-24-06 at 17:43:00 UTC, Colin King wrote:
> From: Colin Ian King 
> 
> trivial fix to spelling mistake "rgistration" and minor clean up
> of the printk error message

Can you also:
 - use pr_err()
 - unsplit the message, ie. keep the string all on one line.

cheers


Re: [PATCH 3/3] drivers core: allow id match override when manually binding driver

2016-06-25 Thread Dan Williams
On Thu, Jun 23, 2016 at 10:41 AM, Michal Suchanek  wrote:
> This allows binding spidev on any slave device by hand using sysfs
> without adding superfluous compatibles or any other needless
> complication.
>
> Note that any slave driver that requires configuration will fail to
> probe anyway. Only a driver that binds to anything can be bound
> successfully.
>
> Signed-off-by: Michal Suchanek 
> ---
>  drivers/base/Kconfig.debug | 14 +
>  drivers/base/bus.c | 72 
> +-
>  lib/Kconfig.debug  |  2 ++
>  3 files changed, 87 insertions(+), 1 deletion(-)
>  create mode 100644 drivers/base/Kconfig.debug
>

Why change the driver core?  The matching policy can be changed with
the "match" operation of a custom "struct bus_type".


Re: [PATCH 3/3] drivers core: allow id match override when manually binding driver

2016-06-25 Thread Dan Williams
On Thu, Jun 23, 2016 at 10:41 AM, Michal Suchanek  wrote:
> This allows binding spidev on any slave device by hand using sysfs
> without adding superfluous compatibles or any other needless
> complication.
>
> Note that any slave driver that requires configuration will fail to
> probe anyway. Only a driver that binds to anything can be bound
> successfully.
>
> Signed-off-by: Michal Suchanek 
> ---
>  drivers/base/Kconfig.debug | 14 +
>  drivers/base/bus.c | 72 
> +-
>  lib/Kconfig.debug  |  2 ++
>  3 files changed, 87 insertions(+), 1 deletion(-)
>  create mode 100644 drivers/base/Kconfig.debug
>

Why change the driver core?  The matching policy can be changed with
the "match" operation of a custom "struct bus_type".


arch/ia64/kernel/entry.S:621: Error: Operand 2 of `adds' should be a 14-bit integer (-8192-8191)

2016-06-25 Thread kbuild test robot
Hi,

FYI, the error/warning still remains.

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 
master
head:   da2f6aba4a21f8da3331e5251a117c52764da579
commit: da48d094ce5d7c7dcdad9011648a81c42fd1c2ef Kconfig: remove 
HAVE_LATENCYTOP_SUPPORT
date:   5 months ago
config: ia64-allmodconfig (attached as .config)
compiler: ia64-linux-gcc (GCC) 4.9.0
reproduce:
wget 
https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross
 -O ~/bin/make.cross
chmod +x ~/bin/make.cross
git checkout da48d094ce5d7c7dcdad9011648a81c42fd1c2ef
# save the attached .config to linux build tree
make.cross ARCH=ia64 

All errors (new ones prefixed by >>):

   arch/ia64/kernel/entry.S: Assembler messages:
>> arch/ia64/kernel/entry.S:621: Error: Operand 2 of `adds' should be a 14-bit 
>> integer (-8192-8191)
   arch/ia64/kernel/entry.S:728: Error: Operand 2 of `adds' should be a 14-bit 
integer (-8192-8191)
   arch/ia64/kernel/entry.S:859: Error: Operand 2 of `adds' should be a 14-bit 
integer (-8192-8191)
--
   arch/ia64/kernel/fsys.S: Assembler messages:
>> arch/ia64/kernel/fsys.S:67: Error: Operand 3 of `add' should be a general 
>> register r0-r3
   arch/ia64/kernel/fsys.S:97: Error: Operand 3 of `add' should be a general 
register r0-r3
   arch/ia64/kernel/fsys.S:193: Error: Operand 3 of `add' should be a general 
register r0-r3
   arch/ia64/kernel/fsys.S:336: Error: Operand 3 of `add' should be a general 
register r0-r3
   arch/ia64/kernel/fsys.S:338: Error: Operand 3 of `add' should be a general 
register r0-r3
--
   arch/ia64/kernel/ivt.S: Assembler messages:
>> arch/ia64/kernel/ivt.S:759: Error: Operand 3 of `add' should be a general 
>> register r0-r3

vim +621 arch/ia64/kernel/entry.S

^1da177e Linus Torvalds 2005-04-16  605 PT_REGS_UNWIND_INFO(0)
^1da177e Linus Torvalds 2005-04-16  606  {  /*
^1da177e Linus Torvalds 2005-04-16  607  * Some versions of gas 
generate bad unwind info if the first instruction of a
^1da177e Linus Torvalds 2005-04-16  608  * procedure doesn't go into 
the first slot of a bundle.  This is a workaround.
^1da177e Linus Torvalds 2005-04-16  609  */
^1da177e Linus Torvalds 2005-04-16  610 nop.m 0
^1da177e Linus Torvalds 2005-04-16  611 nop.i 0
^1da177e Linus Torvalds 2005-04-16  612 /*
^1da177e Linus Torvalds 2005-04-16  613  * We need to call 
schedule_tail() to complete the scheduling process.
^1da177e Linus Torvalds 2005-04-16  614  * Called by ia64_switch_to() 
after do_fork()->copy_thread().  r8 contains the
^1da177e Linus Torvalds 2005-04-16  615  * address of the previously 
executing task.
^1da177e Linus Torvalds 2005-04-16  616  */
^1da177e Linus Torvalds 2005-04-16  617 br.call.sptk.many 
rp=ia64_invoke_schedule_tail
^1da177e Linus Torvalds 2005-04-16  618  }
^1da177e Linus Torvalds 2005-04-16  619  .ret8:
54d496c3 Al Viro2012-10-14  620  (pKStk)br.call.sptk.many 
rp=call_payload
^1da177e Linus Torvalds 2005-04-16 @621 adds 
r2=TI_FLAGS+IA64_TASK_SIZE,r13
^1da177e Linus Torvalds 2005-04-16  622 ;;
^1da177e Linus Torvalds 2005-04-16  623 ld4 r2=[r2]
^1da177e Linus Torvalds 2005-04-16  624 ;;
^1da177e Linus Torvalds 2005-04-16  625 mov r8=0
^1da177e Linus Torvalds 2005-04-16  626 and 
r2=_TIF_SYSCALL_TRACEAUDIT,r2
^1da177e Linus Torvalds 2005-04-16  627 ;;
^1da177e Linus Torvalds 2005-04-16  628 cmp.ne p6,p0=r2,r0
^1da177e Linus Torvalds 2005-04-16  629  (p6)   br.cond.spnt 
.strace_check_retval

:: The code at line 621 was first introduced by commit
:: 1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 Linux-2.6.12-rc2

:: TO: Linus Torvalds 
:: CC: Linus Torvalds 

---
0-DAY kernel test infrastructureOpen Source Technology Center
https://lists.01.org/pipermail/kbuild-all   Intel Corporation


.config.gz
Description: Binary data


arch/ia64/kernel/entry.S:621: Error: Operand 2 of `adds' should be a 14-bit integer (-8192-8191)

2016-06-25 Thread kbuild test robot
Hi,

FYI, the error/warning still remains.

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 
master
head:   da2f6aba4a21f8da3331e5251a117c52764da579
commit: da48d094ce5d7c7dcdad9011648a81c42fd1c2ef Kconfig: remove 
HAVE_LATENCYTOP_SUPPORT
date:   5 months ago
config: ia64-allmodconfig (attached as .config)
compiler: ia64-linux-gcc (GCC) 4.9.0
reproduce:
wget 
https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross
 -O ~/bin/make.cross
chmod +x ~/bin/make.cross
git checkout da48d094ce5d7c7dcdad9011648a81c42fd1c2ef
# save the attached .config to linux build tree
make.cross ARCH=ia64 

All errors (new ones prefixed by >>):

   arch/ia64/kernel/entry.S: Assembler messages:
>> arch/ia64/kernel/entry.S:621: Error: Operand 2 of `adds' should be a 14-bit 
>> integer (-8192-8191)
   arch/ia64/kernel/entry.S:728: Error: Operand 2 of `adds' should be a 14-bit 
integer (-8192-8191)
   arch/ia64/kernel/entry.S:859: Error: Operand 2 of `adds' should be a 14-bit 
integer (-8192-8191)
--
   arch/ia64/kernel/fsys.S: Assembler messages:
>> arch/ia64/kernel/fsys.S:67: Error: Operand 3 of `add' should be a general 
>> register r0-r3
   arch/ia64/kernel/fsys.S:97: Error: Operand 3 of `add' should be a general 
register r0-r3
   arch/ia64/kernel/fsys.S:193: Error: Operand 3 of `add' should be a general 
register r0-r3
   arch/ia64/kernel/fsys.S:336: Error: Operand 3 of `add' should be a general 
register r0-r3
   arch/ia64/kernel/fsys.S:338: Error: Operand 3 of `add' should be a general 
register r0-r3
--
   arch/ia64/kernel/ivt.S: Assembler messages:
>> arch/ia64/kernel/ivt.S:759: Error: Operand 3 of `add' should be a general 
>> register r0-r3

vim +621 arch/ia64/kernel/entry.S

^1da177e Linus Torvalds 2005-04-16  605 PT_REGS_UNWIND_INFO(0)
^1da177e Linus Torvalds 2005-04-16  606  {  /*
^1da177e Linus Torvalds 2005-04-16  607  * Some versions of gas 
generate bad unwind info if the first instruction of a
^1da177e Linus Torvalds 2005-04-16  608  * procedure doesn't go into 
the first slot of a bundle.  This is a workaround.
^1da177e Linus Torvalds 2005-04-16  609  */
^1da177e Linus Torvalds 2005-04-16  610 nop.m 0
^1da177e Linus Torvalds 2005-04-16  611 nop.i 0
^1da177e Linus Torvalds 2005-04-16  612 /*
^1da177e Linus Torvalds 2005-04-16  613  * We need to call 
schedule_tail() to complete the scheduling process.
^1da177e Linus Torvalds 2005-04-16  614  * Called by ia64_switch_to() 
after do_fork()->copy_thread().  r8 contains the
^1da177e Linus Torvalds 2005-04-16  615  * address of the previously 
executing task.
^1da177e Linus Torvalds 2005-04-16  616  */
^1da177e Linus Torvalds 2005-04-16  617 br.call.sptk.many 
rp=ia64_invoke_schedule_tail
^1da177e Linus Torvalds 2005-04-16  618  }
^1da177e Linus Torvalds 2005-04-16  619  .ret8:
54d496c3 Al Viro2012-10-14  620  (pKStk)br.call.sptk.many 
rp=call_payload
^1da177e Linus Torvalds 2005-04-16 @621 adds 
r2=TI_FLAGS+IA64_TASK_SIZE,r13
^1da177e Linus Torvalds 2005-04-16  622 ;;
^1da177e Linus Torvalds 2005-04-16  623 ld4 r2=[r2]
^1da177e Linus Torvalds 2005-04-16  624 ;;
^1da177e Linus Torvalds 2005-04-16  625 mov r8=0
^1da177e Linus Torvalds 2005-04-16  626 and 
r2=_TIF_SYSCALL_TRACEAUDIT,r2
^1da177e Linus Torvalds 2005-04-16  627 ;;
^1da177e Linus Torvalds 2005-04-16  628 cmp.ne p6,p0=r2,r0
^1da177e Linus Torvalds 2005-04-16  629  (p6)   br.cond.spnt 
.strace_check_retval

:: The code at line 621 was first introduced by commit
:: 1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 Linux-2.6.12-rc2

:: TO: Linus Torvalds 
:: CC: Linus Torvalds 

---
0-DAY kernel test infrastructureOpen Source Technology Center
https://lists.01.org/pipermail/kbuild-all   Intel Corporation


.config.gz
Description: Binary data


Re: [RFC] kref: pin objects with dangerously high reference count

2016-06-25 Thread Jann Horn
On Sun, Jun 26, 2016 at 2:03 AM, PaX Team  wrote:
> On 25 Jun 2016 at 3:13, Jann Horn wrote:
>
>> Since 2009 or so, PaX had reference count overflow mitigation code. My main
>> reasons for reinventing the wheel are:
>>
>>  - PaX adds arch-specific code, both in the atomic_t operations and in
>>exception handlers. I'd like to keep the code as
>>architecture-independent as possible, especially without adding
>>complexity to assembler code, to make it more maintainable and
>>auditable.
>
> complexity is a few simple lines of asm insns in what is already asm, hardly
> a big deal ;). in exchange you'd lose on code density, performance

Yes. It would probably be hard to get an interrupt instruction instead
of a (longer) call instruction without arch-specific code, and the cmp
operation probably can't be removed without putting the conditional
jump into assembly. I guess the main impact of this is higher
instruction cache pressure, leading to more cache faults? (Since
executing an extra cmp should afaik be really fast? But I don't know
much about optimization.)

Now I'm wondering how often atomic ops actually occur in the kernel...
in some grsec build I have here, I see 3687 "int 4" calls in a vmlinux
file that is 25MB big. In the optimal case of 8 additional bytes (3
for call instead of int, 5 for cmp) compared to PaX, that's about 30KB
more compared to assembly... hm, a ~0.1% increase in kernel size is
quite a lot. I guess one remaining question is how many overflow
checks have to happen in hot code paths.

(One of the hottest overflow checks in PaX is probably the one for
f_count in get_file_rcu() - in a multithreaded process, that's called
for every read() or write() -, and inlined copies of get_file()
probably account for a bunch of overflow checks. I believe that all of
these could be removed on 64bit because f_count is an atomic_long_t.
Why does PaX have overflow checks explicitly for atomic64_t? At least
for reference counters, I think that 64bit overflows shouldn't matter;
even the unrealistic worst-case (2^64)/(4GHz) is still over 100
years.)

I guess you might be right about inline asm being a better choice.

> and race windows.

Oh? I thought my code was race-free.

>>  - The refcounting hardening from PaX does not handle the "simple reference
>>count overflow" case when just the refcounting hardening code is used as
>>a standalone patch.
>
> i don't think that this is quite true as stated as handling this case depends
> on the exact sequencing of events. there're 3 cases in practice:
[...]
> 2. non-local use, safe sequence
>
>   inc_refcount -> object reference escapes to non-local memory
>
>   same as above, this case is not exploitable because the reference wouldn't
>   escape to non-local memory on overflow.

Ah, true. I somewhat dislike having to oops here, but I guess it's
safe; the only way to exploit oopses that I know of is to abuse them
for a very slow and ugly refcount overincrement, and with refcount
hardening, that shouldn't be an issue.

> 3. non-local use, unsafe sequence
>
>object reference escapes to non-local memory -> inc_refcount
>
>this case may already be a logic bug (the object could be freed between 
> these
>two actions if there's no other synchronization mechanism protecting them) 
> and
>a reference would escape even though the refcount itself wouldn't actually 
> be
>incremented. further decrements could then trigger the overdecrement case 
> and
>be exploitable as a use-after-free bug.
>
>the REFCOUNT feature in PaX wasn't designed to handle this case because 
> it's
>too rare to be worth the additional code and performance impact it'd 
> require
>to saturate the refcount in this case as well.

True, this sequence probably doesn't occur very often since acquiring
the new reference first is more obviously safe, and I don't remember
seeing it anywhere.

That said: I think that this sequence would usually be safe: As long
as the thread that makes the object globally available eventually
increments the reference counter (while still having a valid reference
to the object; but that's implicitly true, since otherwise a refcount
increment would be obviously unsafe), the object won't go away before
the refcount increment.

The case where the existing reference to the object is via RCU is an
exception because the current refcount can be zero and the refcount
increment can fail.

But yes, this sequence is less safe than the others because if an oops
happens before the increment, the reference count would end up being
too low.


Re: [RFC] kref: pin objects with dangerously high reference count

2016-06-25 Thread Jann Horn
On Sun, Jun 26, 2016 at 2:03 AM, PaX Team  wrote:
> On 25 Jun 2016 at 3:13, Jann Horn wrote:
>
>> Since 2009 or so, PaX had reference count overflow mitigation code. My main
>> reasons for reinventing the wheel are:
>>
>>  - PaX adds arch-specific code, both in the atomic_t operations and in
>>exception handlers. I'd like to keep the code as
>>architecture-independent as possible, especially without adding
>>complexity to assembler code, to make it more maintainable and
>>auditable.
>
> complexity is a few simple lines of asm insns in what is already asm, hardly
> a big deal ;). in exchange you'd lose on code density, performance

Yes. It would probably be hard to get an interrupt instruction instead
of a (longer) call instruction without arch-specific code, and the cmp
operation probably can't be removed without putting the conditional
jump into assembly. I guess the main impact of this is higher
instruction cache pressure, leading to more cache faults? (Since
executing an extra cmp should afaik be really fast? But I don't know
much about optimization.)

Now I'm wondering how often atomic ops actually occur in the kernel...
in some grsec build I have here, I see 3687 "int 4" calls in a vmlinux
file that is 25MB big. In the optimal case of 8 additional bytes (3
for call instead of int, 5 for cmp) compared to PaX, that's about 30KB
more compared to assembly... hm, a ~0.1% increase in kernel size is
quite a lot. I guess one remaining question is how many overflow
checks have to happen in hot code paths.

(One of the hottest overflow checks in PaX is probably the one for
f_count in get_file_rcu() - in a multithreaded process, that's called
for every read() or write() -, and inlined copies of get_file()
probably account for a bunch of overflow checks. I believe that all of
these could be removed on 64bit because f_count is an atomic_long_t.
Why does PaX have overflow checks explicitly for atomic64_t? At least
for reference counters, I think that 64bit overflows shouldn't matter;
even the unrealistic worst-case (2^64)/(4GHz) is still over 100
years.)

I guess you might be right about inline asm being a better choice.

> and race windows.

Oh? I thought my code was race-free.

>>  - The refcounting hardening from PaX does not handle the "simple reference
>>count overflow" case when just the refcounting hardening code is used as
>>a standalone patch.
>
> i don't think that this is quite true as stated as handling this case depends
> on the exact sequencing of events. there're 3 cases in practice:
[...]
> 2. non-local use, safe sequence
>
>   inc_refcount -> object reference escapes to non-local memory
>
>   same as above, this case is not exploitable because the reference wouldn't
>   escape to non-local memory on overflow.

Ah, true. I somewhat dislike having to oops here, but I guess it's
safe; the only way to exploit oopses that I know of is to abuse them
for a very slow and ugly refcount overincrement, and with refcount
hardening, that shouldn't be an issue.

> 3. non-local use, unsafe sequence
>
>object reference escapes to non-local memory -> inc_refcount
>
>this case may already be a logic bug (the object could be freed between 
> these
>two actions if there's no other synchronization mechanism protecting them) 
> and
>a reference would escape even though the refcount itself wouldn't actually 
> be
>incremented. further decrements could then trigger the overdecrement case 
> and
>be exploitable as a use-after-free bug.
>
>the REFCOUNT feature in PaX wasn't designed to handle this case because 
> it's
>too rare to be worth the additional code and performance impact it'd 
> require
>to saturate the refcount in this case as well.

True, this sequence probably doesn't occur very often since acquiring
the new reference first is more obviously safe, and I don't remember
seeing it anywhere.

That said: I think that this sequence would usually be safe: As long
as the thread that makes the object globally available eventually
increments the reference counter (while still having a valid reference
to the object; but that's implicitly true, since otherwise a refcount
increment would be obviously unsafe), the object won't go away before
the refcount increment.

The case where the existing reference to the object is via RCU is an
exception because the current refcount can be zero and the refcount
increment can fail.

But yes, this sequence is less safe than the others because if an oops
happens before the increment, the reference count would end up being
too low.


[PATCH V5 1/3] x86/ioapic: Support hot-removal of IOAPICs present during boot

2016-06-25 Thread Rui Wang
v5: Remove #ifdef CONFIG_X86 from setup-bus.c, making it neutral to archs.
v4: Add comments explaining when to call acpi_ioapic_add().
v3: Previous versions break mips. This version fixes it.

IOAPICs present during system boot aren't added to ioapic_list,
thus are unable to be hot-removed. Fix it by calling
acpi_ioapic_add() during root bus enumeration.

Signed-off-by: Rui Wang 
---
 drivers/acpi/internal.h |  2 --
 drivers/acpi/ioapic.c   |  7 ---
 drivers/acpi/pci_root.c | 13 -
 drivers/pci/setup-bus.c |  5 -
 include/linux/acpi.h|  6 ++
 5 files changed, 26 insertions(+), 7 deletions(-)

diff --git a/drivers/acpi/internal.h b/drivers/acpi/internal.h
index 27cc7fe..6d8e67e 100644
--- a/drivers/acpi/internal.h
+++ b/drivers/acpi/internal.h
@@ -40,10 +40,8 @@ int acpi_sysfs_init(void);
 void acpi_container_init(void);
 void acpi_memory_hotplug_init(void);
 #ifdef CONFIG_ACPI_HOTPLUG_IOAPIC
-int acpi_ioapic_add(struct acpi_pci_root *root);
 int acpi_ioapic_remove(struct acpi_pci_root *root);
 #else
-static inline int acpi_ioapic_add(struct acpi_pci_root *root) { return 0; }
 static inline int acpi_ioapic_remove(struct acpi_pci_root *root) { return 0; }
 #endif
 #ifdef CONFIG_ACPI_DOCK
diff --git a/drivers/acpi/ioapic.c b/drivers/acpi/ioapic.c
index ccdc8db..0f272e2 100644
--- a/drivers/acpi/ioapic.c
+++ b/drivers/acpi/ioapic.c
@@ -189,16 +189,17 @@ exit:
return AE_OK;
 }
 
-int acpi_ioapic_add(struct acpi_pci_root *root)
+int acpi_ioapic_add(acpi_handle root_handle)
 {
acpi_status status, retval = AE_OK;
 
-   status = acpi_walk_namespace(ACPI_TYPE_DEVICE, root->device->handle,
+   status = acpi_walk_namespace(ACPI_TYPE_DEVICE, root_handle,
 UINT_MAX, handle_ioapic_add, NULL,
-root->device->handle, (void **));
+root_handle, (void **));
 
return ACPI_SUCCESS(status) && ACPI_SUCCESS(retval) ? 0 : -ENODEV;
 }
+EXPORT_SYMBOL_GPL(acpi_ioapic_add);
 
 int acpi_ioapic_remove(struct acpi_pci_root *root)
 {
diff --git a/drivers/acpi/pci_root.c b/drivers/acpi/pci_root.c
index ae3fe4e..31e4440 100644
--- a/drivers/acpi/pci_root.c
+++ b/drivers/acpi/pci_root.c
@@ -614,7 +614,18 @@ static int acpi_pci_root_add(struct acpi_device *device,
if (hotadd) {
pcibios_resource_survey_bus(root->bus);
pci_assign_unassigned_root_bus_resources(root->bus);
-   acpi_ioapic_add(root);
+
+   /*
+* This is only called for the hotadd case. For the boot-time
+* case, we need to wait until after PCI initialization in
+* order to deal with IOAPICs mapped in on a PCI BAR.
+*
+* This is currently x86-specific, because acpi_ioapic_add()
+* is an empty function without CONFIG_ACPI_HOTPLUG_IOAPIC.
+* And CONFIG_ACPI_HOTPLUG_IOAPIC depends on CONFIG_X86_IO_APIC
+* (see drivers/acpi/Kconfig).
+*/
+   acpi_ioapic_add(root->device->handle);
}
 
pci_lock_rescan_remove();
diff --git a/drivers/pci/setup-bus.c b/drivers/pci/setup-bus.c
index 55641a3..e32c356 100644
--- a/drivers/pci/setup-bus.c
+++ b/drivers/pci/setup-bus.c
@@ -25,6 +25,7 @@
 #include 
 #include 
 #include 
+#include 
 #include "pci.h"
 
 unsigned int pci_flags;
@@ -1779,8 +1780,10 @@ void __init pci_assign_unassigned_resources(void)
 {
struct pci_bus *root_bus;
 
-   list_for_each_entry(root_bus, _root_buses, node)
+   list_for_each_entry(root_bus, _root_buses, node) {
pci_assign_unassigned_root_bus_resources(root_bus);
+   acpi_ioapic_add(ACPI_HANDLE(root_bus->bridge));
+   }
 }
 
 void pci_assign_unassigned_bridge_resources(struct pci_dev *bridge)
diff --git a/include/linux/acpi.h b/include/linux/acpi.h
index 288fac5..f5114dc 100644
--- a/include/linux/acpi.h
+++ b/include/linux/acpi.h
@@ -680,6 +680,12 @@ static inline enum dev_dma_attr acpi_get_dma_attr(struct 
acpi_device *adev)
 
 #endif /* !CONFIG_ACPI */
 
+#ifdef CONFIG_ACPI_HOTPLUG_IOAPIC
+int acpi_ioapic_add(acpi_handle root);
+#else
+static inline int acpi_ioapic_add(acpi_handle root) { return 0; }
+#endif
+
 #ifdef CONFIG_ACPI
 void acpi_os_set_prepare_sleep(int (*func)(u8 sleep_state,
   u32 pm1a_ctrl,  u32 pm1b_ctrl));
-- 
1.8.3.1



[PATCH V5 1/3] x86/ioapic: Support hot-removal of IOAPICs present during boot

2016-06-25 Thread Rui Wang
v5: Remove #ifdef CONFIG_X86 from setup-bus.c, making it neutral to archs.
v4: Add comments explaining when to call acpi_ioapic_add().
v3: Previous versions break mips. This version fixes it.

IOAPICs present during system boot aren't added to ioapic_list,
thus are unable to be hot-removed. Fix it by calling
acpi_ioapic_add() during root bus enumeration.

Signed-off-by: Rui Wang 
---
 drivers/acpi/internal.h |  2 --
 drivers/acpi/ioapic.c   |  7 ---
 drivers/acpi/pci_root.c | 13 -
 drivers/pci/setup-bus.c |  5 -
 include/linux/acpi.h|  6 ++
 5 files changed, 26 insertions(+), 7 deletions(-)

diff --git a/drivers/acpi/internal.h b/drivers/acpi/internal.h
index 27cc7fe..6d8e67e 100644
--- a/drivers/acpi/internal.h
+++ b/drivers/acpi/internal.h
@@ -40,10 +40,8 @@ int acpi_sysfs_init(void);
 void acpi_container_init(void);
 void acpi_memory_hotplug_init(void);
 #ifdef CONFIG_ACPI_HOTPLUG_IOAPIC
-int acpi_ioapic_add(struct acpi_pci_root *root);
 int acpi_ioapic_remove(struct acpi_pci_root *root);
 #else
-static inline int acpi_ioapic_add(struct acpi_pci_root *root) { return 0; }
 static inline int acpi_ioapic_remove(struct acpi_pci_root *root) { return 0; }
 #endif
 #ifdef CONFIG_ACPI_DOCK
diff --git a/drivers/acpi/ioapic.c b/drivers/acpi/ioapic.c
index ccdc8db..0f272e2 100644
--- a/drivers/acpi/ioapic.c
+++ b/drivers/acpi/ioapic.c
@@ -189,16 +189,17 @@ exit:
return AE_OK;
 }
 
-int acpi_ioapic_add(struct acpi_pci_root *root)
+int acpi_ioapic_add(acpi_handle root_handle)
 {
acpi_status status, retval = AE_OK;
 
-   status = acpi_walk_namespace(ACPI_TYPE_DEVICE, root->device->handle,
+   status = acpi_walk_namespace(ACPI_TYPE_DEVICE, root_handle,
 UINT_MAX, handle_ioapic_add, NULL,
-root->device->handle, (void **));
+root_handle, (void **));
 
return ACPI_SUCCESS(status) && ACPI_SUCCESS(retval) ? 0 : -ENODEV;
 }
+EXPORT_SYMBOL_GPL(acpi_ioapic_add);
 
 int acpi_ioapic_remove(struct acpi_pci_root *root)
 {
diff --git a/drivers/acpi/pci_root.c b/drivers/acpi/pci_root.c
index ae3fe4e..31e4440 100644
--- a/drivers/acpi/pci_root.c
+++ b/drivers/acpi/pci_root.c
@@ -614,7 +614,18 @@ static int acpi_pci_root_add(struct acpi_device *device,
if (hotadd) {
pcibios_resource_survey_bus(root->bus);
pci_assign_unassigned_root_bus_resources(root->bus);
-   acpi_ioapic_add(root);
+
+   /*
+* This is only called for the hotadd case. For the boot-time
+* case, we need to wait until after PCI initialization in
+* order to deal with IOAPICs mapped in on a PCI BAR.
+*
+* This is currently x86-specific, because acpi_ioapic_add()
+* is an empty function without CONFIG_ACPI_HOTPLUG_IOAPIC.
+* And CONFIG_ACPI_HOTPLUG_IOAPIC depends on CONFIG_X86_IO_APIC
+* (see drivers/acpi/Kconfig).
+*/
+   acpi_ioapic_add(root->device->handle);
}
 
pci_lock_rescan_remove();
diff --git a/drivers/pci/setup-bus.c b/drivers/pci/setup-bus.c
index 55641a3..e32c356 100644
--- a/drivers/pci/setup-bus.c
+++ b/drivers/pci/setup-bus.c
@@ -25,6 +25,7 @@
 #include 
 #include 
 #include 
+#include 
 #include "pci.h"
 
 unsigned int pci_flags;
@@ -1779,8 +1780,10 @@ void __init pci_assign_unassigned_resources(void)
 {
struct pci_bus *root_bus;
 
-   list_for_each_entry(root_bus, _root_buses, node)
+   list_for_each_entry(root_bus, _root_buses, node) {
pci_assign_unassigned_root_bus_resources(root_bus);
+   acpi_ioapic_add(ACPI_HANDLE(root_bus->bridge));
+   }
 }
 
 void pci_assign_unassigned_bridge_resources(struct pci_dev *bridge)
diff --git a/include/linux/acpi.h b/include/linux/acpi.h
index 288fac5..f5114dc 100644
--- a/include/linux/acpi.h
+++ b/include/linux/acpi.h
@@ -680,6 +680,12 @@ static inline enum dev_dma_attr acpi_get_dma_attr(struct 
acpi_device *adev)
 
 #endif /* !CONFIG_ACPI */
 
+#ifdef CONFIG_ACPI_HOTPLUG_IOAPIC
+int acpi_ioapic_add(acpi_handle root);
+#else
+static inline int acpi_ioapic_add(acpi_handle root) { return 0; }
+#endif
+
 #ifdef CONFIG_ACPI
 void acpi_os_set_prepare_sleep(int (*func)(u8 sleep_state,
   u32 pm1a_ctrl,  u32 pm1b_ctrl));
-- 
1.8.3.1



Re: [PATCH v3 1/3] arm: tegra: initial support for apalis tk1

2016-06-25 Thread kbuild test robot
Hi,

[auto build test ERROR on robh/for-next]
[also build test ERROR on v4.7-rc4 next-20160624]
[if your patch is applied to the wrong git tree, please drop us a note to help 
improve the system]

url:
https://github.com/0day-ci/linux/commits/Marcel-Ziswiler/arm-tegra-initial-support-for-apalis-tk1/20160619-091204
base:   https://git.kernel.org/pub/scm/linux/kernel/git/robh/linux for-next
config: arm-tegra_defconfig (attached as .config)
compiler: arm-linux-gnueabi-gcc (Debian 5.3.1-8) 5.3.1 20160205
reproduce:
wget 
https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross
 -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
make.cross ARCH=arm 

All errors (new ones prefixed by >>):

   ERROR (duplicate_label): Duplicate label 'pinmux' on /pinmux@7868 and 
/pinmux@0,7868
>> ERROR: Input tree has errors, aborting (use -f to force output)

---
0-DAY kernel test infrastructureOpen Source Technology Center
https://lists.01.org/pipermail/kbuild-all   Intel Corporation


.config.gz
Description: Binary data


Re: [PATCH v3 1/3] arm: tegra: initial support for apalis tk1

2016-06-25 Thread kbuild test robot
Hi,

[auto build test ERROR on robh/for-next]
[also build test ERROR on v4.7-rc4 next-20160624]
[if your patch is applied to the wrong git tree, please drop us a note to help 
improve the system]

url:
https://github.com/0day-ci/linux/commits/Marcel-Ziswiler/arm-tegra-initial-support-for-apalis-tk1/20160619-091204
base:   https://git.kernel.org/pub/scm/linux/kernel/git/robh/linux for-next
config: arm-tegra_defconfig (attached as .config)
compiler: arm-linux-gnueabi-gcc (Debian 5.3.1-8) 5.3.1 20160205
reproduce:
wget 
https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross
 -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
make.cross ARCH=arm 

All errors (new ones prefixed by >>):

   ERROR (duplicate_label): Duplicate label 'pinmux' on /pinmux@7868 and 
/pinmux@0,7868
>> ERROR: Input tree has errors, aborting (use -f to force output)

---
0-DAY kernel test infrastructureOpen Source Technology Center
https://lists.01.org/pipermail/kbuild-all   Intel Corporation


.config.gz
Description: Binary data


[PATCH 1/7] hwmon: (core) New hwmon registration API

2016-06-25 Thread Guenter Roeck
Up to now, each hwmon driver has to implement its own sysfs attributes.
This requires a lot of template code, and distracts from the driver's core
function to read and write chip registers.

To be able to reduce driver complexity, move sensor attribute handling
and thermal zone registration into hwmon core. By using the new API,
driver size is typically reduced by 20-50% depending on driver complexity
and the number of sysfs attributes supported.

With this patch, the new API only supports thermal sensors. Support for
other sensor types will be added with subsequent patches.

Signed-off-by: Guenter Roeck 
---
 drivers/hwmon/hwmon.c | 485 ++
 include/linux/hwmon.h | 122 +
 2 files changed, 574 insertions(+), 33 deletions(-)

diff --git a/drivers/hwmon/hwmon.c b/drivers/hwmon/hwmon.c
index a26c385a435b..9530644ae297 100644
--- a/drivers/hwmon/hwmon.c
+++ b/drivers/hwmon/hwmon.c
@@ -12,17 +12,16 @@
 
 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
 
-#include 
+#include 
 #include 
 #include 
-#include 
-#include 
-#include 
 #include 
-#include 
-#include 
+#include 
+#include 
 #include 
+#include 
 #include 
+#include 
 
 #define HWMON_ID_PREFIX "hwmon"
 #define HWMON_ID_FORMAT HWMON_ID_PREFIX "%d"
@@ -30,9 +29,33 @@
 struct hwmon_device {
const char *name;
struct device dev;
+   const struct hwmon_chip_info *chip;
+
+   struct attribute_group group;
+   const struct attribute_group **groups;
 };
 #define to_hwmon_device(d) container_of(d, struct hwmon_device, dev)
 
+struct hwmon_device_attribute {
+   struct device_attribute dev_attr;
+   const struct hwmon_ops *ops;
+   enum hwmon_sensor_types type;
+   u32 attr;
+   int index;
+};
+#define to_hwmon_attr(d) \
+   container_of(d, struct hwmon_device_attribute, dev_attr)
+
+/*
+ * Thermal zone information
+ * In addition to the reference to the hwmon device,
+ * also provides the sensor index.
+ */
+struct hwmon_thermal_data {
+   struct hwmon_device *hwdev; /* Reference to hwmon device */
+   int index;  /* sensor index */
+};
+
 static ssize_t
 show_name(struct device *dev, struct device_attribute *attr, char *buf)
 {
@@ -80,25 +103,280 @@ static struct class hwmon_class = {
 
 static DEFINE_IDA(hwmon_ida);
 
-/**
- * hwmon_device_register_with_groups - register w/ hwmon
- * @dev: the parent device
- * @name: hwmon name attribute
- * @drvdata: driver data to attach to created device
- * @groups: List of attribute groups to create
- *
- * hwmon_device_unregister() must be called when the device is no
- * longer needed.
- *
- * Returns the pointer to the new device.
- */
-struct device *
-hwmon_device_register_with_groups(struct device *dev, const char *name,
- void *drvdata,
- const struct attribute_group **groups)
+/* Thermal zone handling */
+
+static int hwmon_thermal_get_temp(void *data, int *temp)
+{
+   struct hwmon_thermal_data *tdata = data;
+   struct hwmon_device *hwdev = tdata->hwdev;
+   int ret;
+   long t;
+
+   ret = hwdev->chip->ops->read(>dev, hwmon_temp, hwmon_temp_input,
+tdata->index, );
+   if (ret < 0)
+   return ret;
+
+   *temp = t;
+
+   return 0;
+}
+
+static struct thermal_zone_of_device_ops hwmon_thermal_ops = {
+   .get_temp = hwmon_thermal_get_temp,
+};
+
+static int hwmon_thermal_add_sensor(struct device *dev,
+   struct hwmon_device *hwdev,
+   int index)
+{
+   struct hwmon_thermal_data *tdata;
+
+   tdata = devm_kzalloc(dev, sizeof(*tdata), GFP_KERNEL);
+   if (!tdata)
+   return -ENOMEM;
+
+   tdata->hwdev = hwdev;
+   tdata->index = index;
+
+   devm_thermal_zone_of_sensor_register(>dev, index, tdata,
+_thermal_ops);
+
+   return 0;
+}
+
+/* sysfs attribute management */
+
+static ssize_t hwmon_attr_show(struct device *dev,
+  struct device_attribute *devattr, char *buf)
+{
+   struct hwmon_device_attribute *hattr = to_hwmon_attr(devattr);
+   long val;
+   int ret;
+
+   ret = hattr->ops->read(dev, hattr->type, hattr->attr, hattr->index,
+  );
+   if (ret < 0)
+   return ret;
+
+   return sprintf(buf, "%ld\n", val);
+}
+
+static ssize_t hwmon_attr_store(struct device *dev,
+   struct device_attribute *devattr,
+   const char *buf, size_t count)
+{
+   struct hwmon_device_attribute *hattr = to_hwmon_attr(devattr);
+   long val;
+   int ret;
+
+   ret = kstrtol(buf, 10, );
+   if (ret < 0)
+   return ret;
+
+   ret = hattr->ops->write(dev, hattr->type, hattr->attr, hattr->index,
+   

[PATCH 1/7] hwmon: (core) New hwmon registration API

2016-06-25 Thread Guenter Roeck
Up to now, each hwmon driver has to implement its own sysfs attributes.
This requires a lot of template code, and distracts from the driver's core
function to read and write chip registers.

To be able to reduce driver complexity, move sensor attribute handling
and thermal zone registration into hwmon core. By using the new API,
driver size is typically reduced by 20-50% depending on driver complexity
and the number of sysfs attributes supported.

With this patch, the new API only supports thermal sensors. Support for
other sensor types will be added with subsequent patches.

Signed-off-by: Guenter Roeck 
---
 drivers/hwmon/hwmon.c | 485 ++
 include/linux/hwmon.h | 122 +
 2 files changed, 574 insertions(+), 33 deletions(-)

diff --git a/drivers/hwmon/hwmon.c b/drivers/hwmon/hwmon.c
index a26c385a435b..9530644ae297 100644
--- a/drivers/hwmon/hwmon.c
+++ b/drivers/hwmon/hwmon.c
@@ -12,17 +12,16 @@
 
 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
 
-#include 
+#include 
 #include 
 #include 
-#include 
-#include 
-#include 
 #include 
-#include 
-#include 
+#include 
+#include 
 #include 
+#include 
 #include 
+#include 
 
 #define HWMON_ID_PREFIX "hwmon"
 #define HWMON_ID_FORMAT HWMON_ID_PREFIX "%d"
@@ -30,9 +29,33 @@
 struct hwmon_device {
const char *name;
struct device dev;
+   const struct hwmon_chip_info *chip;
+
+   struct attribute_group group;
+   const struct attribute_group **groups;
 };
 #define to_hwmon_device(d) container_of(d, struct hwmon_device, dev)
 
+struct hwmon_device_attribute {
+   struct device_attribute dev_attr;
+   const struct hwmon_ops *ops;
+   enum hwmon_sensor_types type;
+   u32 attr;
+   int index;
+};
+#define to_hwmon_attr(d) \
+   container_of(d, struct hwmon_device_attribute, dev_attr)
+
+/*
+ * Thermal zone information
+ * In addition to the reference to the hwmon device,
+ * also provides the sensor index.
+ */
+struct hwmon_thermal_data {
+   struct hwmon_device *hwdev; /* Reference to hwmon device */
+   int index;  /* sensor index */
+};
+
 static ssize_t
 show_name(struct device *dev, struct device_attribute *attr, char *buf)
 {
@@ -80,25 +103,280 @@ static struct class hwmon_class = {
 
 static DEFINE_IDA(hwmon_ida);
 
-/**
- * hwmon_device_register_with_groups - register w/ hwmon
- * @dev: the parent device
- * @name: hwmon name attribute
- * @drvdata: driver data to attach to created device
- * @groups: List of attribute groups to create
- *
- * hwmon_device_unregister() must be called when the device is no
- * longer needed.
- *
- * Returns the pointer to the new device.
- */
-struct device *
-hwmon_device_register_with_groups(struct device *dev, const char *name,
- void *drvdata,
- const struct attribute_group **groups)
+/* Thermal zone handling */
+
+static int hwmon_thermal_get_temp(void *data, int *temp)
+{
+   struct hwmon_thermal_data *tdata = data;
+   struct hwmon_device *hwdev = tdata->hwdev;
+   int ret;
+   long t;
+
+   ret = hwdev->chip->ops->read(>dev, hwmon_temp, hwmon_temp_input,
+tdata->index, );
+   if (ret < 0)
+   return ret;
+
+   *temp = t;
+
+   return 0;
+}
+
+static struct thermal_zone_of_device_ops hwmon_thermal_ops = {
+   .get_temp = hwmon_thermal_get_temp,
+};
+
+static int hwmon_thermal_add_sensor(struct device *dev,
+   struct hwmon_device *hwdev,
+   int index)
+{
+   struct hwmon_thermal_data *tdata;
+
+   tdata = devm_kzalloc(dev, sizeof(*tdata), GFP_KERNEL);
+   if (!tdata)
+   return -ENOMEM;
+
+   tdata->hwdev = hwdev;
+   tdata->index = index;
+
+   devm_thermal_zone_of_sensor_register(>dev, index, tdata,
+_thermal_ops);
+
+   return 0;
+}
+
+/* sysfs attribute management */
+
+static ssize_t hwmon_attr_show(struct device *dev,
+  struct device_attribute *devattr, char *buf)
+{
+   struct hwmon_device_attribute *hattr = to_hwmon_attr(devattr);
+   long val;
+   int ret;
+
+   ret = hattr->ops->read(dev, hattr->type, hattr->attr, hattr->index,
+  );
+   if (ret < 0)
+   return ret;
+
+   return sprintf(buf, "%ld\n", val);
+}
+
+static ssize_t hwmon_attr_store(struct device *dev,
+   struct device_attribute *devattr,
+   const char *buf, size_t count)
+{
+   struct hwmon_device_attribute *hattr = to_hwmon_attr(devattr);
+   long val;
+   int ret;
+
+   ret = kstrtol(buf, 10, );
+   if (ret < 0)
+   return ret;
+
+   ret = hattr->ops->write(dev, hattr->type, hattr->attr, hattr->index,
+   

[PATCH 2/7] hwmon: (core) Add voltage attribute support to new API

2016-06-25 Thread Guenter Roeck
Signed-off-by: Guenter Roeck 
---
 drivers/hwmon/hwmon.c | 21 +
 include/linux/hwmon.h | 35 +++
 2 files changed, 56 insertions(+)

diff --git a/drivers/hwmon/hwmon.c b/drivers/hwmon/hwmon.c
index 9530644ae297..d2916074befd 100644
--- a/drivers/hwmon/hwmon.c
+++ b/drivers/hwmon/hwmon.c
@@ -250,6 +250,7 @@ static struct attribute *hwmon_genattr(struct device *dev,
 
 static const char * const hwmon_chip_attr_templates[] = {
[hwmon_chip_temp_reset_history] = "temp_reset_history",
+   [hwmon_chip_in_reset_history] = "in_reset_history",
[hwmon_chip_update_interval] = "update_interval",
[hwmon_chip_alarms] = "alarms",
 };
@@ -281,14 +282,34 @@ static const char * const hwmon_temp_attr_templates[] = {
[hwmon_temp_reset_history] = "temp%d_reset_history",
 };
 
+static const char * const hwmon_in_attr_templates[] = {
+   [hwmon_in_input] = "in%d_input",
+   [hwmon_in_min] = "in%d_min",
+   [hwmon_in_max] = "in%d_max",
+   [hwmon_in_lcrit] = "in%d_lcrit",
+   [hwmon_in_crit] = "in%d_crit",
+   [hwmon_in_average] = "in%d_average",
+   [hwmon_in_lowest] = "in%d_lowest",
+   [hwmon_in_highest] = "in%d_highest",
+   [hwmon_in_reset_history] = "in%d_reset_history",
+   [hwmon_in_label] = "in%d_label",
+   [hwmon_in_alarm] = "in%d_alarm",
+   [hwmon_in_min_alarm] = "in%d_min_alarm",
+   [hwmon_in_max_alarm] = "in%d_max_alarm",
+   [hwmon_in_lcrit_alarm] = "in%d_lcrit_alarm",
+   [hwmon_in_crit_alarm] = "in%d_crit_alarm",
+};
+
 static const char * const *__templates[] = {
[hwmon_chip] = hwmon_chip_attr_templates,
[hwmon_temp] = hwmon_temp_attr_templates,
+   [hwmon_in] = hwmon_in_attr_templates,
 };
 
 static const int __templates_size[] = {
[hwmon_chip] = ARRAY_SIZE(hwmon_chip_attr_templates),
[hwmon_temp] = ARRAY_SIZE(hwmon_temp_attr_templates),
+   [hwmon_in] = ARRAY_SIZE(hwmon_in_attr_templates),
 };
 
 static int hwmon_num_channel_attrs(const struct hwmon_channel_info *info)
diff --git a/include/linux/hwmon.h b/include/linux/hwmon.h
index 99250ad092fd..5e632c0fcbf4 100644
--- a/include/linux/hwmon.h
+++ b/include/linux/hwmon.h
@@ -30,6 +30,7 @@ enum hwmon_sensor_types {
 
 enum hwmon_chip_attributes {
hwmon_chip_temp_reset_history,
+   hwmon_chip_in_reset_history,
hwmon_chip_register_tz,
hwmon_chip_update_interval,
hwmon_chip_alarms,
@@ -91,6 +92,40 @@ enum hwmon_temp_attributes {
 #define HWMON_T_HIGHESTBIT(hwmon_temp_highest)
 #define HWMON_T_RESET_HISTORY  BIT(hwmon_temp_reset_history)
 
+enum hwmon_in_attributes {
+   hwmon_in_input,
+   hwmon_in_min,
+   hwmon_in_max,
+   hwmon_in_lcrit,
+   hwmon_in_crit,
+   hwmon_in_average,
+   hwmon_in_lowest,
+   hwmon_in_highest,
+   hwmon_in_reset_history,
+   hwmon_in_label,
+   hwmon_in_alarm,
+   hwmon_in_min_alarm,
+   hwmon_in_max_alarm,
+   hwmon_in_lcrit_alarm,
+   hwmon_in_crit_alarm,
+};
+
+#define HWMON_I_INPUT  BIT(hwmon_in_input)
+#define HWMON_I_MINBIT(hwmon_in_min)
+#define HWMON_I_MAXBIT(hwmon_in_max)
+#define HWMON_I_LCRIT  BIT(hwmon_in_lcrit)
+#define HWMON_I_CRIT   BIT(hwmon_in_crit)
+#define HWMON_I_AVERAGEBIT(hwmon_in_average)
+#define HWMON_I_LOWEST BIT(hwmon_in_lowest)
+#define HWMON_I_HIGHESTBIT(hwmon_in_highest)
+#define HWMON_I_RESET_HISTORY  BIT(hwmon_in_reset_history)
+#define HWMON_I_LABEL  BIT(hwmon_in_label)
+#define HWMON_I_ALARM  BIT(hwmon_in_alarm)
+#define HWMON_I_MIN_ALARM  BIT(hwmon_in_min_alarm)
+#define HWMON_I_MAX_ALARM  BIT(hwmon_in_max_alarm)
+#define HWMON_I_LCRIT_ALARMBIT(hwmon_in_lcrit_alarm)
+#define HWMON_I_CRIT_ALARM BIT(hwmon_in_crit_alarm)
+
 /**
  * struct hwmon_ops - hwmon device operations
  * @is_visible: Callback to return attribute visibility.
-- 
2.5.0



[PATCH 2/7] hwmon: (core) Add voltage attribute support to new API

2016-06-25 Thread Guenter Roeck
Signed-off-by: Guenter Roeck 
---
 drivers/hwmon/hwmon.c | 21 +
 include/linux/hwmon.h | 35 +++
 2 files changed, 56 insertions(+)

diff --git a/drivers/hwmon/hwmon.c b/drivers/hwmon/hwmon.c
index 9530644ae297..d2916074befd 100644
--- a/drivers/hwmon/hwmon.c
+++ b/drivers/hwmon/hwmon.c
@@ -250,6 +250,7 @@ static struct attribute *hwmon_genattr(struct device *dev,
 
 static const char * const hwmon_chip_attr_templates[] = {
[hwmon_chip_temp_reset_history] = "temp_reset_history",
+   [hwmon_chip_in_reset_history] = "in_reset_history",
[hwmon_chip_update_interval] = "update_interval",
[hwmon_chip_alarms] = "alarms",
 };
@@ -281,14 +282,34 @@ static const char * const hwmon_temp_attr_templates[] = {
[hwmon_temp_reset_history] = "temp%d_reset_history",
 };
 
+static const char * const hwmon_in_attr_templates[] = {
+   [hwmon_in_input] = "in%d_input",
+   [hwmon_in_min] = "in%d_min",
+   [hwmon_in_max] = "in%d_max",
+   [hwmon_in_lcrit] = "in%d_lcrit",
+   [hwmon_in_crit] = "in%d_crit",
+   [hwmon_in_average] = "in%d_average",
+   [hwmon_in_lowest] = "in%d_lowest",
+   [hwmon_in_highest] = "in%d_highest",
+   [hwmon_in_reset_history] = "in%d_reset_history",
+   [hwmon_in_label] = "in%d_label",
+   [hwmon_in_alarm] = "in%d_alarm",
+   [hwmon_in_min_alarm] = "in%d_min_alarm",
+   [hwmon_in_max_alarm] = "in%d_max_alarm",
+   [hwmon_in_lcrit_alarm] = "in%d_lcrit_alarm",
+   [hwmon_in_crit_alarm] = "in%d_crit_alarm",
+};
+
 static const char * const *__templates[] = {
[hwmon_chip] = hwmon_chip_attr_templates,
[hwmon_temp] = hwmon_temp_attr_templates,
+   [hwmon_in] = hwmon_in_attr_templates,
 };
 
 static const int __templates_size[] = {
[hwmon_chip] = ARRAY_SIZE(hwmon_chip_attr_templates),
[hwmon_temp] = ARRAY_SIZE(hwmon_temp_attr_templates),
+   [hwmon_in] = ARRAY_SIZE(hwmon_in_attr_templates),
 };
 
 static int hwmon_num_channel_attrs(const struct hwmon_channel_info *info)
diff --git a/include/linux/hwmon.h b/include/linux/hwmon.h
index 99250ad092fd..5e632c0fcbf4 100644
--- a/include/linux/hwmon.h
+++ b/include/linux/hwmon.h
@@ -30,6 +30,7 @@ enum hwmon_sensor_types {
 
 enum hwmon_chip_attributes {
hwmon_chip_temp_reset_history,
+   hwmon_chip_in_reset_history,
hwmon_chip_register_tz,
hwmon_chip_update_interval,
hwmon_chip_alarms,
@@ -91,6 +92,40 @@ enum hwmon_temp_attributes {
 #define HWMON_T_HIGHESTBIT(hwmon_temp_highest)
 #define HWMON_T_RESET_HISTORY  BIT(hwmon_temp_reset_history)
 
+enum hwmon_in_attributes {
+   hwmon_in_input,
+   hwmon_in_min,
+   hwmon_in_max,
+   hwmon_in_lcrit,
+   hwmon_in_crit,
+   hwmon_in_average,
+   hwmon_in_lowest,
+   hwmon_in_highest,
+   hwmon_in_reset_history,
+   hwmon_in_label,
+   hwmon_in_alarm,
+   hwmon_in_min_alarm,
+   hwmon_in_max_alarm,
+   hwmon_in_lcrit_alarm,
+   hwmon_in_crit_alarm,
+};
+
+#define HWMON_I_INPUT  BIT(hwmon_in_input)
+#define HWMON_I_MINBIT(hwmon_in_min)
+#define HWMON_I_MAXBIT(hwmon_in_max)
+#define HWMON_I_LCRIT  BIT(hwmon_in_lcrit)
+#define HWMON_I_CRIT   BIT(hwmon_in_crit)
+#define HWMON_I_AVERAGEBIT(hwmon_in_average)
+#define HWMON_I_LOWEST BIT(hwmon_in_lowest)
+#define HWMON_I_HIGHESTBIT(hwmon_in_highest)
+#define HWMON_I_RESET_HISTORY  BIT(hwmon_in_reset_history)
+#define HWMON_I_LABEL  BIT(hwmon_in_label)
+#define HWMON_I_ALARM  BIT(hwmon_in_alarm)
+#define HWMON_I_MIN_ALARM  BIT(hwmon_in_min_alarm)
+#define HWMON_I_MAX_ALARM  BIT(hwmon_in_max_alarm)
+#define HWMON_I_LCRIT_ALARMBIT(hwmon_in_lcrit_alarm)
+#define HWMON_I_CRIT_ALARM BIT(hwmon_in_crit_alarm)
+
 /**
  * struct hwmon_ops - hwmon device operations
  * @is_visible: Callback to return attribute visibility.
-- 
2.5.0



[PATCH 7/7] hwmon: (core) Document new kernel API

2016-06-25 Thread Guenter Roeck
Describe the new registration API function as well as the data
structures it requires.

Signed-off-by: Guenter Roeck 
---
 Documentation/hwmon/hwmon-kernel-api.txt | 229 ++-
 1 file changed, 227 insertions(+), 2 deletions(-)

diff --git a/Documentation/hwmon/hwmon-kernel-api.txt 
b/Documentation/hwmon/hwmon-kernel-api.txt
index 2ecdbfc85ecf..1a96c36532f2 100644
--- a/Documentation/hwmon/hwmon-kernel-api.txt
+++ b/Documentation/hwmon/hwmon-kernel-api.txt
@@ -34,6 +34,19 @@ devm_hwmon_device_register_with_groups(struct device *dev,
   const char *name, void *drvdata,
   const struct attribute_group **groups);
 
+struct device *
+hwmon_device_register_with_info(struct device *dev,
+   const char *name, void *drvdata,
+   const struct hwmon_chip_info *info,
+   const struct attribute_group **groups);
+
+struct device *
+devm_hwmon_device_register_with_info(struct device *dev,
+const char *name,
+void *drvdata,
+const struct hwmon_chip_info *info,
+const struct attribute_group **groups);
+
 void hwmon_device_unregister(struct device *dev);
 void devm_hwmon_device_unregister(struct device *dev);
 
@@ -60,15 +73,227 @@ devm_hwmon_device_register_with_groups is similar to
 hwmon_device_register_with_groups. However, it is device managed, meaning the
 hwmon device does not have to be removed explicitly by the removal function.
 
+hwmon_device_register_with_info is the most comprehensive and preferred means
+to register a hardware monitoring device. It creates the standard sysfs
+attributes in the hardware monitoring core, letting the driver focus on reading
+from and writing to the chip instead of having to bother with sysfs attributes.
+Its parameters are described in more detail below.
+
+devm_hwmon_device_register_with_info is similar to
+hwmon_device_register_with_info. However, it is device managed, meaning the
+hwmon device does not have to be removed explicitly by the removal function.
+
 hwmon_device_unregister deregisters a registered hardware monitoring device.
 The parameter of this function is the pointer to the registered hardware
 monitoring device structure. This function must be called from the driver
 remove function if the hardware monitoring device was registered with
-hwmon_device_register or with hwmon_device_register_with_groups.
+hwmon_device_register, hwmon_device_register_with_groups, or
+hwmon_device_register_with_info.
 
 devm_hwmon_device_unregister does not normally have to be called. It is only
 needed for error handling, and only needed if the driver probe fails after
-the call to devm_hwmon_device_register_with_groups.
+the call to devm_hwmon_device_register_with_groups and if the automatic
+(device managed) removal would be too late.
+
+Using devm_hwmon_device_register_with_info()
+
+
+hwmon_device_register_with_info() registers a hardware monitoring device.
+The parameters to this function are
+
+struct device *dev Pointer to parent device
+const char *name   Device name
+void *drvdata  Driver private data
+const struct hwmon_chip_info *info
+   Pointer to chip description.
+const struct attribute_group **groups
+   Null-terminated list of additional sysfs attribute
+   groups.
+
+This function returns a pointer to the created hardware monitoring device
+on success and a negative error code for failure.
+
+The hwmon_chip_info structure looks as follows.
+
+struct hwmon_chip_info {
+   const struct hwmon_ops *ops;
+   const struct hwmon_channel_info **info;
+};
+
+It contains the following fields:
+
+* ops: Pointer to device operations.
+* info: NULL-terminated list of device channel descriptors.
+
+The list of hwmon operations is defined as:
+
+struct hwmon_ops {
+   umode_t (*is_visible)(const void *, enum hwmon_sensor_types type,
+ u32 attr, int);
+   int (*read)(struct device *, enum hwmon_sensor_types type,
+   u32 attr, int, long *);
+   int (*write)(struct device *, enum hwmon_sensor_types type,
+u32 attr, int, long);
+};
+
+It defines the following operations.
+
+* is_visible: Pointer to a function to return the file mode for each supported
+  attribute. This function is mandatory.
+
+* read: Pointer to a function for reading a value from the chip. This function
+  is optional, but must be provided if any readable attributes exist.
+
+* write: Pointer to a function for writing a value to the chip. This function 
is
+  optional, but must be priovided if any writeable attributes exist.
+
+Each sensor channel is described with struct 

[PATCH 3/7] hwmon: (core) Add current attribute support to new API

2016-06-25 Thread Guenter Roeck
Signed-off-by: Guenter Roeck 
---
 drivers/hwmon/hwmon.c | 21 +
 include/linux/hwmon.h | 36 
 2 files changed, 57 insertions(+)

diff --git a/drivers/hwmon/hwmon.c b/drivers/hwmon/hwmon.c
index d2916074befd..8c3c7ffe828b 100644
--- a/drivers/hwmon/hwmon.c
+++ b/drivers/hwmon/hwmon.c
@@ -251,6 +251,7 @@ static struct attribute *hwmon_genattr(struct device *dev,
 static const char * const hwmon_chip_attr_templates[] = {
[hwmon_chip_temp_reset_history] = "temp_reset_history",
[hwmon_chip_in_reset_history] = "in_reset_history",
+   [hwmon_chip_curr_reset_history] = "curr_reset_history",
[hwmon_chip_update_interval] = "update_interval",
[hwmon_chip_alarms] = "alarms",
 };
@@ -300,16 +301,36 @@ static const char * const hwmon_in_attr_templates[] = {
[hwmon_in_crit_alarm] = "in%d_crit_alarm",
 };
 
+static const char * const hwmon_curr_attr_templates[] = {
+   [hwmon_curr_input] = "curr%d_input",
+   [hwmon_curr_min] = "curr%d_min",
+   [hwmon_curr_max] = "curr%d_max",
+   [hwmon_curr_lcrit] = "curr%d_lcrit",
+   [hwmon_curr_crit] = "curr%d_crit",
+   [hwmon_curr_average] = "curr%d_average",
+   [hwmon_curr_lowest] = "curr%d_lowest",
+   [hwmon_curr_highest] = "curr%d_highest",
+   [hwmon_curr_reset_history] = "curr%d_reset_history",
+   [hwmon_curr_label] = "curr%d_label",
+   [hwmon_curr_alarm] = "curr%d_alarm",
+   [hwmon_curr_min_alarm] = "curr%d_min_alarm",
+   [hwmon_curr_max_alarm] = "curr%d_max_alarm",
+   [hwmon_curr_lcrit_alarm] = "curr%d_lcrit_alarm",
+   [hwmon_curr_crit_alarm] = "curr%d_crit_alarm",
+};
+
 static const char * const *__templates[] = {
[hwmon_chip] = hwmon_chip_attr_templates,
[hwmon_temp] = hwmon_temp_attr_templates,
[hwmon_in] = hwmon_in_attr_templates,
+   [hwmon_curr] = hwmon_curr_attr_templates,
 };
 
 static const int __templates_size[] = {
[hwmon_chip] = ARRAY_SIZE(hwmon_chip_attr_templates),
[hwmon_temp] = ARRAY_SIZE(hwmon_temp_attr_templates),
[hwmon_in] = ARRAY_SIZE(hwmon_in_attr_templates),
+   [hwmon_curr] = ARRAY_SIZE(hwmon_curr_attr_templates),
 };
 
 static int hwmon_num_channel_attrs(const struct hwmon_channel_info *info)
diff --git a/include/linux/hwmon.h b/include/linux/hwmon.h
index 5e632c0fcbf4..bac3c5dc672f 100644
--- a/include/linux/hwmon.h
+++ b/include/linux/hwmon.h
@@ -31,6 +31,7 @@ enum hwmon_sensor_types {
 enum hwmon_chip_attributes {
hwmon_chip_temp_reset_history,
hwmon_chip_in_reset_history,
+   hwmon_chip_curr_reset_history,
hwmon_chip_register_tz,
hwmon_chip_update_interval,
hwmon_chip_alarms,
@@ -38,6 +39,7 @@ enum hwmon_chip_attributes {
 
 #define HWMON_C_TEMP_RESET_HISTORY BIT(hwmon_chip_temp_reset_history)
 #define HWMON_C_IN_RESET_HISTORY   BIT(hwmon_chip_in_reset_history)
+#define HWMON_C_CURR_RESET_HISTORY BIT(hwmon_chip_curr_reset_history)
 #define HWMON_C_REGISTER_TZBIT(hwmon_chip_register_tz)
 #define HWMON_C_UPDATE_INTERVALBIT(hwmon_chip_update_interval)
 #define HWMON_C_ALARMS BIT(hwmon_chip_alarms)
@@ -126,6 +128,40 @@ enum hwmon_in_attributes {
 #define HWMON_I_LCRIT_ALARMBIT(hwmon_in_lcrit_alarm)
 #define HWMON_I_CRIT_ALARM BIT(hwmon_in_crit_alarm)
 
+enum hwmon_curr_attributes {
+   hwmon_curr_input,
+   hwmon_curr_min,
+   hwmon_curr_max,
+   hwmon_curr_lcrit,
+   hwmon_curr_crit,
+   hwmon_curr_average,
+   hwmon_curr_lowest,
+   hwmon_curr_highest,
+   hwmon_curr_reset_history,
+   hwmon_curr_label,
+   hwmon_curr_alarm,
+   hwmon_curr_min_alarm,
+   hwmon_curr_max_alarm,
+   hwmon_curr_lcrit_alarm,
+   hwmon_curr_crit_alarm,
+};
+
+#define HWMON_C_INPUT  BIT(hwmon_curr_input)
+#define HWMON_C_MINBIT(hwmon_curr_min)
+#define HWMON_C_MAXBIT(hwmon_curr_max)
+#define HWMON_C_LCRIT  BIT(hwmon_curr_lcrit)
+#define HWMON_C_CRIT   BIT(hwmon_curr_crit)
+#define HWMON_C_AVERAGEBIT(hwmon_curr_average)
+#define HWMON_C_LOWEST BIT(hwmon_curr_lowest)
+#define HWMON_C_HIGHESTBIT(hwmon_curr_highest)
+#define HWMON_C_RESET_HISTORY  BIT(hwmon_curr_reset_history)
+#define HWMON_C_LABEL  BIT(hwmon_curr_label)
+#define HWMON_C_ALARM  BIT(hwmon_curr_alarm)
+#define HWMON_C_MIN_ALARM  BIT(hwmon_curr_min_alarm)
+#define HWMON_C_MAX_ALARM  BIT(hwmon_curr_max_alarm)
+#define HWMON_C_LCRIT_ALARMBIT(hwmon_curr_lcrit_alarm)
+#define HWMON_C_CRIT_ALARM BIT(hwmon_curr_crit_alarm)
+
 /**
  * struct hwmon_ops - hwmon device operations
  * @is_visible: Callback to return attribute visibility.
-- 
2.5.0



[PATCH 7/7] hwmon: (core) Document new kernel API

2016-06-25 Thread Guenter Roeck
Describe the new registration API function as well as the data
structures it requires.

Signed-off-by: Guenter Roeck 
---
 Documentation/hwmon/hwmon-kernel-api.txt | 229 ++-
 1 file changed, 227 insertions(+), 2 deletions(-)

diff --git a/Documentation/hwmon/hwmon-kernel-api.txt 
b/Documentation/hwmon/hwmon-kernel-api.txt
index 2ecdbfc85ecf..1a96c36532f2 100644
--- a/Documentation/hwmon/hwmon-kernel-api.txt
+++ b/Documentation/hwmon/hwmon-kernel-api.txt
@@ -34,6 +34,19 @@ devm_hwmon_device_register_with_groups(struct device *dev,
   const char *name, void *drvdata,
   const struct attribute_group **groups);
 
+struct device *
+hwmon_device_register_with_info(struct device *dev,
+   const char *name, void *drvdata,
+   const struct hwmon_chip_info *info,
+   const struct attribute_group **groups);
+
+struct device *
+devm_hwmon_device_register_with_info(struct device *dev,
+const char *name,
+void *drvdata,
+const struct hwmon_chip_info *info,
+const struct attribute_group **groups);
+
 void hwmon_device_unregister(struct device *dev);
 void devm_hwmon_device_unregister(struct device *dev);
 
@@ -60,15 +73,227 @@ devm_hwmon_device_register_with_groups is similar to
 hwmon_device_register_with_groups. However, it is device managed, meaning the
 hwmon device does not have to be removed explicitly by the removal function.
 
+hwmon_device_register_with_info is the most comprehensive and preferred means
+to register a hardware monitoring device. It creates the standard sysfs
+attributes in the hardware monitoring core, letting the driver focus on reading
+from and writing to the chip instead of having to bother with sysfs attributes.
+Its parameters are described in more detail below.
+
+devm_hwmon_device_register_with_info is similar to
+hwmon_device_register_with_info. However, it is device managed, meaning the
+hwmon device does not have to be removed explicitly by the removal function.
+
 hwmon_device_unregister deregisters a registered hardware monitoring device.
 The parameter of this function is the pointer to the registered hardware
 monitoring device structure. This function must be called from the driver
 remove function if the hardware monitoring device was registered with
-hwmon_device_register or with hwmon_device_register_with_groups.
+hwmon_device_register, hwmon_device_register_with_groups, or
+hwmon_device_register_with_info.
 
 devm_hwmon_device_unregister does not normally have to be called. It is only
 needed for error handling, and only needed if the driver probe fails after
-the call to devm_hwmon_device_register_with_groups.
+the call to devm_hwmon_device_register_with_groups and if the automatic
+(device managed) removal would be too late.
+
+Using devm_hwmon_device_register_with_info()
+
+
+hwmon_device_register_with_info() registers a hardware monitoring device.
+The parameters to this function are
+
+struct device *dev Pointer to parent device
+const char *name   Device name
+void *drvdata  Driver private data
+const struct hwmon_chip_info *info
+   Pointer to chip description.
+const struct attribute_group **groups
+   Null-terminated list of additional sysfs attribute
+   groups.
+
+This function returns a pointer to the created hardware monitoring device
+on success and a negative error code for failure.
+
+The hwmon_chip_info structure looks as follows.
+
+struct hwmon_chip_info {
+   const struct hwmon_ops *ops;
+   const struct hwmon_channel_info **info;
+};
+
+It contains the following fields:
+
+* ops: Pointer to device operations.
+* info: NULL-terminated list of device channel descriptors.
+
+The list of hwmon operations is defined as:
+
+struct hwmon_ops {
+   umode_t (*is_visible)(const void *, enum hwmon_sensor_types type,
+ u32 attr, int);
+   int (*read)(struct device *, enum hwmon_sensor_types type,
+   u32 attr, int, long *);
+   int (*write)(struct device *, enum hwmon_sensor_types type,
+u32 attr, int, long);
+};
+
+It defines the following operations.
+
+* is_visible: Pointer to a function to return the file mode for each supported
+  attribute. This function is mandatory.
+
+* read: Pointer to a function for reading a value from the chip. This function
+  is optional, but must be provided if any readable attributes exist.
+
+* write: Pointer to a function for writing a value to the chip. This function 
is
+  optional, but must be priovided if any writeable attributes exist.
+
+Each sensor channel is described with struct hwmon_channel_info, 

[PATCH 3/7] hwmon: (core) Add current attribute support to new API

2016-06-25 Thread Guenter Roeck
Signed-off-by: Guenter Roeck 
---
 drivers/hwmon/hwmon.c | 21 +
 include/linux/hwmon.h | 36 
 2 files changed, 57 insertions(+)

diff --git a/drivers/hwmon/hwmon.c b/drivers/hwmon/hwmon.c
index d2916074befd..8c3c7ffe828b 100644
--- a/drivers/hwmon/hwmon.c
+++ b/drivers/hwmon/hwmon.c
@@ -251,6 +251,7 @@ static struct attribute *hwmon_genattr(struct device *dev,
 static const char * const hwmon_chip_attr_templates[] = {
[hwmon_chip_temp_reset_history] = "temp_reset_history",
[hwmon_chip_in_reset_history] = "in_reset_history",
+   [hwmon_chip_curr_reset_history] = "curr_reset_history",
[hwmon_chip_update_interval] = "update_interval",
[hwmon_chip_alarms] = "alarms",
 };
@@ -300,16 +301,36 @@ static const char * const hwmon_in_attr_templates[] = {
[hwmon_in_crit_alarm] = "in%d_crit_alarm",
 };
 
+static const char * const hwmon_curr_attr_templates[] = {
+   [hwmon_curr_input] = "curr%d_input",
+   [hwmon_curr_min] = "curr%d_min",
+   [hwmon_curr_max] = "curr%d_max",
+   [hwmon_curr_lcrit] = "curr%d_lcrit",
+   [hwmon_curr_crit] = "curr%d_crit",
+   [hwmon_curr_average] = "curr%d_average",
+   [hwmon_curr_lowest] = "curr%d_lowest",
+   [hwmon_curr_highest] = "curr%d_highest",
+   [hwmon_curr_reset_history] = "curr%d_reset_history",
+   [hwmon_curr_label] = "curr%d_label",
+   [hwmon_curr_alarm] = "curr%d_alarm",
+   [hwmon_curr_min_alarm] = "curr%d_min_alarm",
+   [hwmon_curr_max_alarm] = "curr%d_max_alarm",
+   [hwmon_curr_lcrit_alarm] = "curr%d_lcrit_alarm",
+   [hwmon_curr_crit_alarm] = "curr%d_crit_alarm",
+};
+
 static const char * const *__templates[] = {
[hwmon_chip] = hwmon_chip_attr_templates,
[hwmon_temp] = hwmon_temp_attr_templates,
[hwmon_in] = hwmon_in_attr_templates,
+   [hwmon_curr] = hwmon_curr_attr_templates,
 };
 
 static const int __templates_size[] = {
[hwmon_chip] = ARRAY_SIZE(hwmon_chip_attr_templates),
[hwmon_temp] = ARRAY_SIZE(hwmon_temp_attr_templates),
[hwmon_in] = ARRAY_SIZE(hwmon_in_attr_templates),
+   [hwmon_curr] = ARRAY_SIZE(hwmon_curr_attr_templates),
 };
 
 static int hwmon_num_channel_attrs(const struct hwmon_channel_info *info)
diff --git a/include/linux/hwmon.h b/include/linux/hwmon.h
index 5e632c0fcbf4..bac3c5dc672f 100644
--- a/include/linux/hwmon.h
+++ b/include/linux/hwmon.h
@@ -31,6 +31,7 @@ enum hwmon_sensor_types {
 enum hwmon_chip_attributes {
hwmon_chip_temp_reset_history,
hwmon_chip_in_reset_history,
+   hwmon_chip_curr_reset_history,
hwmon_chip_register_tz,
hwmon_chip_update_interval,
hwmon_chip_alarms,
@@ -38,6 +39,7 @@ enum hwmon_chip_attributes {
 
 #define HWMON_C_TEMP_RESET_HISTORY BIT(hwmon_chip_temp_reset_history)
 #define HWMON_C_IN_RESET_HISTORY   BIT(hwmon_chip_in_reset_history)
+#define HWMON_C_CURR_RESET_HISTORY BIT(hwmon_chip_curr_reset_history)
 #define HWMON_C_REGISTER_TZBIT(hwmon_chip_register_tz)
 #define HWMON_C_UPDATE_INTERVALBIT(hwmon_chip_update_interval)
 #define HWMON_C_ALARMS BIT(hwmon_chip_alarms)
@@ -126,6 +128,40 @@ enum hwmon_in_attributes {
 #define HWMON_I_LCRIT_ALARMBIT(hwmon_in_lcrit_alarm)
 #define HWMON_I_CRIT_ALARM BIT(hwmon_in_crit_alarm)
 
+enum hwmon_curr_attributes {
+   hwmon_curr_input,
+   hwmon_curr_min,
+   hwmon_curr_max,
+   hwmon_curr_lcrit,
+   hwmon_curr_crit,
+   hwmon_curr_average,
+   hwmon_curr_lowest,
+   hwmon_curr_highest,
+   hwmon_curr_reset_history,
+   hwmon_curr_label,
+   hwmon_curr_alarm,
+   hwmon_curr_min_alarm,
+   hwmon_curr_max_alarm,
+   hwmon_curr_lcrit_alarm,
+   hwmon_curr_crit_alarm,
+};
+
+#define HWMON_C_INPUT  BIT(hwmon_curr_input)
+#define HWMON_C_MINBIT(hwmon_curr_min)
+#define HWMON_C_MAXBIT(hwmon_curr_max)
+#define HWMON_C_LCRIT  BIT(hwmon_curr_lcrit)
+#define HWMON_C_CRIT   BIT(hwmon_curr_crit)
+#define HWMON_C_AVERAGEBIT(hwmon_curr_average)
+#define HWMON_C_LOWEST BIT(hwmon_curr_lowest)
+#define HWMON_C_HIGHESTBIT(hwmon_curr_highest)
+#define HWMON_C_RESET_HISTORY  BIT(hwmon_curr_reset_history)
+#define HWMON_C_LABEL  BIT(hwmon_curr_label)
+#define HWMON_C_ALARM  BIT(hwmon_curr_alarm)
+#define HWMON_C_MIN_ALARM  BIT(hwmon_curr_min_alarm)
+#define HWMON_C_MAX_ALARM  BIT(hwmon_curr_max_alarm)
+#define HWMON_C_LCRIT_ALARMBIT(hwmon_curr_lcrit_alarm)
+#define HWMON_C_CRIT_ALARM BIT(hwmon_curr_crit_alarm)
+
 /**
  * struct hwmon_ops - hwmon device operations
  * @is_visible: Callback to return attribute visibility.
-- 
2.5.0



[PATCH 6/7] hwmon: (core) Add fan attribute support to new API

2016-06-25 Thread Guenter Roeck
Signed-off-by: Guenter Roeck 
---
 drivers/hwmon/hwmon.c | 16 
 include/linux/hwmon.h | 27 +++
 2 files changed, 43 insertions(+)

diff --git a/drivers/hwmon/hwmon.c b/drivers/hwmon/hwmon.c
index 363ec5660d0c..ca18a6f4f9bc 100644
--- a/drivers/hwmon/hwmon.c
+++ b/drivers/hwmon/hwmon.c
@@ -363,6 +363,20 @@ static const char * const hwmon_humidity_attr_templates[] 
= {
[hwmon_humidity_fault] = "humidity%d_fault",
 };
 
+static const char * const hwmon_fan_attr_templates[] = {
+   [hwmon_fan_input] = "fan%d_input",
+   [hwmon_fan_label] = "fan%d_label",
+   [hwmon_fan_min] = "fan%d_min",
+   [hwmon_fan_max] = "fan%d_max",
+   [hwmon_fan_div] = "fan%d_div",
+   [hwmon_fan_pulses] = "fan%d_pulses",
+   [hwmon_fan_target] = "fan%d_target",
+   [hwmon_fan_alarm] = "fan%d_alarm",
+   [hwmon_fan_min_alarm] = "fan%d_min_alarm",
+   [hwmon_fan_max_alarm] = "fan%d_max_alarm",
+   [hwmon_fan_fault] = "fan%d_fault",
+};
+
 static const char * const *__templates[] = {
[hwmon_chip] = hwmon_chip_attr_templates,
[hwmon_temp] = hwmon_temp_attr_templates,
@@ -371,6 +385,7 @@ static const char * const *__templates[] = {
[hwmon_power] = hwmon_power_attr_templates,
[hwmon_energy] = hwmon_energy_attr_templates,
[hwmon_humidity] = hwmon_humidity_attr_templates,
+   [hwmon_fan] = hwmon_fan_attr_templates,
 };
 
 static const int __templates_size[] = {
@@ -381,6 +396,7 @@ static const int __templates_size[] = {
[hwmon_power] = ARRAY_SIZE(hwmon_power_attr_templates),
[hwmon_energy] = ARRAY_SIZE(hwmon_energy_attr_templates),
[hwmon_humidity] = ARRAY_SIZE(hwmon_humidity_attr_templates),
+   [hwmon_fan] = ARRAY_SIZE(hwmon_fan_attr_templates),
 };
 
 static int hwmon_num_channel_attrs(const struct hwmon_channel_info *info)
diff --git a/include/linux/hwmon.h b/include/linux/hwmon.h
index a0b82027ae07..b2fdaaa7b7ba 100644
--- a/include/linux/hwmon.h
+++ b/include/linux/hwmon.h
@@ -27,6 +27,7 @@ enum hwmon_sensor_types {
hwmon_power,
hwmon_energy,
hwmon_humidity,
+   hwmon_fan,
 };
 
 enum hwmon_chip_attributes {
@@ -245,6 +246,32 @@ enum hwmon_humidity_attributes {
 #define HWMON_H_ALARM  BIT(hwmon_humidity_alarm)
 #define HWMON_H_FAULT  BIT(hwmon_humidity_fault)
 
+enum hwmon_fan_attributes {
+   hwmon_fan_input,
+   hwmon_fan_label,
+   hwmon_fan_min,
+   hwmon_fan_max,
+   hwmon_fan_div,
+   hwmon_fan_pulses,
+   hwmon_fan_target,
+   hwmon_fan_alarm,
+   hwmon_fan_min_alarm,
+   hwmon_fan_max_alarm,
+   hwmon_fan_fault,
+};
+
+#define HWMON_F_INPUT  BIT(hwmon_fan_input)
+#define HWMON_F_LABEL  BIT(hwmon_fan_label)
+#define HWMON_F_MINBIT(hwmon_fan_min)
+#define HWMON_F_MAXBIT(hwmon_fan_max)
+#define HWMON_F_DIVBIT(hwmon_fan_div)
+#define HWMON_F_PULSES BIT(hwmon_fan_pulses)
+#define HWMON_F_TARGET BIT(hwmon_fan_target)
+#define HWMON_F_ALARM  BIT(hwmon_fan_alarm)
+#define HWMON_F_MIN_ALARM  BIT(hwmon_fan_min_alarm)
+#define HWMON_F_MAX_ALARM  BIT(hwmon_fan_max_alarm)
+#define HWMON_F_FAULT  BIT(hwmon_fan_fault)
+
 /**
  * struct hwmon_ops - hwmon device operations
  * @is_visible: Callback to return attribute visibility.
-- 
2.5.0



[PATCH 4/7] hwmon: (core) Add power attribute support to new API

2016-06-25 Thread Guenter Roeck
Signed-off-by: Guenter Roeck 
---
 drivers/hwmon/hwmon.c | 30 
 include/linux/hwmon.h | 54 +++
 2 files changed, 84 insertions(+)

diff --git a/drivers/hwmon/hwmon.c b/drivers/hwmon/hwmon.c
index 8c3c7ffe828b..dff07e8f9509 100644
--- a/drivers/hwmon/hwmon.c
+++ b/drivers/hwmon/hwmon.c
@@ -252,6 +252,7 @@ static const char * const hwmon_chip_attr_templates[] = {
[hwmon_chip_temp_reset_history] = "temp_reset_history",
[hwmon_chip_in_reset_history] = "in_reset_history",
[hwmon_chip_curr_reset_history] = "curr_reset_history",
+   [hwmon_chip_power_reset_history] = "power_reset_history",
[hwmon_chip_update_interval] = "update_interval",
[hwmon_chip_alarms] = "alarms",
 };
@@ -319,11 +320,39 @@ static const char * const hwmon_curr_attr_templates[] = {
[hwmon_curr_crit_alarm] = "curr%d_crit_alarm",
 };
 
+static const char * const hwmon_power_attr_templates[] = {
+   [hwmon_power_average] = "power%d_average",
+   [hwmon_power_average_interval] = "power%d_average_interval",
+   [hwmon_power_average_interval_max] = "power%d_interval_max",
+   [hwmon_power_average_interval_min] = "power%d_interval_min",
+   [hwmon_power_average_highest] = "power%d_average_highest",
+   [hwmon_power_average_lowest] = "power%d_average_lowest",
+   [hwmon_power_average_max] = "power%d_average_max",
+   [hwmon_power_average_min] = "power%d_average_min",
+   [hwmon_power_input] = "power%d_input",
+   [hwmon_power_input_highest] = "power%d_input_highest",
+   [hwmon_power_input_lowest] = "power%d_input_lowest",
+   [hwmon_power_reset_history] = "power%d_reset_history",
+   [hwmon_power_accuracy] = "power%d_accuracy",
+   [hwmon_power_cap] = "power%d_cap",
+   [hwmon_power_cap_hyst] = "power%d_cap_hyst",
+   [hwmon_power_cap_max] = "power%d_cap_max",
+   [hwmon_power_cap_min] = "power%d_cap_min",
+   [hwmon_power_max] = "power%d_max",
+   [hwmon_power_crit] = "power%d_crit",
+   [hwmon_power_label] = "power%d_label",
+   [hwmon_power_alarm] = "power%d_alarm",
+   [hwmon_power_cap_alarm] = "power%d_cap_alarm",
+   [hwmon_power_max_alarm] = "power%d_max_alarm",
+   [hwmon_power_crit_alarm] = "power%d_crit_alarm",
+};
+
 static const char * const *__templates[] = {
[hwmon_chip] = hwmon_chip_attr_templates,
[hwmon_temp] = hwmon_temp_attr_templates,
[hwmon_in] = hwmon_in_attr_templates,
[hwmon_curr] = hwmon_curr_attr_templates,
+   [hwmon_power] = hwmon_power_attr_templates,
 };
 
 static const int __templates_size[] = {
@@ -331,6 +360,7 @@ static const int __templates_size[] = {
[hwmon_temp] = ARRAY_SIZE(hwmon_temp_attr_templates),
[hwmon_in] = ARRAY_SIZE(hwmon_in_attr_templates),
[hwmon_curr] = ARRAY_SIZE(hwmon_curr_attr_templates),
+   [hwmon_power] = ARRAY_SIZE(hwmon_power_attr_templates),
 };
 
 static int hwmon_num_channel_attrs(const struct hwmon_channel_info *info)
diff --git a/include/linux/hwmon.h b/include/linux/hwmon.h
index bac3c5dc672f..4de6e2af29ea 100644
--- a/include/linux/hwmon.h
+++ b/include/linux/hwmon.h
@@ -32,6 +32,7 @@ enum hwmon_chip_attributes {
hwmon_chip_temp_reset_history,
hwmon_chip_in_reset_history,
hwmon_chip_curr_reset_history,
+   hwmon_chip_power_reset_history,
hwmon_chip_register_tz,
hwmon_chip_update_interval,
hwmon_chip_alarms,
@@ -40,6 +41,7 @@ enum hwmon_chip_attributes {
 #define HWMON_C_TEMP_RESET_HISTORY BIT(hwmon_chip_temp_reset_history)
 #define HWMON_C_IN_RESET_HISTORY   BIT(hwmon_chip_in_reset_history)
 #define HWMON_C_CURR_RESET_HISTORY BIT(hwmon_chip_curr_reset_history)
+#define HWMON_C_POWER_RESET_HISTORYBIT(hwmon_chip_power_reset_history)
 #define HWMON_C_REGISTER_TZBIT(hwmon_chip_register_tz)
 #define HWMON_C_UPDATE_INTERVALBIT(hwmon_chip_update_interval)
 #define HWMON_C_ALARMS BIT(hwmon_chip_alarms)
@@ -162,6 +164,58 @@ enum hwmon_curr_attributes {
 #define HWMON_C_LCRIT_ALARMBIT(hwmon_curr_lcrit_alarm)
 #define HWMON_C_CRIT_ALARM BIT(hwmon_curr_crit_alarm)
 
+enum hwmon_power_attributes {
+   hwmon_power_average,
+   hwmon_power_average_interval,
+   hwmon_power_average_interval_max,
+   hwmon_power_average_interval_min,
+   hwmon_power_average_highest,
+   hwmon_power_average_lowest,
+   hwmon_power_average_max,
+   hwmon_power_average_min,
+   hwmon_power_input,
+   hwmon_power_input_highest,
+   hwmon_power_input_lowest,
+   hwmon_power_reset_history,
+   hwmon_power_accuracy,
+   hwmon_power_cap,
+   hwmon_power_cap_hyst,
+   hwmon_power_cap_max,
+   hwmon_power_cap_min,
+   hwmon_power_max,
+   hwmon_power_crit,
+   hwmon_power_label,
+   hwmon_power_alarm,
+   

[PATCH 5/7] hwmon: (core) Add energy and humidity attribute support to new API

2016-06-25 Thread Guenter Roeck
Signed-off-by: Guenter Roeck 
---
 drivers/hwmon/hwmon.c | 20 
 include/linux/hwmon.h | 29 +
 2 files changed, 49 insertions(+)

diff --git a/drivers/hwmon/hwmon.c b/drivers/hwmon/hwmon.c
index dff07e8f9509..363ec5660d0c 100644
--- a/drivers/hwmon/hwmon.c
+++ b/drivers/hwmon/hwmon.c
@@ -347,12 +347,30 @@ static const char * const hwmon_power_attr_templates[] = {
[hwmon_power_crit_alarm] = "power%d_crit_alarm",
 };
 
+static const char * const hwmon_energy_attr_templates[] = {
+   [hwmon_energy_input] = "energy%d_input",
+   [hwmon_energy_label] = "energy%d_label",
+};
+
+static const char * const hwmon_humidity_attr_templates[] = {
+   [hwmon_humidity_input] = "humidity%d_input",
+   [hwmon_humidity_label] = "humidity%d_label",
+   [hwmon_humidity_min] = "humidity%d_min",
+   [hwmon_humidity_min_hyst] = "humidity%d_min_hyst",
+   [hwmon_humidity_max] = "humidity%d_max",
+   [hwmon_humidity_max_hyst] = "humidity%d_max_hyst",
+   [hwmon_humidity_alarm] = "humidity%d_alarm",
+   [hwmon_humidity_fault] = "humidity%d_fault",
+};
+
 static const char * const *__templates[] = {
[hwmon_chip] = hwmon_chip_attr_templates,
[hwmon_temp] = hwmon_temp_attr_templates,
[hwmon_in] = hwmon_in_attr_templates,
[hwmon_curr] = hwmon_curr_attr_templates,
[hwmon_power] = hwmon_power_attr_templates,
+   [hwmon_energy] = hwmon_energy_attr_templates,
+   [hwmon_humidity] = hwmon_humidity_attr_templates,
 };
 
 static const int __templates_size[] = {
@@ -361,6 +379,8 @@ static const int __templates_size[] = {
[hwmon_in] = ARRAY_SIZE(hwmon_in_attr_templates),
[hwmon_curr] = ARRAY_SIZE(hwmon_curr_attr_templates),
[hwmon_power] = ARRAY_SIZE(hwmon_power_attr_templates),
+   [hwmon_energy] = ARRAY_SIZE(hwmon_energy_attr_templates),
+   [hwmon_humidity] = ARRAY_SIZE(hwmon_humidity_attr_templates),
 };
 
 static int hwmon_num_channel_attrs(const struct hwmon_channel_info *info)
diff --git a/include/linux/hwmon.h b/include/linux/hwmon.h
index 4de6e2af29ea..a0b82027ae07 100644
--- a/include/linux/hwmon.h
+++ b/include/linux/hwmon.h
@@ -26,6 +26,7 @@ enum hwmon_sensor_types {
hwmon_curr,
hwmon_power,
hwmon_energy,
+   hwmon_humidity,
 };
 
 enum hwmon_chip_attributes {
@@ -216,6 +217,34 @@ enum hwmon_power_attributes {
 #define HWMON_P_MAX_ALARM  BIT(hwmon_power_max_alarm)
 #define HWMON_P_CRIT_ALARM BIT(hwmon_power_crit_alarm)
 
+enum hwmon_energy_attributes {
+   hwmon_energy_input,
+   hwmon_energy_label,
+};
+
+#define HWMON_E_INPUT  BIT(hwmon_energy_input)
+#define HWMON_E_LABEL  BIT(hwmon_energy_label)
+
+enum hwmon_humidity_attributes {
+   hwmon_humidity_input,
+   hwmon_humidity_label,
+   hwmon_humidity_min,
+   hwmon_humidity_min_hyst,
+   hwmon_humidity_max,
+   hwmon_humidity_max_hyst,
+   hwmon_humidity_alarm,
+   hwmon_humidity_fault,
+};
+
+#define HWMON_H_INPUT  BIT(hwmon_humidity_input)
+#define HWMON_H_LABEL  BIT(hwmon_humidity_label)
+#define HWMON_H_MINBIT(hwmon_humidity_min)
+#define HWMON_H_MIN_HYST   BIT(hwmon_humidity_min_hyst)
+#define HWMON_H_MAXBIT(hwmon_humidity_max)
+#define HWMON_H_MAX_HYST   BIT(hwmon_humidity_max_hyst)
+#define HWMON_H_ALARM  BIT(hwmon_humidity_alarm)
+#define HWMON_H_FAULT  BIT(hwmon_humidity_fault)
+
 /**
  * struct hwmon_ops - hwmon device operations
  * @is_visible: Callback to return attribute visibility.
-- 
2.5.0



[PATCH 6/7] hwmon: (core) Add fan attribute support to new API

2016-06-25 Thread Guenter Roeck
Signed-off-by: Guenter Roeck 
---
 drivers/hwmon/hwmon.c | 16 
 include/linux/hwmon.h | 27 +++
 2 files changed, 43 insertions(+)

diff --git a/drivers/hwmon/hwmon.c b/drivers/hwmon/hwmon.c
index 363ec5660d0c..ca18a6f4f9bc 100644
--- a/drivers/hwmon/hwmon.c
+++ b/drivers/hwmon/hwmon.c
@@ -363,6 +363,20 @@ static const char * const hwmon_humidity_attr_templates[] 
= {
[hwmon_humidity_fault] = "humidity%d_fault",
 };
 
+static const char * const hwmon_fan_attr_templates[] = {
+   [hwmon_fan_input] = "fan%d_input",
+   [hwmon_fan_label] = "fan%d_label",
+   [hwmon_fan_min] = "fan%d_min",
+   [hwmon_fan_max] = "fan%d_max",
+   [hwmon_fan_div] = "fan%d_div",
+   [hwmon_fan_pulses] = "fan%d_pulses",
+   [hwmon_fan_target] = "fan%d_target",
+   [hwmon_fan_alarm] = "fan%d_alarm",
+   [hwmon_fan_min_alarm] = "fan%d_min_alarm",
+   [hwmon_fan_max_alarm] = "fan%d_max_alarm",
+   [hwmon_fan_fault] = "fan%d_fault",
+};
+
 static const char * const *__templates[] = {
[hwmon_chip] = hwmon_chip_attr_templates,
[hwmon_temp] = hwmon_temp_attr_templates,
@@ -371,6 +385,7 @@ static const char * const *__templates[] = {
[hwmon_power] = hwmon_power_attr_templates,
[hwmon_energy] = hwmon_energy_attr_templates,
[hwmon_humidity] = hwmon_humidity_attr_templates,
+   [hwmon_fan] = hwmon_fan_attr_templates,
 };
 
 static const int __templates_size[] = {
@@ -381,6 +396,7 @@ static const int __templates_size[] = {
[hwmon_power] = ARRAY_SIZE(hwmon_power_attr_templates),
[hwmon_energy] = ARRAY_SIZE(hwmon_energy_attr_templates),
[hwmon_humidity] = ARRAY_SIZE(hwmon_humidity_attr_templates),
+   [hwmon_fan] = ARRAY_SIZE(hwmon_fan_attr_templates),
 };
 
 static int hwmon_num_channel_attrs(const struct hwmon_channel_info *info)
diff --git a/include/linux/hwmon.h b/include/linux/hwmon.h
index a0b82027ae07..b2fdaaa7b7ba 100644
--- a/include/linux/hwmon.h
+++ b/include/linux/hwmon.h
@@ -27,6 +27,7 @@ enum hwmon_sensor_types {
hwmon_power,
hwmon_energy,
hwmon_humidity,
+   hwmon_fan,
 };
 
 enum hwmon_chip_attributes {
@@ -245,6 +246,32 @@ enum hwmon_humidity_attributes {
 #define HWMON_H_ALARM  BIT(hwmon_humidity_alarm)
 #define HWMON_H_FAULT  BIT(hwmon_humidity_fault)
 
+enum hwmon_fan_attributes {
+   hwmon_fan_input,
+   hwmon_fan_label,
+   hwmon_fan_min,
+   hwmon_fan_max,
+   hwmon_fan_div,
+   hwmon_fan_pulses,
+   hwmon_fan_target,
+   hwmon_fan_alarm,
+   hwmon_fan_min_alarm,
+   hwmon_fan_max_alarm,
+   hwmon_fan_fault,
+};
+
+#define HWMON_F_INPUT  BIT(hwmon_fan_input)
+#define HWMON_F_LABEL  BIT(hwmon_fan_label)
+#define HWMON_F_MINBIT(hwmon_fan_min)
+#define HWMON_F_MAXBIT(hwmon_fan_max)
+#define HWMON_F_DIVBIT(hwmon_fan_div)
+#define HWMON_F_PULSES BIT(hwmon_fan_pulses)
+#define HWMON_F_TARGET BIT(hwmon_fan_target)
+#define HWMON_F_ALARM  BIT(hwmon_fan_alarm)
+#define HWMON_F_MIN_ALARM  BIT(hwmon_fan_min_alarm)
+#define HWMON_F_MAX_ALARM  BIT(hwmon_fan_max_alarm)
+#define HWMON_F_FAULT  BIT(hwmon_fan_fault)
+
 /**
  * struct hwmon_ops - hwmon device operations
  * @is_visible: Callback to return attribute visibility.
-- 
2.5.0



[PATCH 4/7] hwmon: (core) Add power attribute support to new API

2016-06-25 Thread Guenter Roeck
Signed-off-by: Guenter Roeck 
---
 drivers/hwmon/hwmon.c | 30 
 include/linux/hwmon.h | 54 +++
 2 files changed, 84 insertions(+)

diff --git a/drivers/hwmon/hwmon.c b/drivers/hwmon/hwmon.c
index 8c3c7ffe828b..dff07e8f9509 100644
--- a/drivers/hwmon/hwmon.c
+++ b/drivers/hwmon/hwmon.c
@@ -252,6 +252,7 @@ static const char * const hwmon_chip_attr_templates[] = {
[hwmon_chip_temp_reset_history] = "temp_reset_history",
[hwmon_chip_in_reset_history] = "in_reset_history",
[hwmon_chip_curr_reset_history] = "curr_reset_history",
+   [hwmon_chip_power_reset_history] = "power_reset_history",
[hwmon_chip_update_interval] = "update_interval",
[hwmon_chip_alarms] = "alarms",
 };
@@ -319,11 +320,39 @@ static const char * const hwmon_curr_attr_templates[] = {
[hwmon_curr_crit_alarm] = "curr%d_crit_alarm",
 };
 
+static const char * const hwmon_power_attr_templates[] = {
+   [hwmon_power_average] = "power%d_average",
+   [hwmon_power_average_interval] = "power%d_average_interval",
+   [hwmon_power_average_interval_max] = "power%d_interval_max",
+   [hwmon_power_average_interval_min] = "power%d_interval_min",
+   [hwmon_power_average_highest] = "power%d_average_highest",
+   [hwmon_power_average_lowest] = "power%d_average_lowest",
+   [hwmon_power_average_max] = "power%d_average_max",
+   [hwmon_power_average_min] = "power%d_average_min",
+   [hwmon_power_input] = "power%d_input",
+   [hwmon_power_input_highest] = "power%d_input_highest",
+   [hwmon_power_input_lowest] = "power%d_input_lowest",
+   [hwmon_power_reset_history] = "power%d_reset_history",
+   [hwmon_power_accuracy] = "power%d_accuracy",
+   [hwmon_power_cap] = "power%d_cap",
+   [hwmon_power_cap_hyst] = "power%d_cap_hyst",
+   [hwmon_power_cap_max] = "power%d_cap_max",
+   [hwmon_power_cap_min] = "power%d_cap_min",
+   [hwmon_power_max] = "power%d_max",
+   [hwmon_power_crit] = "power%d_crit",
+   [hwmon_power_label] = "power%d_label",
+   [hwmon_power_alarm] = "power%d_alarm",
+   [hwmon_power_cap_alarm] = "power%d_cap_alarm",
+   [hwmon_power_max_alarm] = "power%d_max_alarm",
+   [hwmon_power_crit_alarm] = "power%d_crit_alarm",
+};
+
 static const char * const *__templates[] = {
[hwmon_chip] = hwmon_chip_attr_templates,
[hwmon_temp] = hwmon_temp_attr_templates,
[hwmon_in] = hwmon_in_attr_templates,
[hwmon_curr] = hwmon_curr_attr_templates,
+   [hwmon_power] = hwmon_power_attr_templates,
 };
 
 static const int __templates_size[] = {
@@ -331,6 +360,7 @@ static const int __templates_size[] = {
[hwmon_temp] = ARRAY_SIZE(hwmon_temp_attr_templates),
[hwmon_in] = ARRAY_SIZE(hwmon_in_attr_templates),
[hwmon_curr] = ARRAY_SIZE(hwmon_curr_attr_templates),
+   [hwmon_power] = ARRAY_SIZE(hwmon_power_attr_templates),
 };
 
 static int hwmon_num_channel_attrs(const struct hwmon_channel_info *info)
diff --git a/include/linux/hwmon.h b/include/linux/hwmon.h
index bac3c5dc672f..4de6e2af29ea 100644
--- a/include/linux/hwmon.h
+++ b/include/linux/hwmon.h
@@ -32,6 +32,7 @@ enum hwmon_chip_attributes {
hwmon_chip_temp_reset_history,
hwmon_chip_in_reset_history,
hwmon_chip_curr_reset_history,
+   hwmon_chip_power_reset_history,
hwmon_chip_register_tz,
hwmon_chip_update_interval,
hwmon_chip_alarms,
@@ -40,6 +41,7 @@ enum hwmon_chip_attributes {
 #define HWMON_C_TEMP_RESET_HISTORY BIT(hwmon_chip_temp_reset_history)
 #define HWMON_C_IN_RESET_HISTORY   BIT(hwmon_chip_in_reset_history)
 #define HWMON_C_CURR_RESET_HISTORY BIT(hwmon_chip_curr_reset_history)
+#define HWMON_C_POWER_RESET_HISTORYBIT(hwmon_chip_power_reset_history)
 #define HWMON_C_REGISTER_TZBIT(hwmon_chip_register_tz)
 #define HWMON_C_UPDATE_INTERVALBIT(hwmon_chip_update_interval)
 #define HWMON_C_ALARMS BIT(hwmon_chip_alarms)
@@ -162,6 +164,58 @@ enum hwmon_curr_attributes {
 #define HWMON_C_LCRIT_ALARMBIT(hwmon_curr_lcrit_alarm)
 #define HWMON_C_CRIT_ALARM BIT(hwmon_curr_crit_alarm)
 
+enum hwmon_power_attributes {
+   hwmon_power_average,
+   hwmon_power_average_interval,
+   hwmon_power_average_interval_max,
+   hwmon_power_average_interval_min,
+   hwmon_power_average_highest,
+   hwmon_power_average_lowest,
+   hwmon_power_average_max,
+   hwmon_power_average_min,
+   hwmon_power_input,
+   hwmon_power_input_highest,
+   hwmon_power_input_lowest,
+   hwmon_power_reset_history,
+   hwmon_power_accuracy,
+   hwmon_power_cap,
+   hwmon_power_cap_hyst,
+   hwmon_power_cap_max,
+   hwmon_power_cap_min,
+   hwmon_power_max,
+   hwmon_power_crit,
+   hwmon_power_label,
+   hwmon_power_alarm,
+   hwmon_power_cap_alarm,
+   

[PATCH 5/7] hwmon: (core) Add energy and humidity attribute support to new API

2016-06-25 Thread Guenter Roeck
Signed-off-by: Guenter Roeck 
---
 drivers/hwmon/hwmon.c | 20 
 include/linux/hwmon.h | 29 +
 2 files changed, 49 insertions(+)

diff --git a/drivers/hwmon/hwmon.c b/drivers/hwmon/hwmon.c
index dff07e8f9509..363ec5660d0c 100644
--- a/drivers/hwmon/hwmon.c
+++ b/drivers/hwmon/hwmon.c
@@ -347,12 +347,30 @@ static const char * const hwmon_power_attr_templates[] = {
[hwmon_power_crit_alarm] = "power%d_crit_alarm",
 };
 
+static const char * const hwmon_energy_attr_templates[] = {
+   [hwmon_energy_input] = "energy%d_input",
+   [hwmon_energy_label] = "energy%d_label",
+};
+
+static const char * const hwmon_humidity_attr_templates[] = {
+   [hwmon_humidity_input] = "humidity%d_input",
+   [hwmon_humidity_label] = "humidity%d_label",
+   [hwmon_humidity_min] = "humidity%d_min",
+   [hwmon_humidity_min_hyst] = "humidity%d_min_hyst",
+   [hwmon_humidity_max] = "humidity%d_max",
+   [hwmon_humidity_max_hyst] = "humidity%d_max_hyst",
+   [hwmon_humidity_alarm] = "humidity%d_alarm",
+   [hwmon_humidity_fault] = "humidity%d_fault",
+};
+
 static const char * const *__templates[] = {
[hwmon_chip] = hwmon_chip_attr_templates,
[hwmon_temp] = hwmon_temp_attr_templates,
[hwmon_in] = hwmon_in_attr_templates,
[hwmon_curr] = hwmon_curr_attr_templates,
[hwmon_power] = hwmon_power_attr_templates,
+   [hwmon_energy] = hwmon_energy_attr_templates,
+   [hwmon_humidity] = hwmon_humidity_attr_templates,
 };
 
 static const int __templates_size[] = {
@@ -361,6 +379,8 @@ static const int __templates_size[] = {
[hwmon_in] = ARRAY_SIZE(hwmon_in_attr_templates),
[hwmon_curr] = ARRAY_SIZE(hwmon_curr_attr_templates),
[hwmon_power] = ARRAY_SIZE(hwmon_power_attr_templates),
+   [hwmon_energy] = ARRAY_SIZE(hwmon_energy_attr_templates),
+   [hwmon_humidity] = ARRAY_SIZE(hwmon_humidity_attr_templates),
 };
 
 static int hwmon_num_channel_attrs(const struct hwmon_channel_info *info)
diff --git a/include/linux/hwmon.h b/include/linux/hwmon.h
index 4de6e2af29ea..a0b82027ae07 100644
--- a/include/linux/hwmon.h
+++ b/include/linux/hwmon.h
@@ -26,6 +26,7 @@ enum hwmon_sensor_types {
hwmon_curr,
hwmon_power,
hwmon_energy,
+   hwmon_humidity,
 };
 
 enum hwmon_chip_attributes {
@@ -216,6 +217,34 @@ enum hwmon_power_attributes {
 #define HWMON_P_MAX_ALARM  BIT(hwmon_power_max_alarm)
 #define HWMON_P_CRIT_ALARM BIT(hwmon_power_crit_alarm)
 
+enum hwmon_energy_attributes {
+   hwmon_energy_input,
+   hwmon_energy_label,
+};
+
+#define HWMON_E_INPUT  BIT(hwmon_energy_input)
+#define HWMON_E_LABEL  BIT(hwmon_energy_label)
+
+enum hwmon_humidity_attributes {
+   hwmon_humidity_input,
+   hwmon_humidity_label,
+   hwmon_humidity_min,
+   hwmon_humidity_min_hyst,
+   hwmon_humidity_max,
+   hwmon_humidity_max_hyst,
+   hwmon_humidity_alarm,
+   hwmon_humidity_fault,
+};
+
+#define HWMON_H_INPUT  BIT(hwmon_humidity_input)
+#define HWMON_H_LABEL  BIT(hwmon_humidity_label)
+#define HWMON_H_MINBIT(hwmon_humidity_min)
+#define HWMON_H_MIN_HYST   BIT(hwmon_humidity_min_hyst)
+#define HWMON_H_MAXBIT(hwmon_humidity_max)
+#define HWMON_H_MAX_HYST   BIT(hwmon_humidity_max_hyst)
+#define HWMON_H_ALARM  BIT(hwmon_humidity_alarm)
+#define HWMON_H_FAULT  BIT(hwmon_humidity_fault)
+
 /**
  * struct hwmon_ops - hwmon device operations
  * @is_visible: Callback to return attribute visibility.
-- 
2.5.0



[PATCH 0/5] hwmon: New hwmon registration API

2016-06-25 Thread Guenter Roeck
Up to now, each hwmon driver has to implement its own sysfs attributes.
This requires a lot of template code, and distracts from the driver's
core function to read and write chip registers.

To be able to reduce driver complexity, move sensor attribute handling
and thermal zone registration into the hwmon core. By using the new API,
driver size is typically reduced by 20-50% depending on driver complexity
and the number of sysfs attributes supported.

The first patch of the series introduces the API as well as support
for temperature sensors. Subsequent patches introduce support for
voltage, current, power, energy, humidity, and fan speed sensors.

The series was tested by converting several drivers (lm75, lm90, tmp102,
tmp421, ltc4245) to the new API. Testing was done with with real chips
as well as with the hwmon driver module test code available at
https://github.com/groeck/module-tests.


[PATCH 0/5] hwmon: New hwmon registration API

2016-06-25 Thread Guenter Roeck
Up to now, each hwmon driver has to implement its own sysfs attributes.
This requires a lot of template code, and distracts from the driver's
core function to read and write chip registers.

To be able to reduce driver complexity, move sensor attribute handling
and thermal zone registration into the hwmon core. By using the new API,
driver size is typically reduced by 20-50% depending on driver complexity
and the number of sysfs attributes supported.

The first patch of the series introduces the API as well as support
for temperature sensors. Subsequent patches introduce support for
voltage, current, power, energy, humidity, and fan speed sensors.

The series was tested by converting several drivers (lm75, lm90, tmp102,
tmp421, ltc4245) to the new API. Testing was done with with real chips
as well as with the hwmon driver module test code available at
https://github.com/groeck/module-tests.


[PATCH v2] ARM: dts: sun7i: Add BCM53125 switch nodes to the lamobo-r1 board

2016-06-25 Thread Florian Fainelli
Now that we have a proper binding for Ethernet switches hanging off
different buses, and a driver for the BCM53125 switch, add its Device
Tree as a child MDIO node, at MDIO address 30 (Broadcom pseudo-PHY
address) and describe the ports layout of the Lamobo R1 board.

This switch is hanging off the GMAC MDIO controller, not the
allwinner,sun4i-a10-mdio MDIO controller which is labeled "mdio"

Signed-off-by: Florian Fainelli 
---
Changes in v2:

- change the unit specifier to use hexadecimal
- name the GMAC MDIO controller label "mdio-gmac"
- specify board name in subject

Maxime,

You can find the B53 driver and its binding here:

https://git.kernel.org/cgit/linux/kernel/git/davem/net-next.git/commit/?id=23c731e830009a51a39a7a558179007235c84eb7

 arch/arm/boot/dts/sun7i-a20-lamobo-r1.dts | 60 +--
 1 file changed, 57 insertions(+), 3 deletions(-)

diff --git a/arch/arm/boot/dts/sun7i-a20-lamobo-r1.dts 
b/arch/arm/boot/dts/sun7i-a20-lamobo-r1.dts
index 5ee43d8bf174..99e71cca1da1 100644
--- a/arch/arm/boot/dts/sun7i-a20-lamobo-r1.dts
+++ b/arch/arm/boot/dts/sun7i-a20-lamobo-r1.dts
@@ -110,13 +110,67 @@
  {
pinctrl-names = "default";
pinctrl-0 = <_pins_rgmii_a>;
-   phy = <>;
phy-mode = "rgmii";
phy-supply = <_gmac_3v3>;
status = "okay";
 
-   phy1: ethernet-phy@1 {
-   reg = <1>;
+   fixed-link {
+   speed = <1000>;
+   full-duplex;
+   };
+
+   mdio-gmac {
+   compatible = "snps,dwmac-mdio";
+   #address-cells = <1>;
+   #size-cells = <0>;
+
+   switch: ethernet-switch@1e {
+   compatible = "brcm,bcm53125";
+   reg = <30>;
+   #address-cells = <1>;
+   #size-cells = <0>;
+
+   ports {
+   #address-cells = <1>;
+   #size-cells = <0>;
+
+   port0: port@0 {
+   reg = <0>;
+   label = "lan2";
+   };
+
+   port1: port@1 {
+   reg = <1>;
+   label = "lan3";
+   };
+
+   port2: port@2 {
+   reg = <2>;
+   label = "lan4";
+   };
+
+   port3: port@3 {
+   reg = <3>;
+   label = "wan";
+   };
+
+   port4: port@4 {
+   reg = <4>;
+   label = "lan1";
+   };
+
+   port8: port@8 {
+   reg = <8>;
+   label = "cpu";
+   ethernet = <>;
+   phy-mode = "rgmii";
+   fixed-link {
+   speed = <1000>;
+   full-duplex;
+   };
+   };
+   };
+   };
};
 };
 
-- 
2.7.4



[PATCH v2] ARM: dts: sun7i: Add BCM53125 switch nodes to the lamobo-r1 board

2016-06-25 Thread Florian Fainelli
Now that we have a proper binding for Ethernet switches hanging off
different buses, and a driver for the BCM53125 switch, add its Device
Tree as a child MDIO node, at MDIO address 30 (Broadcom pseudo-PHY
address) and describe the ports layout of the Lamobo R1 board.

This switch is hanging off the GMAC MDIO controller, not the
allwinner,sun4i-a10-mdio MDIO controller which is labeled "mdio"

Signed-off-by: Florian Fainelli 
---
Changes in v2:

- change the unit specifier to use hexadecimal
- name the GMAC MDIO controller label "mdio-gmac"
- specify board name in subject

Maxime,

You can find the B53 driver and its binding here:

https://git.kernel.org/cgit/linux/kernel/git/davem/net-next.git/commit/?id=23c731e830009a51a39a7a558179007235c84eb7

 arch/arm/boot/dts/sun7i-a20-lamobo-r1.dts | 60 +--
 1 file changed, 57 insertions(+), 3 deletions(-)

diff --git a/arch/arm/boot/dts/sun7i-a20-lamobo-r1.dts 
b/arch/arm/boot/dts/sun7i-a20-lamobo-r1.dts
index 5ee43d8bf174..99e71cca1da1 100644
--- a/arch/arm/boot/dts/sun7i-a20-lamobo-r1.dts
+++ b/arch/arm/boot/dts/sun7i-a20-lamobo-r1.dts
@@ -110,13 +110,67 @@
  {
pinctrl-names = "default";
pinctrl-0 = <_pins_rgmii_a>;
-   phy = <>;
phy-mode = "rgmii";
phy-supply = <_gmac_3v3>;
status = "okay";
 
-   phy1: ethernet-phy@1 {
-   reg = <1>;
+   fixed-link {
+   speed = <1000>;
+   full-duplex;
+   };
+
+   mdio-gmac {
+   compatible = "snps,dwmac-mdio";
+   #address-cells = <1>;
+   #size-cells = <0>;
+
+   switch: ethernet-switch@1e {
+   compatible = "brcm,bcm53125";
+   reg = <30>;
+   #address-cells = <1>;
+   #size-cells = <0>;
+
+   ports {
+   #address-cells = <1>;
+   #size-cells = <0>;
+
+   port0: port@0 {
+   reg = <0>;
+   label = "lan2";
+   };
+
+   port1: port@1 {
+   reg = <1>;
+   label = "lan3";
+   };
+
+   port2: port@2 {
+   reg = <2>;
+   label = "lan4";
+   };
+
+   port3: port@3 {
+   reg = <3>;
+   label = "wan";
+   };
+
+   port4: port@4 {
+   reg = <4>;
+   label = "lan1";
+   };
+
+   port8: port@8 {
+   reg = <8>;
+   label = "cpu";
+   ethernet = <>;
+   phy-mode = "rgmii";
+   fixed-link {
+   speed = <1000>;
+   full-duplex;
+   };
+   };
+   };
+   };
};
 };
 
-- 
2.7.4



Re: [PATCH 3/5] cputime: allow irq time accounting to be selected as an option

2016-06-25 Thread kbuild test robot
Hi,

[auto build test WARNING on tip/sched/core]
[also build test WARNING on next-20160624]
[cannot apply to v4.7-rc4]
[if your patch is applied to the wrong git tree, please drop us a note to help 
improve the system]

url:
https://github.com/0day-ci/linux/commits/riel-redhat-com/sched-time-fix-irq-time-accounting-with-nohz_idle/20160623-102923
config: x86_64-randconfig-a0-06260951 (attached as .config)
compiler: gcc-6 (Debian 6.1.1-1) 6.1.1 20160430
reproduce:
# save the attached .config to linux build tree
make ARCH=x86_64 

All warnings (new ones prefixed by >>):

   In file included from include/linux/sched.h:17:0,
from kernel/sched/cputime.c:2:
   kernel/sched/cputime.c: In function 'irqtime_account_hi_update':
   include/linux/kernel.h:742:17: warning: comparison of distinct pointer types 
lacks a cast
 (void) (&_min1 == &_min2);  \
^
>> kernel/sched/cputime.c:92:17: note: in expansion of macro 'min'
  irq_jiffies = min(max_jiffies, cputime_to_jiffies(irq));
^~~
   kernel/sched/cputime.c: In function 'irqtime_account_si_update':
   include/linux/kernel.h:742:17: warning: comparison of distinct pointer types 
lacks a cast
 (void) (&_min1 == &_min2);  \
^
   kernel/sched/cputime.c:109:16: note: in expansion of macro 'min'
  si_jiffies = min(max_jiffies, cputime_to_jiffies(softirq));
   ^~~

vim +/min +92 kernel/sched/cputime.c

73fbec604 Frederic Weisbecker 2012-06-16   1  #include 
73fbec604 Frederic Weisbecker 2012-06-16  @2  #include 
73fbec604 Frederic Weisbecker 2012-06-16   3  #include 
73fbec604 Frederic Weisbecker 2012-06-16   4  #include 
73fbec604 Frederic Weisbecker 2012-06-16   5  #include 
abf917cd9 Frederic Weisbecker 2012-07-25   6  #include 

73fbec604 Frederic Weisbecker 2012-06-16   7  #include "sched.h"
1fe7c4ef8 Stefano Stabellini  2015-11-10   8  #ifdef CONFIG_PARAVIRT
1fe7c4ef8 Stefano Stabellini  2015-11-10   9  #include 
1fe7c4ef8 Stefano Stabellini  2015-11-10  10  #endif
73fbec604 Frederic Weisbecker 2012-06-16  11  
73fbec604 Frederic Weisbecker 2012-06-16  12  
73fbec604 Frederic Weisbecker 2012-06-16  13  #ifdef CONFIG_IRQ_TIME_ACCOUNTING
73fbec604 Frederic Weisbecker 2012-06-16  14  
73fbec604 Frederic Weisbecker 2012-06-16  15  /*
73fbec604 Frederic Weisbecker 2012-06-16  16   * There are no locks covering 
percpu hardirq/softirq time.
bf9fae9f5 Frederic Weisbecker 2012-09-08  17   * They are only modified in 
vtime_account, on corresponding CPU
73fbec604 Frederic Weisbecker 2012-06-16  18   * with interrupts disabled. So, 
writes are safe.
73fbec604 Frederic Weisbecker 2012-06-16  19   * They are read and saved off 
onto struct rq in update_rq_clock().
73fbec604 Frederic Weisbecker 2012-06-16  20   * This may result in other CPU 
reading this CPU's irq time and can
bf9fae9f5 Frederic Weisbecker 2012-09-08  21   * race with irq/vtime_account on 
this CPU. We would either get old
73fbec604 Frederic Weisbecker 2012-06-16  22   * or new value with a side 
effect of accounting a slice of irq time to wrong
73fbec604 Frederic Weisbecker 2012-06-16  23   * task when irq is in progress 
while we read rq->clock. That is a worthy
73fbec604 Frederic Weisbecker 2012-06-16  24   * compromise in place of having 
locks on each irq in account_system_time.
73fbec604 Frederic Weisbecker 2012-06-16  25   */
73fbec604 Frederic Weisbecker 2012-06-16  26  DEFINE_PER_CPU(u64, 
cpu_hardirq_time);
73fbec604 Frederic Weisbecker 2012-06-16  27  DEFINE_PER_CPU(u64, 
cpu_softirq_time);
73fbec604 Frederic Weisbecker 2012-06-16  28  
73fbec604 Frederic Weisbecker 2012-06-16  29  static DEFINE_PER_CPU(u64, 
irq_start_time);
73fbec604 Frederic Weisbecker 2012-06-16  30  static int sched_clock_irqtime;
73fbec604 Frederic Weisbecker 2012-06-16  31  
73fbec604 Frederic Weisbecker 2012-06-16  32  void 
enable_sched_clock_irqtime(void)
73fbec604 Frederic Weisbecker 2012-06-16  33  {
73fbec604 Frederic Weisbecker 2012-06-16  34sched_clock_irqtime = 1;
73fbec604 Frederic Weisbecker 2012-06-16  35  }
73fbec604 Frederic Weisbecker 2012-06-16  36  
73fbec604 Frederic Weisbecker 2012-06-16  37  void 
disable_sched_clock_irqtime(void)
73fbec604 Frederic Weisbecker 2012-06-16  38  {
73fbec604 Frederic Weisbecker 2012-06-16  39sched_clock_irqtime = 0;
73fbec604 Frederic Weisbecker 2012-06-16  40  }
73fbec604 Frederic Weisbecker 2012-06-16  41  
73fbec604 Frederic Weisbecker 2012-06-16  42  #ifndef CONFIG_64BIT
73fbec604 Frederic Weisbecker 2012-06-16  43  DEFINE_PER_CPU(seqcount_t, 
irq_time_seq);
73fbec604 Frederic Weisbecker 2012-06-16  44  #endif /* CONFIG_64BIT */
73fbec604 Frederic Weisbecker 2012-06-16  45  
73fbec604 Frederic Weisbecker 2012-06-16  46  /*
73fbec604 Frederic Weisbecker 2012-06-16  47   * Called before incrementing 
preempt_count on {soft,}irq_enter
73fbec604 Frederic Weisbecker 2012-06-16  48   * and before decrementing 
preempt_count on {soft,}irq_exit.

Re: [PATCH 3/5] cputime: allow irq time accounting to be selected as an option

2016-06-25 Thread kbuild test robot
Hi,

[auto build test WARNING on tip/sched/core]
[also build test WARNING on next-20160624]
[cannot apply to v4.7-rc4]
[if your patch is applied to the wrong git tree, please drop us a note to help 
improve the system]

url:
https://github.com/0day-ci/linux/commits/riel-redhat-com/sched-time-fix-irq-time-accounting-with-nohz_idle/20160623-102923
config: x86_64-randconfig-a0-06260951 (attached as .config)
compiler: gcc-6 (Debian 6.1.1-1) 6.1.1 20160430
reproduce:
# save the attached .config to linux build tree
make ARCH=x86_64 

All warnings (new ones prefixed by >>):

   In file included from include/linux/sched.h:17:0,
from kernel/sched/cputime.c:2:
   kernel/sched/cputime.c: In function 'irqtime_account_hi_update':
   include/linux/kernel.h:742:17: warning: comparison of distinct pointer types 
lacks a cast
 (void) (&_min1 == &_min2);  \
^
>> kernel/sched/cputime.c:92:17: note: in expansion of macro 'min'
  irq_jiffies = min(max_jiffies, cputime_to_jiffies(irq));
^~~
   kernel/sched/cputime.c: In function 'irqtime_account_si_update':
   include/linux/kernel.h:742:17: warning: comparison of distinct pointer types 
lacks a cast
 (void) (&_min1 == &_min2);  \
^
   kernel/sched/cputime.c:109:16: note: in expansion of macro 'min'
  si_jiffies = min(max_jiffies, cputime_to_jiffies(softirq));
   ^~~

vim +/min +92 kernel/sched/cputime.c

73fbec604 Frederic Weisbecker 2012-06-16   1  #include 
73fbec604 Frederic Weisbecker 2012-06-16  @2  #include 
73fbec604 Frederic Weisbecker 2012-06-16   3  #include 
73fbec604 Frederic Weisbecker 2012-06-16   4  #include 
73fbec604 Frederic Weisbecker 2012-06-16   5  #include 
abf917cd9 Frederic Weisbecker 2012-07-25   6  #include 

73fbec604 Frederic Weisbecker 2012-06-16   7  #include "sched.h"
1fe7c4ef8 Stefano Stabellini  2015-11-10   8  #ifdef CONFIG_PARAVIRT
1fe7c4ef8 Stefano Stabellini  2015-11-10   9  #include 
1fe7c4ef8 Stefano Stabellini  2015-11-10  10  #endif
73fbec604 Frederic Weisbecker 2012-06-16  11  
73fbec604 Frederic Weisbecker 2012-06-16  12  
73fbec604 Frederic Weisbecker 2012-06-16  13  #ifdef CONFIG_IRQ_TIME_ACCOUNTING
73fbec604 Frederic Weisbecker 2012-06-16  14  
73fbec604 Frederic Weisbecker 2012-06-16  15  /*
73fbec604 Frederic Weisbecker 2012-06-16  16   * There are no locks covering 
percpu hardirq/softirq time.
bf9fae9f5 Frederic Weisbecker 2012-09-08  17   * They are only modified in 
vtime_account, on corresponding CPU
73fbec604 Frederic Weisbecker 2012-06-16  18   * with interrupts disabled. So, 
writes are safe.
73fbec604 Frederic Weisbecker 2012-06-16  19   * They are read and saved off 
onto struct rq in update_rq_clock().
73fbec604 Frederic Weisbecker 2012-06-16  20   * This may result in other CPU 
reading this CPU's irq time and can
bf9fae9f5 Frederic Weisbecker 2012-09-08  21   * race with irq/vtime_account on 
this CPU. We would either get old
73fbec604 Frederic Weisbecker 2012-06-16  22   * or new value with a side 
effect of accounting a slice of irq time to wrong
73fbec604 Frederic Weisbecker 2012-06-16  23   * task when irq is in progress 
while we read rq->clock. That is a worthy
73fbec604 Frederic Weisbecker 2012-06-16  24   * compromise in place of having 
locks on each irq in account_system_time.
73fbec604 Frederic Weisbecker 2012-06-16  25   */
73fbec604 Frederic Weisbecker 2012-06-16  26  DEFINE_PER_CPU(u64, 
cpu_hardirq_time);
73fbec604 Frederic Weisbecker 2012-06-16  27  DEFINE_PER_CPU(u64, 
cpu_softirq_time);
73fbec604 Frederic Weisbecker 2012-06-16  28  
73fbec604 Frederic Weisbecker 2012-06-16  29  static DEFINE_PER_CPU(u64, 
irq_start_time);
73fbec604 Frederic Weisbecker 2012-06-16  30  static int sched_clock_irqtime;
73fbec604 Frederic Weisbecker 2012-06-16  31  
73fbec604 Frederic Weisbecker 2012-06-16  32  void 
enable_sched_clock_irqtime(void)
73fbec604 Frederic Weisbecker 2012-06-16  33  {
73fbec604 Frederic Weisbecker 2012-06-16  34sched_clock_irqtime = 1;
73fbec604 Frederic Weisbecker 2012-06-16  35  }
73fbec604 Frederic Weisbecker 2012-06-16  36  
73fbec604 Frederic Weisbecker 2012-06-16  37  void 
disable_sched_clock_irqtime(void)
73fbec604 Frederic Weisbecker 2012-06-16  38  {
73fbec604 Frederic Weisbecker 2012-06-16  39sched_clock_irqtime = 0;
73fbec604 Frederic Weisbecker 2012-06-16  40  }
73fbec604 Frederic Weisbecker 2012-06-16  41  
73fbec604 Frederic Weisbecker 2012-06-16  42  #ifndef CONFIG_64BIT
73fbec604 Frederic Weisbecker 2012-06-16  43  DEFINE_PER_CPU(seqcount_t, 
irq_time_seq);
73fbec604 Frederic Weisbecker 2012-06-16  44  #endif /* CONFIG_64BIT */
73fbec604 Frederic Weisbecker 2012-06-16  45  
73fbec604 Frederic Weisbecker 2012-06-16  46  /*
73fbec604 Frederic Weisbecker 2012-06-16  47   * Called before incrementing 
preempt_count on {soft,}irq_enter
73fbec604 Frederic Weisbecker 2012-06-16  48   * and before decrementing 
preempt_count on {soft,}irq_exit.

include/linux/unaligned/access_ok.h:7:19: error: redefinition of 'get_unaligned_le16'

2016-06-25 Thread kbuild test robot
Hi,

FYI, the error/warning still remains.

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 
master
head:   da2f6aba4a21f8da3331e5251a117c52764da579
commit: 3194c6870158e305dac2af52f83681e9cb67280f NFC: nfcmrvl: add firmware 
download support
date:   8 months ago
config: ia64-allmodconfig (attached as .config)
compiler: ia64-linux-gcc (GCC) 4.9.0
reproduce:
wget 
https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross
 -O ~/bin/make.cross
chmod +x ~/bin/make.cross
git checkout 3194c6870158e305dac2af52f83681e9cb67280f
# save the attached .config to linux build tree
make.cross ARCH=ia64 

All errors (new ones prefixed by >>):

   In file included from drivers/nfc/nfcmrvl/fw_dnld.c:20:0:
>> include/linux/unaligned/access_ok.h:7:19: error: redefinition of 
>> 'get_unaligned_le16'
static inline u16 get_unaligned_le16(const void *p)
  ^
   In file included from arch/ia64/include/asm/unaligned.h:4:0,
from arch/ia64/include/asm/io.h:22,
from arch/ia64/include/asm/smp.h:20,
from include/linux/smp.h:59,
from include/linux/topology.h:33,
from include/linux/gfp.h:8,
from include/linux/kmod.h:22,
from include/linux/module.h:13,
from drivers/nfc/nfcmrvl/fw_dnld.c:19:
   include/linux/unaligned/le_struct.h:6:19: note: previous definition of 
'get_unaligned_le16' was here
static inline u16 get_unaligned_le16(const void *p)
  ^
   In file included from drivers/nfc/nfcmrvl/fw_dnld.c:20:0:
>> include/linux/unaligned/access_ok.h:12:19: error: redefinition of 
>> 'get_unaligned_le32'
static inline u32 get_unaligned_le32(const void *p)
  ^
   In file included from arch/ia64/include/asm/unaligned.h:4:0,
from arch/ia64/include/asm/io.h:22,
from arch/ia64/include/asm/smp.h:20,
from include/linux/smp.h:59,
from include/linux/topology.h:33,
from include/linux/gfp.h:8,
from include/linux/kmod.h:22,
from include/linux/module.h:13,
from drivers/nfc/nfcmrvl/fw_dnld.c:19:
   include/linux/unaligned/le_struct.h:11:19: note: previous definition of 
'get_unaligned_le32' was here
static inline u32 get_unaligned_le32(const void *p)
  ^
   In file included from drivers/nfc/nfcmrvl/fw_dnld.c:20:0:
>> include/linux/unaligned/access_ok.h:17:19: error: redefinition of 
>> 'get_unaligned_le64'
static inline u64 get_unaligned_le64(const void *p)
  ^
   In file included from arch/ia64/include/asm/unaligned.h:4:0,
from arch/ia64/include/asm/io.h:22,
from arch/ia64/include/asm/smp.h:20,
from include/linux/smp.h:59,
from include/linux/topology.h:33,
from include/linux/gfp.h:8,
from include/linux/kmod.h:22,
from include/linux/module.h:13,
from drivers/nfc/nfcmrvl/fw_dnld.c:19:
   include/linux/unaligned/le_struct.h:16:19: note: previous definition of 
'get_unaligned_le64' was here
static inline u64 get_unaligned_le64(const void *p)
  ^
   In file included from drivers/nfc/nfcmrvl/fw_dnld.c:20:0:
>> include/linux/unaligned/access_ok.h:22:19: error: redefinition of 
>> 'get_unaligned_be16'
static inline u16 get_unaligned_be16(const void *p)
  ^
   In file included from arch/ia64/include/asm/unaligned.h:5:0,
from arch/ia64/include/asm/io.h:22,
from arch/ia64/include/asm/smp.h:20,
from include/linux/smp.h:59,
from include/linux/topology.h:33,
from include/linux/gfp.h:8,
from include/linux/kmod.h:22,
from include/linux/module.h:13,
from drivers/nfc/nfcmrvl/fw_dnld.c:19:
   include/linux/unaligned/be_byteshift.h:40:19: note: previous definition of 
'get_unaligned_be16' was here
static inline u16 get_unaligned_be16(const void *p)
  ^
   In file included from drivers/nfc/nfcmrvl/fw_dnld.c:20:0:
>> include/linux/unaligned/access_ok.h:27:19: error: redefinition of 
>> 'get_unaligned_be32'
static inline u32 get_unaligned_be32(const void *p)
  ^
   In file included from arch/ia64/include/asm/unaligned.h:5:0,
from arch/ia64/include/asm/io.h:22,
from arch/ia64/include/asm/smp.h:20,
from include/linux/smp.h:59,
from include/linux/topology.h:33,
from include/linux/gfp.h:8,
from include/linux/kmod.h:22,

include/linux/unaligned/access_ok.h:7:19: error: redefinition of 'get_unaligned_le16'

2016-06-25 Thread kbuild test robot
Hi,

FYI, the error/warning still remains.

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 
master
head:   da2f6aba4a21f8da3331e5251a117c52764da579
commit: 3194c6870158e305dac2af52f83681e9cb67280f NFC: nfcmrvl: add firmware 
download support
date:   8 months ago
config: ia64-allmodconfig (attached as .config)
compiler: ia64-linux-gcc (GCC) 4.9.0
reproduce:
wget 
https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross
 -O ~/bin/make.cross
chmod +x ~/bin/make.cross
git checkout 3194c6870158e305dac2af52f83681e9cb67280f
# save the attached .config to linux build tree
make.cross ARCH=ia64 

All errors (new ones prefixed by >>):

   In file included from drivers/nfc/nfcmrvl/fw_dnld.c:20:0:
>> include/linux/unaligned/access_ok.h:7:19: error: redefinition of 
>> 'get_unaligned_le16'
static inline u16 get_unaligned_le16(const void *p)
  ^
   In file included from arch/ia64/include/asm/unaligned.h:4:0,
from arch/ia64/include/asm/io.h:22,
from arch/ia64/include/asm/smp.h:20,
from include/linux/smp.h:59,
from include/linux/topology.h:33,
from include/linux/gfp.h:8,
from include/linux/kmod.h:22,
from include/linux/module.h:13,
from drivers/nfc/nfcmrvl/fw_dnld.c:19:
   include/linux/unaligned/le_struct.h:6:19: note: previous definition of 
'get_unaligned_le16' was here
static inline u16 get_unaligned_le16(const void *p)
  ^
   In file included from drivers/nfc/nfcmrvl/fw_dnld.c:20:0:
>> include/linux/unaligned/access_ok.h:12:19: error: redefinition of 
>> 'get_unaligned_le32'
static inline u32 get_unaligned_le32(const void *p)
  ^
   In file included from arch/ia64/include/asm/unaligned.h:4:0,
from arch/ia64/include/asm/io.h:22,
from arch/ia64/include/asm/smp.h:20,
from include/linux/smp.h:59,
from include/linux/topology.h:33,
from include/linux/gfp.h:8,
from include/linux/kmod.h:22,
from include/linux/module.h:13,
from drivers/nfc/nfcmrvl/fw_dnld.c:19:
   include/linux/unaligned/le_struct.h:11:19: note: previous definition of 
'get_unaligned_le32' was here
static inline u32 get_unaligned_le32(const void *p)
  ^
   In file included from drivers/nfc/nfcmrvl/fw_dnld.c:20:0:
>> include/linux/unaligned/access_ok.h:17:19: error: redefinition of 
>> 'get_unaligned_le64'
static inline u64 get_unaligned_le64(const void *p)
  ^
   In file included from arch/ia64/include/asm/unaligned.h:4:0,
from arch/ia64/include/asm/io.h:22,
from arch/ia64/include/asm/smp.h:20,
from include/linux/smp.h:59,
from include/linux/topology.h:33,
from include/linux/gfp.h:8,
from include/linux/kmod.h:22,
from include/linux/module.h:13,
from drivers/nfc/nfcmrvl/fw_dnld.c:19:
   include/linux/unaligned/le_struct.h:16:19: note: previous definition of 
'get_unaligned_le64' was here
static inline u64 get_unaligned_le64(const void *p)
  ^
   In file included from drivers/nfc/nfcmrvl/fw_dnld.c:20:0:
>> include/linux/unaligned/access_ok.h:22:19: error: redefinition of 
>> 'get_unaligned_be16'
static inline u16 get_unaligned_be16(const void *p)
  ^
   In file included from arch/ia64/include/asm/unaligned.h:5:0,
from arch/ia64/include/asm/io.h:22,
from arch/ia64/include/asm/smp.h:20,
from include/linux/smp.h:59,
from include/linux/topology.h:33,
from include/linux/gfp.h:8,
from include/linux/kmod.h:22,
from include/linux/module.h:13,
from drivers/nfc/nfcmrvl/fw_dnld.c:19:
   include/linux/unaligned/be_byteshift.h:40:19: note: previous definition of 
'get_unaligned_be16' was here
static inline u16 get_unaligned_be16(const void *p)
  ^
   In file included from drivers/nfc/nfcmrvl/fw_dnld.c:20:0:
>> include/linux/unaligned/access_ok.h:27:19: error: redefinition of 
>> 'get_unaligned_be32'
static inline u32 get_unaligned_be32(const void *p)
  ^
   In file included from arch/ia64/include/asm/unaligned.h:5:0,
from arch/ia64/include/asm/io.h:22,
from arch/ia64/include/asm/smp.h:20,
from include/linux/smp.h:59,
from include/linux/topology.h:33,
from include/linux/gfp.h:8,
from include/linux/kmod.h:22,

[PATCH 04/19] pinctrl: imx25: make it explicitly non-modular

2016-06-25 Thread Paul Gortmaker
The Kconfig currently controlling compilation of this code is:

drivers/pinctrl/freescale/Kconfig:config PINCTRL_IMX25
drivers/pinctrl/freescale/Kconfig:bool "IMX25 pinctrl driver"

...meaning that it currently is not being built as a module by anyone.

Lets remove the modular code that is essentially orphaned, so that
when reading the driver there is no doubt it is builtin-only.

Since module_init was not in use by this driver, the init ordering
remains unchanged with this commit.

We also delete the MODULE_LICENSE tag etc. since all that information
is already contained at the top of the file in the comments.

Cc: Linus Walleij 
Cc: Denis Carikli 
Cc: linux-g...@vger.kernel.org
Signed-off-by: Paul Gortmaker 
---
 drivers/pinctrl/freescale/pinctrl-imx25.c | 10 --
 1 file changed, 10 deletions(-)

diff --git a/drivers/pinctrl/freescale/pinctrl-imx25.c 
b/drivers/pinctrl/freescale/pinctrl-imx25.c
index 81ad546d74bb..d7367fabe712 100644
--- a/drivers/pinctrl/freescale/pinctrl-imx25.c
+++ b/drivers/pinctrl/freescale/pinctrl-imx25.c
@@ -18,7 +18,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -338,12 +337,3 @@ static int __init imx25_pinctrl_init(void)
return platform_driver_register(_pinctrl_driver);
 }
 arch_initcall(imx25_pinctrl_init);
-
-static void __exit imx25_pinctrl_exit(void)
-{
-   platform_driver_unregister(_pinctrl_driver);
-}
-module_exit(imx25_pinctrl_exit);
-MODULE_AUTHOR("Denis Carikli ");
-MODULE_DESCRIPTION("Freescale IMX25 pinctrl driver");
-MODULE_LICENSE("GPL v2");
-- 
2.8.4



[PATCH 04/19] pinctrl: imx25: make it explicitly non-modular

2016-06-25 Thread Paul Gortmaker
The Kconfig currently controlling compilation of this code is:

drivers/pinctrl/freescale/Kconfig:config PINCTRL_IMX25
drivers/pinctrl/freescale/Kconfig:bool "IMX25 pinctrl driver"

...meaning that it currently is not being built as a module by anyone.

Lets remove the modular code that is essentially orphaned, so that
when reading the driver there is no doubt it is builtin-only.

Since module_init was not in use by this driver, the init ordering
remains unchanged with this commit.

We also delete the MODULE_LICENSE tag etc. since all that information
is already contained at the top of the file in the comments.

Cc: Linus Walleij 
Cc: Denis Carikli 
Cc: linux-g...@vger.kernel.org
Signed-off-by: Paul Gortmaker 
---
 drivers/pinctrl/freescale/pinctrl-imx25.c | 10 --
 1 file changed, 10 deletions(-)

diff --git a/drivers/pinctrl/freescale/pinctrl-imx25.c 
b/drivers/pinctrl/freescale/pinctrl-imx25.c
index 81ad546d74bb..d7367fabe712 100644
--- a/drivers/pinctrl/freescale/pinctrl-imx25.c
+++ b/drivers/pinctrl/freescale/pinctrl-imx25.c
@@ -18,7 +18,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -338,12 +337,3 @@ static int __init imx25_pinctrl_init(void)
return platform_driver_register(_pinctrl_driver);
 }
 arch_initcall(imx25_pinctrl_init);
-
-static void __exit imx25_pinctrl_exit(void)
-{
-   platform_driver_unregister(_pinctrl_driver);
-}
-module_exit(imx25_pinctrl_exit);
-MODULE_AUTHOR("Denis Carikli ");
-MODULE_DESCRIPTION("Freescale IMX25 pinctrl driver");
-MODULE_LICENSE("GPL v2");
-- 
2.8.4



[PATCH 05/19] pinctrl: imx27: make it explicitly non-modular

2016-06-25 Thread Paul Gortmaker
The Kconfig currently controlling compilation of this code is:

drivers/pinctrl/freescale/Kconfig:config PINCTRL_IMX27
drivers/pinctrl/freescale/Kconfig:  bool "IMX27 pinctrl driver"

...meaning that it currently is not being built as a module by anyone.

Lets remove the modular code that is essentially orphaned, so that
when reading the driver there is no doubt it is builtin-only.

Since module_init was not in use by this driver, the init ordering
remains unchanged with this commit.

We also delete the MODULE_LICENSE tag etc. since all that information
is already contained at the top of the file in the comments.

Cc: Linus Walleij 
Cc: Markus Pargmann 
Cc: linux-g...@vger.kernel.org
Signed-off-by: Paul Gortmaker 
---
 drivers/pinctrl/freescale/pinctrl-imx27.c | 10 --
 1 file changed, 10 deletions(-)

diff --git a/drivers/pinctrl/freescale/pinctrl-imx27.c 
b/drivers/pinctrl/freescale/pinctrl-imx27.c
index f828fbbba4b9..e5992036fc6c 100644
--- a/drivers/pinctrl/freescale/pinctrl-imx27.c
+++ b/drivers/pinctrl/freescale/pinctrl-imx27.c
@@ -14,7 +14,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -412,12 +411,3 @@ static int __init imx27_pinctrl_init(void)
return platform_driver_register(_pinctrl_driver);
 }
 arch_initcall(imx27_pinctrl_init);
-
-static void __exit imx27_pinctrl_exit(void)
-{
-   platform_driver_unregister(_pinctrl_driver);
-}
-module_exit(imx27_pinctrl_exit);
-MODULE_AUTHOR("Markus Pargmann ");
-MODULE_DESCRIPTION("Freescale IMX27 pinctrl driver");
-MODULE_LICENSE("GPL v2");
-- 
2.8.4



[PATCH 16/19] pinctrl: vf610: make it explicitly non-modular

2016-06-25 Thread Paul Gortmaker
The Kconfig currently controlling compilation of this code is:

drivers/pinctrl/freescale/Kconfig:config PINCTRL_VF610
drivers/pinctrl/freescale/Kconfig:  bool "Freescale Vybrid VF610 pinctrl 
driver"

...meaning that it currently is not being built as a module by anyone.

Lets remove the modular code that is essentially orphaned, so that
when reading the driver there is no doubt it is builtin-only.

Since module_init wasn't in use by this driver, the init ordering
remains unchanged with this commit.

We also delete the MODULE_LICENSE tag etc. since all that information
is already contained at the top of the file in the comments.

Cc: Linus Walleij 
Cc: linux-g...@vger.kernel.org
Signed-off-by: Paul Gortmaker 
---
 drivers/pinctrl/freescale/pinctrl-vf610.c | 10 --
 1 file changed, 10 deletions(-)

diff --git a/drivers/pinctrl/freescale/pinctrl-vf610.c 
b/drivers/pinctrl/freescale/pinctrl-vf610.c
index 6d81be096bc0..2b1e198e3092 100644
--- a/drivers/pinctrl/freescale/pinctrl-vf610.c
+++ b/drivers/pinctrl/freescale/pinctrl-vf610.c
@@ -12,7 +12,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -325,12 +324,3 @@ static int __init vf610_pinctrl_init(void)
return platform_driver_register(_pinctrl_driver);
 }
 arch_initcall(vf610_pinctrl_init);
-
-static void __exit vf610_pinctrl_exit(void)
-{
-   platform_driver_unregister(_pinctrl_driver);
-}
-module_exit(vf610_pinctrl_exit);
-
-MODULE_DESCRIPTION("Freescale VF610 pinctrl driver");
-MODULE_LICENSE("GPL v2");
-- 
2.8.4



[PATCH 05/19] pinctrl: imx27: make it explicitly non-modular

2016-06-25 Thread Paul Gortmaker
The Kconfig currently controlling compilation of this code is:

drivers/pinctrl/freescale/Kconfig:config PINCTRL_IMX27
drivers/pinctrl/freescale/Kconfig:  bool "IMX27 pinctrl driver"

...meaning that it currently is not being built as a module by anyone.

Lets remove the modular code that is essentially orphaned, so that
when reading the driver there is no doubt it is builtin-only.

Since module_init was not in use by this driver, the init ordering
remains unchanged with this commit.

We also delete the MODULE_LICENSE tag etc. since all that information
is already contained at the top of the file in the comments.

Cc: Linus Walleij 
Cc: Markus Pargmann 
Cc: linux-g...@vger.kernel.org
Signed-off-by: Paul Gortmaker 
---
 drivers/pinctrl/freescale/pinctrl-imx27.c | 10 --
 1 file changed, 10 deletions(-)

diff --git a/drivers/pinctrl/freescale/pinctrl-imx27.c 
b/drivers/pinctrl/freescale/pinctrl-imx27.c
index f828fbbba4b9..e5992036fc6c 100644
--- a/drivers/pinctrl/freescale/pinctrl-imx27.c
+++ b/drivers/pinctrl/freescale/pinctrl-imx27.c
@@ -14,7 +14,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -412,12 +411,3 @@ static int __init imx27_pinctrl_init(void)
return platform_driver_register(_pinctrl_driver);
 }
 arch_initcall(imx27_pinctrl_init);
-
-static void __exit imx27_pinctrl_exit(void)
-{
-   platform_driver_unregister(_pinctrl_driver);
-}
-module_exit(imx27_pinctrl_exit);
-MODULE_AUTHOR("Markus Pargmann ");
-MODULE_DESCRIPTION("Freescale IMX27 pinctrl driver");
-MODULE_LICENSE("GPL v2");
-- 
2.8.4



[PATCH 16/19] pinctrl: vf610: make it explicitly non-modular

2016-06-25 Thread Paul Gortmaker
The Kconfig currently controlling compilation of this code is:

drivers/pinctrl/freescale/Kconfig:config PINCTRL_VF610
drivers/pinctrl/freescale/Kconfig:  bool "Freescale Vybrid VF610 pinctrl 
driver"

...meaning that it currently is not being built as a module by anyone.

Lets remove the modular code that is essentially orphaned, so that
when reading the driver there is no doubt it is builtin-only.

Since module_init wasn't in use by this driver, the init ordering
remains unchanged with this commit.

We also delete the MODULE_LICENSE tag etc. since all that information
is already contained at the top of the file in the comments.

Cc: Linus Walleij 
Cc: linux-g...@vger.kernel.org
Signed-off-by: Paul Gortmaker 
---
 drivers/pinctrl/freescale/pinctrl-vf610.c | 10 --
 1 file changed, 10 deletions(-)

diff --git a/drivers/pinctrl/freescale/pinctrl-vf610.c 
b/drivers/pinctrl/freescale/pinctrl-vf610.c
index 6d81be096bc0..2b1e198e3092 100644
--- a/drivers/pinctrl/freescale/pinctrl-vf610.c
+++ b/drivers/pinctrl/freescale/pinctrl-vf610.c
@@ -12,7 +12,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -325,12 +324,3 @@ static int __init vf610_pinctrl_init(void)
return platform_driver_register(_pinctrl_driver);
 }
 arch_initcall(vf610_pinctrl_init);
-
-static void __exit vf610_pinctrl_exit(void)
-{
-   platform_driver_unregister(_pinctrl_driver);
-}
-module_exit(vf610_pinctrl_exit);
-
-MODULE_DESCRIPTION("Freescale VF610 pinctrl driver");
-MODULE_LICENSE("GPL v2");
-- 
2.8.4



[PATCH 07/19] pinctrl: imx50: make it explicitly non-modular

2016-06-25 Thread Paul Gortmaker
The Kconfig currently controlling compilation of this code is:

drivers/pinctrl/freescale/Kconfig:config PINCTRL_IMX50
drivers/pinctrl/freescale/Kconfig:  bool "IMX50 pinctrl driver"

...meaning that it currently is not being built as a module by anyone.

Lets remove the modular code that is essentially orphaned, so that
when reading the driver there is no doubt it is builtin-only.

Since module_init was not in use by this driver, the init ordering
remains unchanged with this commit.

We also delete the MODULE_LICENSE tag etc. since all that information
is already contained at the top of the file in the comments.

Cc: Linus Walleij 
Cc: linux-g...@vger.kernel.org
Signed-off-by: Paul Gortmaker 
---
 drivers/pinctrl/freescale/pinctrl-imx50.c | 9 -
 1 file changed, 9 deletions(-)

diff --git a/drivers/pinctrl/freescale/pinctrl-imx50.c 
b/drivers/pinctrl/freescale/pinctrl-imx50.c
index 95a36c88b66a..8e3a17df5c5d 100644
--- a/drivers/pinctrl/freescale/pinctrl-imx50.c
+++ b/drivers/pinctrl/freescale/pinctrl-imx50.c
@@ -14,7 +14,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -415,11 +414,3 @@ static int __init imx50_pinctrl_init(void)
return platform_driver_register(_pinctrl_driver);
 }
 arch_initcall(imx50_pinctrl_init);
-
-static void __exit imx50_pinctrl_exit(void)
-{
-   platform_driver_unregister(_pinctrl_driver);
-}
-module_exit(imx50_pinctrl_exit);
-MODULE_DESCRIPTION("Freescale IMX50 pinctrl driver");
-MODULE_LICENSE("GPL v2");
-- 
2.8.4



[PATCH 07/19] pinctrl: imx50: make it explicitly non-modular

2016-06-25 Thread Paul Gortmaker
The Kconfig currently controlling compilation of this code is:

drivers/pinctrl/freescale/Kconfig:config PINCTRL_IMX50
drivers/pinctrl/freescale/Kconfig:  bool "IMX50 pinctrl driver"

...meaning that it currently is not being built as a module by anyone.

Lets remove the modular code that is essentially orphaned, so that
when reading the driver there is no doubt it is builtin-only.

Since module_init was not in use by this driver, the init ordering
remains unchanged with this commit.

We also delete the MODULE_LICENSE tag etc. since all that information
is already contained at the top of the file in the comments.

Cc: Linus Walleij 
Cc: linux-g...@vger.kernel.org
Signed-off-by: Paul Gortmaker 
---
 drivers/pinctrl/freescale/pinctrl-imx50.c | 9 -
 1 file changed, 9 deletions(-)

diff --git a/drivers/pinctrl/freescale/pinctrl-imx50.c 
b/drivers/pinctrl/freescale/pinctrl-imx50.c
index 95a36c88b66a..8e3a17df5c5d 100644
--- a/drivers/pinctrl/freescale/pinctrl-imx50.c
+++ b/drivers/pinctrl/freescale/pinctrl-imx50.c
@@ -14,7 +14,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -415,11 +414,3 @@ static int __init imx50_pinctrl_init(void)
return platform_driver_register(_pinctrl_driver);
 }
 arch_initcall(imx50_pinctrl_init);
-
-static void __exit imx50_pinctrl_exit(void)
-{
-   platform_driver_unregister(_pinctrl_driver);
-}
-module_exit(imx50_pinctrl_exit);
-MODULE_DESCRIPTION("Freescale IMX50 pinctrl driver");
-MODULE_LICENSE("GPL v2");
-- 
2.8.4



[PATCH 03/19] pinctrl: imx21: make it explicitly non-modular

2016-06-25 Thread Paul Gortmaker
The Kconfig currently controlling compilation of this code is:

drivers/pinctrl/freescale/Kconfig:config PINCTRL_IMX21
drivers/pinctrl/freescale/Kconfig:  bool "i.MX21 pinctrl driver"

...meaning that it currently is not being built as a module by anyone.

Lets remove the modular code that is essentially orphaned, so that
when reading the driver there is no doubt it is builtin-only.

Since module_platform_driver() uses the same init level priority as
builtin_platform_driver() the init ordering remains unchanged with
this commit.

We also delete the MODULE_LICENSE tag etc. since all that information
is already contained at the top of the file in the comments.

Cc: Linus Walleij 
Cc: Alexander Shiyan 
Cc: linux-g...@vger.kernel.org
Signed-off-by: Paul Gortmaker 
---
 drivers/pinctrl/freescale/pinctrl-imx21.c | 8 ++--
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/drivers/pinctrl/freescale/pinctrl-imx21.c 
b/drivers/pinctrl/freescale/pinctrl-imx21.c
index aa1221f4dbb7..b9f9b3b8eeb1 100644
--- a/drivers/pinctrl/freescale/pinctrl-imx21.c
+++ b/drivers/pinctrl/freescale/pinctrl-imx21.c
@@ -9,7 +9,7 @@
  * (at your option) any later version.
  */
 
-#include 
+#include 
 #include 
 #include 
 #include 
@@ -333,8 +333,4 @@ static struct platform_driver imx21_pinctrl_driver = {
.of_match_table = imx21_pinctrl_of_match,
},
 };
-module_platform_driver_probe(imx21_pinctrl_driver, imx21_pinctrl_probe);
-
-MODULE_AUTHOR("Alexander Shiyan ");
-MODULE_DESCRIPTION("Freescale i.MX21 pinctrl driver");
-MODULE_LICENSE("GPL");
+builtin_platform_driver_probe(imx21_pinctrl_driver, imx21_pinctrl_probe);
-- 
2.8.4



[PATCH 14/19] pinctrl: imx6ul: make it explicitly non-modular

2016-06-25 Thread Paul Gortmaker
The Kconfig currently controlling compilation of this code is:

drivers/pinctrl/freescale/Kconfig:config PINCTRL_IMX6UL
drivers/pinctrl/freescale/Kconfig:  bool "IMX6UL pinctrl driver"

...meaning that it currently is not being built as a module by anyone.

Lets remove the modular code that is essentially orphaned, so that
when reading the driver there is no doubt it is builtin-only.

Since module_init was not in use by this driver, the init ordering
remains unchanged with this commit.

We also delete the MODULE_LICENSE tag etc. since all that information
was (or is now) contained at the top of the file in the comments.

Cc: Linus Walleij 
Cc: Anson Huang 
Cc: linux-g...@vger.kernel.org
Signed-off-by: Paul Gortmaker 
---
 drivers/pinctrl/freescale/pinctrl-imx6ul.c | 14 +++---
 1 file changed, 3 insertions(+), 11 deletions(-)

diff --git a/drivers/pinctrl/freescale/pinctrl-imx6ul.c 
b/drivers/pinctrl/freescale/pinctrl-imx6ul.c
index c707fdd933ec..1aeb840aae1d 100644
--- a/drivers/pinctrl/freescale/pinctrl-imx6ul.c
+++ b/drivers/pinctrl/freescale/pinctrl-imx6ul.c
@@ -1,4 +1,7 @@
 /*
+ * Freescale imx6ul pinctrl driver
+ *
+ * Author: Anson Huang 
  * Copyright (C) 2015 Freescale Semiconductor, Inc.
  *
  * This program is free software; you can redistribute it and/or modify
@@ -9,7 +12,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -310,13 +312,3 @@ static int __init imx6ul_pinctrl_init(void)
return platform_driver_register(_pinctrl_driver);
 }
 arch_initcall(imx6ul_pinctrl_init);
-
-static void __exit imx6ul_pinctrl_exit(void)
-{
-   platform_driver_unregister(_pinctrl_driver);
-}
-module_exit(imx6ul_pinctrl_exit);
-
-MODULE_AUTHOR("Anson Huang ");
-MODULE_DESCRIPTION("Freescale imx6ul pinctrl driver");
-MODULE_LICENSE("GPL v2");
-- 
2.8.4



[PATCH 03/19] pinctrl: imx21: make it explicitly non-modular

2016-06-25 Thread Paul Gortmaker
The Kconfig currently controlling compilation of this code is:

drivers/pinctrl/freescale/Kconfig:config PINCTRL_IMX21
drivers/pinctrl/freescale/Kconfig:  bool "i.MX21 pinctrl driver"

...meaning that it currently is not being built as a module by anyone.

Lets remove the modular code that is essentially orphaned, so that
when reading the driver there is no doubt it is builtin-only.

Since module_platform_driver() uses the same init level priority as
builtin_platform_driver() the init ordering remains unchanged with
this commit.

We also delete the MODULE_LICENSE tag etc. since all that information
is already contained at the top of the file in the comments.

Cc: Linus Walleij 
Cc: Alexander Shiyan 
Cc: linux-g...@vger.kernel.org
Signed-off-by: Paul Gortmaker 
---
 drivers/pinctrl/freescale/pinctrl-imx21.c | 8 ++--
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/drivers/pinctrl/freescale/pinctrl-imx21.c 
b/drivers/pinctrl/freescale/pinctrl-imx21.c
index aa1221f4dbb7..b9f9b3b8eeb1 100644
--- a/drivers/pinctrl/freescale/pinctrl-imx21.c
+++ b/drivers/pinctrl/freescale/pinctrl-imx21.c
@@ -9,7 +9,7 @@
  * (at your option) any later version.
  */
 
-#include 
+#include 
 #include 
 #include 
 #include 
@@ -333,8 +333,4 @@ static struct platform_driver imx21_pinctrl_driver = {
.of_match_table = imx21_pinctrl_of_match,
},
 };
-module_platform_driver_probe(imx21_pinctrl_driver, imx21_pinctrl_probe);
-
-MODULE_AUTHOR("Alexander Shiyan ");
-MODULE_DESCRIPTION("Freescale i.MX21 pinctrl driver");
-MODULE_LICENSE("GPL");
+builtin_platform_driver_probe(imx21_pinctrl_driver, imx21_pinctrl_probe);
-- 
2.8.4



[PATCH 14/19] pinctrl: imx6ul: make it explicitly non-modular

2016-06-25 Thread Paul Gortmaker
The Kconfig currently controlling compilation of this code is:

drivers/pinctrl/freescale/Kconfig:config PINCTRL_IMX6UL
drivers/pinctrl/freescale/Kconfig:  bool "IMX6UL pinctrl driver"

...meaning that it currently is not being built as a module by anyone.

Lets remove the modular code that is essentially orphaned, so that
when reading the driver there is no doubt it is builtin-only.

Since module_init was not in use by this driver, the init ordering
remains unchanged with this commit.

We also delete the MODULE_LICENSE tag etc. since all that information
was (or is now) contained at the top of the file in the comments.

Cc: Linus Walleij 
Cc: Anson Huang 
Cc: linux-g...@vger.kernel.org
Signed-off-by: Paul Gortmaker 
---
 drivers/pinctrl/freescale/pinctrl-imx6ul.c | 14 +++---
 1 file changed, 3 insertions(+), 11 deletions(-)

diff --git a/drivers/pinctrl/freescale/pinctrl-imx6ul.c 
b/drivers/pinctrl/freescale/pinctrl-imx6ul.c
index c707fdd933ec..1aeb840aae1d 100644
--- a/drivers/pinctrl/freescale/pinctrl-imx6ul.c
+++ b/drivers/pinctrl/freescale/pinctrl-imx6ul.c
@@ -1,4 +1,7 @@
 /*
+ * Freescale imx6ul pinctrl driver
+ *
+ * Author: Anson Huang 
  * Copyright (C) 2015 Freescale Semiconductor, Inc.
  *
  * This program is free software; you can redistribute it and/or modify
@@ -9,7 +12,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -310,13 +312,3 @@ static int __init imx6ul_pinctrl_init(void)
return platform_driver_register(_pinctrl_driver);
 }
 arch_initcall(imx6ul_pinctrl_init);
-
-static void __exit imx6ul_pinctrl_exit(void)
-{
-   platform_driver_unregister(_pinctrl_driver);
-}
-module_exit(imx6ul_pinctrl_exit);
-
-MODULE_AUTHOR("Anson Huang ");
-MODULE_DESCRIPTION("Freescale imx6ul pinctrl driver");
-MODULE_LICENSE("GPL v2");
-- 
2.8.4



[PATCH 18/19] pinctrl: imx28: make it explicitly non-modular

2016-06-25 Thread Paul Gortmaker
The Kconfig currently controlling compilation of this code is:

drivers/pinctrl/freescale/Kconfig:config PINCTRL_IMX28
drivers/pinctrl/freescale/Kconfig:  bool

...meaning that it currently is not being built as a module by anyone.

Lets remove the modular code that is essentially orphaned, so that
when reading the driver there is no doubt it is builtin-only.

We explicitly disallow a driver unbind, since that doesn't have a
sensible use case anyway, and it allows us to drop the ".remove"
code for non-modular drivers.

Since module_init was not in use by this driver, the init ordering
remains unchanged with this commit.

Also note that MODULE_DEVICE_TABLE is a no-op for non-modular code.

We also delete the MODULE_LICENSE tag etc. since all that information
was (or is now) contained at the top of the file in the comments.

Cc: Linus Walleij 
Cc: Shawn Guo 
Cc: linux-g...@vger.kernel.org
Signed-off-by: Paul Gortmaker 
---
 drivers/pinctrl/freescale/pinctrl-imx28.c | 17 -
 1 file changed, 4 insertions(+), 13 deletions(-)

diff --git a/drivers/pinctrl/freescale/pinctrl-imx28.c 
b/drivers/pinctrl/freescale/pinctrl-imx28.c
index 5082efec4f72..295236dfb0bc 100644
--- a/drivers/pinctrl/freescale/pinctrl-imx28.c
+++ b/drivers/pinctrl/freescale/pinctrl-imx28.c
@@ -1,4 +1,7 @@
 /*
+ * Freescale i.MX28 pinctrl driver
+ *
+ * Author: Shawn Guo 
  * Copyright 2012 Freescale Semiconductor, Inc.
  *
  * The code contained herein is licensed under the GNU General Public
@@ -10,7 +13,6 @@
  */
 
 #include 
-#include 
 #include 
 #include 
 #include "pinctrl-mxs.h"
@@ -392,15 +394,14 @@ static const struct of_device_id imx28_pinctrl_of_match[] 
= {
{ .compatible = "fsl,imx28-pinctrl", },
{ /* sentinel */ }
 };
-MODULE_DEVICE_TABLE(of, imx28_pinctrl_of_match);
 
 static struct platform_driver imx28_pinctrl_driver = {
.driver = {
.name = "imx28-pinctrl",
+   .suppress_bind_attrs = true,
.of_match_table = imx28_pinctrl_of_match,
},
.probe = imx28_pinctrl_probe,
-   .remove = mxs_pinctrl_remove,
 };
 
 static int __init imx28_pinctrl_init(void)
@@ -408,13 +409,3 @@ static int __init imx28_pinctrl_init(void)
return platform_driver_register(_pinctrl_driver);
 }
 postcore_initcall(imx28_pinctrl_init);
-
-static void __exit imx28_pinctrl_exit(void)
-{
-   platform_driver_unregister(_pinctrl_driver);
-}
-module_exit(imx28_pinctrl_exit);
-
-MODULE_AUTHOR("Shawn Guo ");
-MODULE_DESCRIPTION("Freescale i.MX28 pinctrl driver");
-MODULE_LICENSE("GPL v2");
-- 
2.8.4



[PATCH 18/19] pinctrl: imx28: make it explicitly non-modular

2016-06-25 Thread Paul Gortmaker
The Kconfig currently controlling compilation of this code is:

drivers/pinctrl/freescale/Kconfig:config PINCTRL_IMX28
drivers/pinctrl/freescale/Kconfig:  bool

...meaning that it currently is not being built as a module by anyone.

Lets remove the modular code that is essentially orphaned, so that
when reading the driver there is no doubt it is builtin-only.

We explicitly disallow a driver unbind, since that doesn't have a
sensible use case anyway, and it allows us to drop the ".remove"
code for non-modular drivers.

Since module_init was not in use by this driver, the init ordering
remains unchanged with this commit.

Also note that MODULE_DEVICE_TABLE is a no-op for non-modular code.

We also delete the MODULE_LICENSE tag etc. since all that information
was (or is now) contained at the top of the file in the comments.

Cc: Linus Walleij 
Cc: Shawn Guo 
Cc: linux-g...@vger.kernel.org
Signed-off-by: Paul Gortmaker 
---
 drivers/pinctrl/freescale/pinctrl-imx28.c | 17 -
 1 file changed, 4 insertions(+), 13 deletions(-)

diff --git a/drivers/pinctrl/freescale/pinctrl-imx28.c 
b/drivers/pinctrl/freescale/pinctrl-imx28.c
index 5082efec4f72..295236dfb0bc 100644
--- a/drivers/pinctrl/freescale/pinctrl-imx28.c
+++ b/drivers/pinctrl/freescale/pinctrl-imx28.c
@@ -1,4 +1,7 @@
 /*
+ * Freescale i.MX28 pinctrl driver
+ *
+ * Author: Shawn Guo 
  * Copyright 2012 Freescale Semiconductor, Inc.
  *
  * The code contained herein is licensed under the GNU General Public
@@ -10,7 +13,6 @@
  */
 
 #include 
-#include 
 #include 
 #include 
 #include "pinctrl-mxs.h"
@@ -392,15 +394,14 @@ static const struct of_device_id imx28_pinctrl_of_match[] 
= {
{ .compatible = "fsl,imx28-pinctrl", },
{ /* sentinel */ }
 };
-MODULE_DEVICE_TABLE(of, imx28_pinctrl_of_match);
 
 static struct platform_driver imx28_pinctrl_driver = {
.driver = {
.name = "imx28-pinctrl",
+   .suppress_bind_attrs = true,
.of_match_table = imx28_pinctrl_of_match,
},
.probe = imx28_pinctrl_probe,
-   .remove = mxs_pinctrl_remove,
 };
 
 static int __init imx28_pinctrl_init(void)
@@ -408,13 +409,3 @@ static int __init imx28_pinctrl_init(void)
return platform_driver_register(_pinctrl_driver);
 }
 postcore_initcall(imx28_pinctrl_init);
-
-static void __exit imx28_pinctrl_exit(void)
-{
-   platform_driver_unregister(_pinctrl_driver);
-}
-module_exit(imx28_pinctrl_exit);
-
-MODULE_AUTHOR("Shawn Guo ");
-MODULE_DESCRIPTION("Freescale i.MX28 pinctrl driver");
-MODULE_LICENSE("GPL v2");
-- 
2.8.4



[PATCH 08/19] pinctrl: imx51: make it explicitly non-modular

2016-06-25 Thread Paul Gortmaker
The Kconfig currently controlling compilation of this code is:

drivers/pinctrl/freescale/Kconfig:config PINCTRL_IMX51
drivers/pinctrl/freescale/Kconfig:  bool "IMX51 pinctrl driver"

...meaning that it currently is not being built as a module by anyone.

Lets remove the modular code that is essentially orphaned, so that
when reading the driver there is no doubt it is builtin-only.

Since module_init was not in use by this driver, the init ordering
remains unchanged with this commit.

We also delete the MODULE_LICENSE tag etc. since all that information
is already contained at the top of the file in the comments.

Cc: Linus Walleij 
Cc: Dong Aisheng 
Cc: linux-g...@vger.kernel.org
Signed-off-by: Paul Gortmaker 
---
 drivers/pinctrl/freescale/pinctrl-imx51.c | 10 --
 1 file changed, 10 deletions(-)

diff --git a/drivers/pinctrl/freescale/pinctrl-imx51.c 
b/drivers/pinctrl/freescale/pinctrl-imx51.c
index 0863e5279896..eeac64ba2709 100644
--- a/drivers/pinctrl/freescale/pinctrl-imx51.c
+++ b/drivers/pinctrl/freescale/pinctrl-imx51.c
@@ -15,7 +15,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -791,12 +790,3 @@ static int __init imx51_pinctrl_init(void)
return platform_driver_register(_pinctrl_driver);
 }
 arch_initcall(imx51_pinctrl_init);
-
-static void __exit imx51_pinctrl_exit(void)
-{
-   platform_driver_unregister(_pinctrl_driver);
-}
-module_exit(imx51_pinctrl_exit);
-MODULE_AUTHOR("Dong Aisheng ");
-MODULE_DESCRIPTION("Freescale IMX51 pinctrl driver");
-MODULE_LICENSE("GPL v2");
-- 
2.8.4



[PATCH 13/19] pinctrl: imx6sx: make it explicitly non-modular

2016-06-25 Thread Paul Gortmaker
The Kconfig currently controlling compilation of this code is:

drivers/pinctrl/freescale/Kconfig:config PINCTRL_IMX6SX
drivers/pinctrl/freescale/Kconfig:  bool "IMX6SX pinctrl driver"

...meaning that it currently is not being built as a module by anyone.

Lets remove the modular code that is essentially orphaned, so that
when reading the driver there is no doubt it is builtin-only.

Since module_init was not in use by this driver, the init ordering
remains unchanged with this commit.

We also delete the MODULE_LICENSE tag etc. since all that information
was (or is now) contained at the top of the file in the comments.

Cc: Linus Walleij 
Cc: Anson Huang 
Cc: linux-g...@vger.kernel.org
Signed-off-by: Paul Gortmaker 
---
 drivers/pinctrl/freescale/pinctrl-imx6sx.c | 14 +++---
 1 file changed, 3 insertions(+), 11 deletions(-)

diff --git a/drivers/pinctrl/freescale/pinctrl-imx6sx.c 
b/drivers/pinctrl/freescale/pinctrl-imx6sx.c
index 84118c388cc5..898b781701e6 100644
--- a/drivers/pinctrl/freescale/pinctrl-imx6sx.c
+++ b/drivers/pinctrl/freescale/pinctrl-imx6sx.c
@@ -1,4 +1,7 @@
 /*
+ * Freescale imx6sx pinctrl driver
+ *
+ * Author: Anson Huang 
  * Copyright (C) 2014 Freescale Semiconductor, Inc.
  *
  * This program is free software; you can redistribute it and/or modify
@@ -9,7 +12,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -394,13 +396,3 @@ static int __init imx6sx_pinctrl_init(void)
return platform_driver_register(_pinctrl_driver);
 }
 arch_initcall(imx6sx_pinctrl_init);
-
-static void __exit imx6sx_pinctrl_exit(void)
-{
-   platform_driver_unregister(_pinctrl_driver);
-}
-module_exit(imx6sx_pinctrl_exit);
-
-MODULE_AUTHOR("Anson Huang ");
-MODULE_DESCRIPTION("Freescale imx6sx pinctrl driver");
-MODULE_LICENSE("GPL v2");
-- 
2.8.4



[PATCH 13/19] pinctrl: imx6sx: make it explicitly non-modular

2016-06-25 Thread Paul Gortmaker
The Kconfig currently controlling compilation of this code is:

drivers/pinctrl/freescale/Kconfig:config PINCTRL_IMX6SX
drivers/pinctrl/freescale/Kconfig:  bool "IMX6SX pinctrl driver"

...meaning that it currently is not being built as a module by anyone.

Lets remove the modular code that is essentially orphaned, so that
when reading the driver there is no doubt it is builtin-only.

Since module_init was not in use by this driver, the init ordering
remains unchanged with this commit.

We also delete the MODULE_LICENSE tag etc. since all that information
was (or is now) contained at the top of the file in the comments.

Cc: Linus Walleij 
Cc: Anson Huang 
Cc: linux-g...@vger.kernel.org
Signed-off-by: Paul Gortmaker 
---
 drivers/pinctrl/freescale/pinctrl-imx6sx.c | 14 +++---
 1 file changed, 3 insertions(+), 11 deletions(-)

diff --git a/drivers/pinctrl/freescale/pinctrl-imx6sx.c 
b/drivers/pinctrl/freescale/pinctrl-imx6sx.c
index 84118c388cc5..898b781701e6 100644
--- a/drivers/pinctrl/freescale/pinctrl-imx6sx.c
+++ b/drivers/pinctrl/freescale/pinctrl-imx6sx.c
@@ -1,4 +1,7 @@
 /*
+ * Freescale imx6sx pinctrl driver
+ *
+ * Author: Anson Huang 
  * Copyright (C) 2014 Freescale Semiconductor, Inc.
  *
  * This program is free software; you can redistribute it and/or modify
@@ -9,7 +12,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -394,13 +396,3 @@ static int __init imx6sx_pinctrl_init(void)
return platform_driver_register(_pinctrl_driver);
 }
 arch_initcall(imx6sx_pinctrl_init);
-
-static void __exit imx6sx_pinctrl_exit(void)
-{
-   platform_driver_unregister(_pinctrl_driver);
-}
-module_exit(imx6sx_pinctrl_exit);
-
-MODULE_AUTHOR("Anson Huang ");
-MODULE_DESCRIPTION("Freescale imx6sx pinctrl driver");
-MODULE_LICENSE("GPL v2");
-- 
2.8.4



[PATCH 08/19] pinctrl: imx51: make it explicitly non-modular

2016-06-25 Thread Paul Gortmaker
The Kconfig currently controlling compilation of this code is:

drivers/pinctrl/freescale/Kconfig:config PINCTRL_IMX51
drivers/pinctrl/freescale/Kconfig:  bool "IMX51 pinctrl driver"

...meaning that it currently is not being built as a module by anyone.

Lets remove the modular code that is essentially orphaned, so that
when reading the driver there is no doubt it is builtin-only.

Since module_init was not in use by this driver, the init ordering
remains unchanged with this commit.

We also delete the MODULE_LICENSE tag etc. since all that information
is already contained at the top of the file in the comments.

Cc: Linus Walleij 
Cc: Dong Aisheng 
Cc: linux-g...@vger.kernel.org
Signed-off-by: Paul Gortmaker 
---
 drivers/pinctrl/freescale/pinctrl-imx51.c | 10 --
 1 file changed, 10 deletions(-)

diff --git a/drivers/pinctrl/freescale/pinctrl-imx51.c 
b/drivers/pinctrl/freescale/pinctrl-imx51.c
index 0863e5279896..eeac64ba2709 100644
--- a/drivers/pinctrl/freescale/pinctrl-imx51.c
+++ b/drivers/pinctrl/freescale/pinctrl-imx51.c
@@ -15,7 +15,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -791,12 +790,3 @@ static int __init imx51_pinctrl_init(void)
return platform_driver_register(_pinctrl_driver);
 }
 arch_initcall(imx51_pinctrl_init);
-
-static void __exit imx51_pinctrl_exit(void)
-{
-   platform_driver_unregister(_pinctrl_driver);
-}
-module_exit(imx51_pinctrl_exit);
-MODULE_AUTHOR("Dong Aisheng ");
-MODULE_DESCRIPTION("Freescale IMX51 pinctrl driver");
-MODULE_LICENSE("GPL v2");
-- 
2.8.4



[PATCH 02/19] pinctrl: imx1: make it explicitly non-modular

2016-06-25 Thread Paul Gortmaker
The Kconfig currently controlling compilation of this code is:

drivers/pinctrl/freescale/Kconfig:config PINCTRL_IMX1
drivers/pinctrl/freescale/Kconfig:  bool "IMX1 pinctrl driver"

...meaning that it currently is not being built as a module by anyone.

Lets remove the modular code that is essentially orphaned, so that
when reading the driver there is no doubt it is builtin-only.

Since module_platform_driver() uses the same init level priority as
builtin_platform_driver() the init ordering remains unchanged with
this commit.

Also note that MODULE_DEVICE_TABLE is a no-op for non-modular code.

We also delete the MODULE_LICENSE tag etc. since all that information
is already contained at the top of the file in the comments.

Cc: Linus Walleij 
Cc: Alexander Shiyan 
Cc: linux-g...@vger.kernel.org
Signed-off-by: Paul Gortmaker 
---
 drivers/pinctrl/freescale/pinctrl-imx1.c | 9 ++---
 1 file changed, 2 insertions(+), 7 deletions(-)

diff --git a/drivers/pinctrl/freescale/pinctrl-imx1.c 
b/drivers/pinctrl/freescale/pinctrl-imx1.c
index 04723455db58..fc8efc748734 100644
--- a/drivers/pinctrl/freescale/pinctrl-imx1.c
+++ b/drivers/pinctrl/freescale/pinctrl-imx1.c
@@ -9,7 +9,7 @@
  * (at your option) any later version.
  */
 
-#include 
+#include 
 #include 
 #include 
 #include 
@@ -262,7 +262,6 @@ static const struct of_device_id imx1_pinctrl_of_match[] = {
{ .compatible = "fsl,imx1-iomuxc", },
{ }
 };
-MODULE_DEVICE_TABLE(of, imx1_pinctrl_of_match);
 
 static struct platform_driver imx1_pinctrl_driver = {
.driver = {
@@ -270,8 +269,4 @@ static struct platform_driver imx1_pinctrl_driver = {
.of_match_table = imx1_pinctrl_of_match,
},
 };
-module_platform_driver_probe(imx1_pinctrl_driver, imx1_pinctrl_probe);
-
-MODULE_AUTHOR("Alexander Shiyan ");
-MODULE_DESCRIPTION("Freescale i.MX1 pinctrl driver");
-MODULE_LICENSE("GPL");
+builtin_platform_driver_probe(imx1_pinctrl_driver, imx1_pinctrl_probe);
-- 
2.8.4



[PATCH 09/19] pinctrl: imx53: make it explicitly non-modular

2016-06-25 Thread Paul Gortmaker
The Kconfig currently controlling compilation of this code is:

drivers/pinctrl/freescale/Kconfig:config PINCTRL_IMX53
drivers/pinctrl/freescale/Kconfig:  bool "IMX53 pinctrl driver"

...meaning that it currently is not being built as a module by anyone.

Lets remove the modular code that is essentially orphaned, so that
when reading the driver there is no doubt it is builtin-only.

Since module_init was not in use by this driver, the init ordering
remains unchanged with this commit.

We also delete the MODULE_LICENSE tag etc. since all that information
is already contained at the top of the file in the comments.

Cc: Linus Walleij 
Cc: Dong Aisheng 
Cc: linux-g...@vger.kernel.org
Signed-off-by: Paul Gortmaker 
---
 drivers/pinctrl/freescale/pinctrl-imx53.c | 10 --
 1 file changed, 10 deletions(-)

diff --git a/drivers/pinctrl/freescale/pinctrl-imx53.c 
b/drivers/pinctrl/freescale/pinctrl-imx53.c
index 64c9cbe2a5df..46a9572f3473 100644
--- a/drivers/pinctrl/freescale/pinctrl-imx53.c
+++ b/drivers/pinctrl/freescale/pinctrl-imx53.c
@@ -15,7 +15,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -478,12 +477,3 @@ static int __init imx53_pinctrl_init(void)
return platform_driver_register(_pinctrl_driver);
 }
 arch_initcall(imx53_pinctrl_init);
-
-static void __exit imx53_pinctrl_exit(void)
-{
-   platform_driver_unregister(_pinctrl_driver);
-}
-module_exit(imx53_pinctrl_exit);
-MODULE_AUTHOR("Dong Aisheng ");
-MODULE_DESCRIPTION("Freescale IMX53 pinctrl driver");
-MODULE_LICENSE("GPL v2");
-- 
2.8.4



[PATCH 10/19] pinctrl: imx6dl: make it explicitly non-modular

2016-06-25 Thread Paul Gortmaker
The Kconfig currently controlling compilation of this code is:

drivers/pinctrl/freescale/Kconfig:config PINCTRL_IMX6Q
drivers/pinctrl/freescale/Kconfig:  bool "IMX6Q/DL pinctrl driver"

...meaning that it currently is not being built as a module by anyone.

Lets remove the modular code that is essentially orphaned, so that
when reading the driver there is no doubt it is builtin-only.

Since module_init was not in use by this driver, the init ordering
remains unchanged with this commit.

We also delete the MODULE_LICENSE tag etc. since all that information
was (or is now) contained at the top of the file in the comments.

Cc: Linus Walleij 
Cc: Shawn Guo 
Cc: linux-g...@vger.kernel.org
Signed-off-by: Paul Gortmaker 
---
 drivers/pinctrl/freescale/pinctrl-imx6dl.c | 14 +++---
 1 file changed, 3 insertions(+), 11 deletions(-)

diff --git a/drivers/pinctrl/freescale/pinctrl-imx6dl.c 
b/drivers/pinctrl/freescale/pinctrl-imx6dl.c
index de17bac8ad89..3f25ca5867cc 100644
--- a/drivers/pinctrl/freescale/pinctrl-imx6dl.c
+++ b/drivers/pinctrl/freescale/pinctrl-imx6dl.c
@@ -1,4 +1,7 @@
 /*
+ * Freescale imx6dl pinctrl driver
+ *
+ * Author: Shawn Guo 
  * Copyright (C) 2013 Freescale Semiconductor, Inc.
  *
  * This program is free software; you can redistribute it and/or modify
@@ -9,7 +12,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -484,13 +486,3 @@ static int __init imx6dl_pinctrl_init(void)
return platform_driver_register(_pinctrl_driver);
 }
 arch_initcall(imx6dl_pinctrl_init);
-
-static void __exit imx6dl_pinctrl_exit(void)
-{
-   platform_driver_unregister(_pinctrl_driver);
-}
-module_exit(imx6dl_pinctrl_exit);
-
-MODULE_AUTHOR("Shawn Guo ");
-MODULE_DESCRIPTION("Freescale imx6dl pinctrl driver");
-MODULE_LICENSE("GPL v2");
-- 
2.8.4



[PATCH 02/19] pinctrl: imx1: make it explicitly non-modular

2016-06-25 Thread Paul Gortmaker
The Kconfig currently controlling compilation of this code is:

drivers/pinctrl/freescale/Kconfig:config PINCTRL_IMX1
drivers/pinctrl/freescale/Kconfig:  bool "IMX1 pinctrl driver"

...meaning that it currently is not being built as a module by anyone.

Lets remove the modular code that is essentially orphaned, so that
when reading the driver there is no doubt it is builtin-only.

Since module_platform_driver() uses the same init level priority as
builtin_platform_driver() the init ordering remains unchanged with
this commit.

Also note that MODULE_DEVICE_TABLE is a no-op for non-modular code.

We also delete the MODULE_LICENSE tag etc. since all that information
is already contained at the top of the file in the comments.

Cc: Linus Walleij 
Cc: Alexander Shiyan 
Cc: linux-g...@vger.kernel.org
Signed-off-by: Paul Gortmaker 
---
 drivers/pinctrl/freescale/pinctrl-imx1.c | 9 ++---
 1 file changed, 2 insertions(+), 7 deletions(-)

diff --git a/drivers/pinctrl/freescale/pinctrl-imx1.c 
b/drivers/pinctrl/freescale/pinctrl-imx1.c
index 04723455db58..fc8efc748734 100644
--- a/drivers/pinctrl/freescale/pinctrl-imx1.c
+++ b/drivers/pinctrl/freescale/pinctrl-imx1.c
@@ -9,7 +9,7 @@
  * (at your option) any later version.
  */
 
-#include 
+#include 
 #include 
 #include 
 #include 
@@ -262,7 +262,6 @@ static const struct of_device_id imx1_pinctrl_of_match[] = {
{ .compatible = "fsl,imx1-iomuxc", },
{ }
 };
-MODULE_DEVICE_TABLE(of, imx1_pinctrl_of_match);
 
 static struct platform_driver imx1_pinctrl_driver = {
.driver = {
@@ -270,8 +269,4 @@ static struct platform_driver imx1_pinctrl_driver = {
.of_match_table = imx1_pinctrl_of_match,
},
 };
-module_platform_driver_probe(imx1_pinctrl_driver, imx1_pinctrl_probe);
-
-MODULE_AUTHOR("Alexander Shiyan ");
-MODULE_DESCRIPTION("Freescale i.MX1 pinctrl driver");
-MODULE_LICENSE("GPL");
+builtin_platform_driver_probe(imx1_pinctrl_driver, imx1_pinctrl_probe);
-- 
2.8.4



[PATCH 09/19] pinctrl: imx53: make it explicitly non-modular

2016-06-25 Thread Paul Gortmaker
The Kconfig currently controlling compilation of this code is:

drivers/pinctrl/freescale/Kconfig:config PINCTRL_IMX53
drivers/pinctrl/freescale/Kconfig:  bool "IMX53 pinctrl driver"

...meaning that it currently is not being built as a module by anyone.

Lets remove the modular code that is essentially orphaned, so that
when reading the driver there is no doubt it is builtin-only.

Since module_init was not in use by this driver, the init ordering
remains unchanged with this commit.

We also delete the MODULE_LICENSE tag etc. since all that information
is already contained at the top of the file in the comments.

Cc: Linus Walleij 
Cc: Dong Aisheng 
Cc: linux-g...@vger.kernel.org
Signed-off-by: Paul Gortmaker 
---
 drivers/pinctrl/freescale/pinctrl-imx53.c | 10 --
 1 file changed, 10 deletions(-)

diff --git a/drivers/pinctrl/freescale/pinctrl-imx53.c 
b/drivers/pinctrl/freescale/pinctrl-imx53.c
index 64c9cbe2a5df..46a9572f3473 100644
--- a/drivers/pinctrl/freescale/pinctrl-imx53.c
+++ b/drivers/pinctrl/freescale/pinctrl-imx53.c
@@ -15,7 +15,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -478,12 +477,3 @@ static int __init imx53_pinctrl_init(void)
return platform_driver_register(_pinctrl_driver);
 }
 arch_initcall(imx53_pinctrl_init);
-
-static void __exit imx53_pinctrl_exit(void)
-{
-   platform_driver_unregister(_pinctrl_driver);
-}
-module_exit(imx53_pinctrl_exit);
-MODULE_AUTHOR("Dong Aisheng ");
-MODULE_DESCRIPTION("Freescale IMX53 pinctrl driver");
-MODULE_LICENSE("GPL v2");
-- 
2.8.4



[PATCH 10/19] pinctrl: imx6dl: make it explicitly non-modular

2016-06-25 Thread Paul Gortmaker
The Kconfig currently controlling compilation of this code is:

drivers/pinctrl/freescale/Kconfig:config PINCTRL_IMX6Q
drivers/pinctrl/freescale/Kconfig:  bool "IMX6Q/DL pinctrl driver"

...meaning that it currently is not being built as a module by anyone.

Lets remove the modular code that is essentially orphaned, so that
when reading the driver there is no doubt it is builtin-only.

Since module_init was not in use by this driver, the init ordering
remains unchanged with this commit.

We also delete the MODULE_LICENSE tag etc. since all that information
was (or is now) contained at the top of the file in the comments.

Cc: Linus Walleij 
Cc: Shawn Guo 
Cc: linux-g...@vger.kernel.org
Signed-off-by: Paul Gortmaker 
---
 drivers/pinctrl/freescale/pinctrl-imx6dl.c | 14 +++---
 1 file changed, 3 insertions(+), 11 deletions(-)

diff --git a/drivers/pinctrl/freescale/pinctrl-imx6dl.c 
b/drivers/pinctrl/freescale/pinctrl-imx6dl.c
index de17bac8ad89..3f25ca5867cc 100644
--- a/drivers/pinctrl/freescale/pinctrl-imx6dl.c
+++ b/drivers/pinctrl/freescale/pinctrl-imx6dl.c
@@ -1,4 +1,7 @@
 /*
+ * Freescale imx6dl pinctrl driver
+ *
+ * Author: Shawn Guo 
  * Copyright (C) 2013 Freescale Semiconductor, Inc.
  *
  * This program is free software; you can redistribute it and/or modify
@@ -9,7 +12,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -484,13 +486,3 @@ static int __init imx6dl_pinctrl_init(void)
return platform_driver_register(_pinctrl_driver);
 }
 arch_initcall(imx6dl_pinctrl_init);
-
-static void __exit imx6dl_pinctrl_exit(void)
-{
-   platform_driver_unregister(_pinctrl_driver);
-}
-module_exit(imx6dl_pinctrl_exit);
-
-MODULE_AUTHOR("Shawn Guo ");
-MODULE_DESCRIPTION("Freescale imx6dl pinctrl driver");
-MODULE_LICENSE("GPL v2");
-- 
2.8.4



[PATCH 15/19] pinctrl: imx7d: make it explicitly non-modular

2016-06-25 Thread Paul Gortmaker
The Kconfig currently controlling compilation of this code is:

drivers/pinctrl/freescale/Kconfig:config PINCTRL_IMX7D
drivers/pinctrl/freescale/Kconfig:  bool "IMX7D pinctrl driver"

...meaning that it currently is not being built as a module by anyone.

Lets remove the modular code that is essentially orphaned, so that
when reading the driver there is no doubt it is builtin-only.

Since module_init was not in use by this driver, the init ordering
remains unchanged with this commit.

We also delete the MODULE_LICENSE tag etc. since all that information
was (or is now) contained at the top of the file in the comments.

Cc: Linus Walleij 
Cc: Anson Huang 
Cc: linux-g...@vger.kernel.org
Signed-off-by: Paul Gortmaker 
---
 drivers/pinctrl/freescale/pinctrl-imx7d.c | 14 +++---
 1 file changed, 3 insertions(+), 11 deletions(-)

diff --git a/drivers/pinctrl/freescale/pinctrl-imx7d.c 
b/drivers/pinctrl/freescale/pinctrl-imx7d.c
index d30d91f80dfd..a465a66c3ef4 100644
--- a/drivers/pinctrl/freescale/pinctrl-imx7d.c
+++ b/drivers/pinctrl/freescale/pinctrl-imx7d.c
@@ -1,4 +1,7 @@
 /*
+ * Freescale imx7d pinctrl driver
+ *
+ * Author: Anson Huang 
  * Copyright (C) 2014-2015 Freescale Semiconductor, Inc.
  *
  * This program is free software; you can redistribute it and/or modify
@@ -9,7 +12,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -402,13 +404,3 @@ static int __init imx7d_pinctrl_init(void)
return platform_driver_register(_pinctrl_driver);
 }
 arch_initcall(imx7d_pinctrl_init);
-
-static void __exit imx7d_pinctrl_exit(void)
-{
-   platform_driver_unregister(_pinctrl_driver);
-}
-module_exit(imx7d_pinctrl_exit);
-
-MODULE_AUTHOR("Anson Huang ");
-MODULE_DESCRIPTION("Freescale imx7d pinctrl driver");
-MODULE_LICENSE("GPL v2");
-- 
2.8.4



[PATCH 11/19] pinctrl: imx6q: make it explicitly non-modular

2016-06-25 Thread Paul Gortmaker
The Kconfig currently controlling compilation of this code is:

drivers/pinctrl/freescale/Kconfig:config PINCTRL_IMX6Q
drivers/pinctrl/freescale/Kconfig:  bool "IMX6Q/DL pinctrl driver"

...meaning that it currently is not being built as a module by anyone.

Lets remove the modular code that is essentially orphaned, so that
when reading the driver there is no doubt it is builtin-only.

Since module_init translates to device_initcall in the non-modular
case, the init ordering remains unchanged with this commit.

We don't replace module.h with init.h since the file already has that.
But we do add export.h since this file uses the global THIS_MODULE.

We also delete the MODULE_LICENSE tag etc. since all that information
is already contained at the top of the file in the comments.

Cc: Linus Walleij 
Cc: Dong Aisheng 
Cc: linux-g...@vger.kernel.org
Signed-off-by: Paul Gortmaker 
---
 drivers/pinctrl/freescale/pinctrl-imx6q.c | 10 --
 1 file changed, 10 deletions(-)

diff --git a/drivers/pinctrl/freescale/pinctrl-imx6q.c 
b/drivers/pinctrl/freescale/pinctrl-imx6q.c
index 55cd8a0e367d..d61651c40458 100644
--- a/drivers/pinctrl/freescale/pinctrl-imx6q.c
+++ b/drivers/pinctrl/freescale/pinctrl-imx6q.c
@@ -15,7 +15,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -490,12 +489,3 @@ static int __init imx6q_pinctrl_init(void)
return platform_driver_register(_pinctrl_driver);
 }
 arch_initcall(imx6q_pinctrl_init);
-
-static void __exit imx6q_pinctrl_exit(void)
-{
-   platform_driver_unregister(_pinctrl_driver);
-}
-module_exit(imx6q_pinctrl_exit);
-MODULE_AUTHOR("Dong Aisheng ");
-MODULE_DESCRIPTION("Freescale IMX6Q pinctrl driver");
-MODULE_LICENSE("GPL v2");
-- 
2.8.4



[PATCH 12/19] pinctrl: imx6sl: make it explicitly non-modular

2016-06-25 Thread Paul Gortmaker
The Kconfig currently controlling compilation of this code is:

drivers/pinctrl/freescale/Kconfig:config PINCTRL_IMX6SL
drivers/pinctrl/freescale/Kconfig:  bool "IMX6SL pinctrl driver"

...meaning that it currently is not being built as a module by anyone.

Lets remove the modular code that is essentially orphaned, so that
when reading the driver there is no doubt it is builtin-only.

Since module_init was not in use by this driver, the init ordering
remains unchanged with this commit.

Also note that MODULE_DEVICE_TABLE is a no-op for non-modular code.

We also delete the MODULE_LICENSE tag etc. since all that information
was (or is now) contained at the top of the file in the comments.

Cc: Linus Walleij 
Cc: Shawn Guo 
Cc: linux-g...@vger.kernel.org
Signed-off-by: Paul Gortmaker 
---
 drivers/pinctrl/freescale/pinctrl-imx6sl.c | 15 +++
 1 file changed, 3 insertions(+), 12 deletions(-)

diff --git a/drivers/pinctrl/freescale/pinctrl-imx6sl.c 
b/drivers/pinctrl/freescale/pinctrl-imx6sl.c
index bf455b8e73fc..d023f6b00623 100644
--- a/drivers/pinctrl/freescale/pinctrl-imx6sl.c
+++ b/drivers/pinctrl/freescale/pinctrl-imx6sl.c
@@ -1,4 +1,7 @@
 /*
+ * Freescale imx6sl pinctrl driver
+ *
+ * Author: Shawn Guo 
  * Copyright (C) 2013 Freescale Semiconductor, Inc.
  *
  * This program is free software; you can redistribute it and/or modify
@@ -9,7 +12,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -371,7 +373,6 @@ static const struct of_device_id imx6sl_pinctrl_of_match[] 
= {
{ .compatible = "fsl,imx6sl-iomuxc", },
{ /* sentinel */ }
 };
-MODULE_DEVICE_TABLE(of, imx6sl_pinctrl_of_match);
 
 static int imx6sl_pinctrl_probe(struct platform_device *pdev)
 {
@@ -391,13 +392,3 @@ static int __init imx6sl_pinctrl_init(void)
return platform_driver_register(_pinctrl_driver);
 }
 arch_initcall(imx6sl_pinctrl_init);
-
-static void __exit imx6sl_pinctrl_exit(void)
-{
-   platform_driver_unregister(_pinctrl_driver);
-}
-module_exit(imx6sl_pinctrl_exit);
-
-MODULE_AUTHOR("Shawn Guo ");
-MODULE_DESCRIPTION("Freescale imx6sl pinctrl driver");
-MODULE_LICENSE("GPL v2");
-- 
2.8.4



[PATCH 00/19] pinctrl/freescale: fix module usage in non-modular code

2016-06-25 Thread Paul Gortmaker
This series covers the audit of non-modular module code use in the
drivers/pinctrl/freescale directory.  It has a few more commits than
I'd normally like in a single series, but fortunately the most of them
are dead simple.  That said, I can put the branch on kernel.org if
that makes life easier for merge processing, given the quantity.

FWIW, I originally had [locally] treated this whole Fsl directory as a
single patch, but upon reflection that didn't seem right either, given
the various authors, and the size of the combined changeset virtually
ensured that nobody Cc'd would genuinely review it all.  So 19 it is.

The changes in the drivers for #2-#16 inclusive are just removing the
module.h include, the unused exit function, and the no-op AUTHOR/LICENSE
tags with the occasional no-op MODULE_DEVICE_TABLE remove sprinkled in.

Only the imx23 and imx28 drivers still linked in a ".remove" function
(a shared one) and that usage is phased out in the patch #17 and #18,
where we also block sysfs unbind.  We get rid of the shared fcn in #19.

Quasi generic boiler plate description follows; included for folks who
haven't yet seen what we are aiming to achieve with this operation.

We are trying to not use module support for code that can never be built
as a module because:

 (1) it is easy to accidentally write unused module_exit and remove code
 (2) it can be misleading when reading the source, thinking it can be
 modular when the Makefile and/or Kconfig prohibit it
 (3) it requires the include of the module.h header file which in turn
 includes nearly everything else, thus adding to CPP overhead.
 (4) it gets copied/replicated into other code and spreads like weeds.

The freescale directory is a good example of #4, since all the
drivers seem to share a common heritage from one driver that had the
fundamental Kconfig vs. code mismatch originally (probably imx1).

Changes seen here cover the following categories:

  -just replacement of modular macros with their non-modular
   equivalents that CPP would have inserted anyway

  -the removal of including module.h ; replaced with init.h
   and/or export.h as required based on whether the file used it.

  -the removal of any/all unused/orphaned __exit functions that
   would never be called.

  -the removal of any ".remove" functions that were hooked into
   the driver struct.   This ".remove" function would of
   course not be called from the __exit function since that was
   never run.  However in theory, someone could have triggered it
   via sysfs unbind, even though there isn't a sensible use case
   for doing so.  So to cover that possibility, we've also disabled
   sysfs unbind in the driver.  [only imx23 and imx28]

There are no initcall level changes here; everything stays at the level
of initcall it was previously - either by not using modular versions to
begin with, or by using the builtin level equivalents.

As usual, we can consider making some of these tristate if the author
has strong feelings about extending support into the modular realm,
but I won't be able to run-time test any of that.

Build testing done on linux-next (on arm) as usual.

Paul.
---

Cc: Alexander Shiyan 
Cc: Anson Huang 
Cc: Denis Carikli 
Cc: Dong Aisheng 
Cc: Linus Walleij 
Cc: Markus Pargmann 
Cc: Shawn Guo 
Cc: linux-g...@vger.kernel.org

Paul Gortmaker (19):
  pinctrl: freescale: remove needless module.h include
  pinctrl: imx1: make it explicitly non-modular
  pinctrl: imx21: make it explicitly non-modular
  pinctrl: imx25: make it explicitly non-modular
  pinctrl: imx27: make it explicitly non-modular
  pinctrl: imx35: make it explicitly non-modular
  pinctrl: imx50: make it explicitly non-modular
  pinctrl: imx51: make it explicitly non-modular
  pinctrl: imx53: make it explicitly non-modular
  pinctrl: imx6dl: make it explicitly non-modular
  pinctrl: imx6q: make it explicitly non-modular
  pinctrl: imx6sl: make it explicitly non-modular
  pinctrl: imx6sx: make it explicitly non-modular
  pinctrl: imx6ul: make it explicitly non-modular
  pinctrl: imx7d: make it explicitly non-modular
  pinctrl: vf610: make it explicitly non-modular
  pinctrl: imx23: make it explicitly non-modular
  pinctrl: imx28: make it explicitly non-modular
  pinctrl: remove orphaned exported ".remove" function

 drivers/pinctrl/freescale/pinctrl-imx.c   |  1 -
 drivers/pinctrl/freescale/pinctrl-imx1-core.c |  1 -
 drivers/pinctrl/freescale/pinctrl-imx1.c  |  9 ++---
 drivers/pinctrl/freescale/pinctrl-imx21.c |  8 ++--
 drivers/pinctrl/freescale/pinctrl-imx23.c | 17 -
 drivers/pinctrl/freescale/pinctrl-imx25.c | 10 --
 drivers/pinctrl/freescale/pinctrl-imx27.c | 10 --
 drivers/pinctrl/freescale/pinctrl-imx28.c | 17 -
 

[PATCH 15/19] pinctrl: imx7d: make it explicitly non-modular

2016-06-25 Thread Paul Gortmaker
The Kconfig currently controlling compilation of this code is:

drivers/pinctrl/freescale/Kconfig:config PINCTRL_IMX7D
drivers/pinctrl/freescale/Kconfig:  bool "IMX7D pinctrl driver"

...meaning that it currently is not being built as a module by anyone.

Lets remove the modular code that is essentially orphaned, so that
when reading the driver there is no doubt it is builtin-only.

Since module_init was not in use by this driver, the init ordering
remains unchanged with this commit.

We also delete the MODULE_LICENSE tag etc. since all that information
was (or is now) contained at the top of the file in the comments.

Cc: Linus Walleij 
Cc: Anson Huang 
Cc: linux-g...@vger.kernel.org
Signed-off-by: Paul Gortmaker 
---
 drivers/pinctrl/freescale/pinctrl-imx7d.c | 14 +++---
 1 file changed, 3 insertions(+), 11 deletions(-)

diff --git a/drivers/pinctrl/freescale/pinctrl-imx7d.c 
b/drivers/pinctrl/freescale/pinctrl-imx7d.c
index d30d91f80dfd..a465a66c3ef4 100644
--- a/drivers/pinctrl/freescale/pinctrl-imx7d.c
+++ b/drivers/pinctrl/freescale/pinctrl-imx7d.c
@@ -1,4 +1,7 @@
 /*
+ * Freescale imx7d pinctrl driver
+ *
+ * Author: Anson Huang 
  * Copyright (C) 2014-2015 Freescale Semiconductor, Inc.
  *
  * This program is free software; you can redistribute it and/or modify
@@ -9,7 +12,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -402,13 +404,3 @@ static int __init imx7d_pinctrl_init(void)
return platform_driver_register(_pinctrl_driver);
 }
 arch_initcall(imx7d_pinctrl_init);
-
-static void __exit imx7d_pinctrl_exit(void)
-{
-   platform_driver_unregister(_pinctrl_driver);
-}
-module_exit(imx7d_pinctrl_exit);
-
-MODULE_AUTHOR("Anson Huang ");
-MODULE_DESCRIPTION("Freescale imx7d pinctrl driver");
-MODULE_LICENSE("GPL v2");
-- 
2.8.4



[PATCH 11/19] pinctrl: imx6q: make it explicitly non-modular

2016-06-25 Thread Paul Gortmaker
The Kconfig currently controlling compilation of this code is:

drivers/pinctrl/freescale/Kconfig:config PINCTRL_IMX6Q
drivers/pinctrl/freescale/Kconfig:  bool "IMX6Q/DL pinctrl driver"

...meaning that it currently is not being built as a module by anyone.

Lets remove the modular code that is essentially orphaned, so that
when reading the driver there is no doubt it is builtin-only.

Since module_init translates to device_initcall in the non-modular
case, the init ordering remains unchanged with this commit.

We don't replace module.h with init.h since the file already has that.
But we do add export.h since this file uses the global THIS_MODULE.

We also delete the MODULE_LICENSE tag etc. since all that information
is already contained at the top of the file in the comments.

Cc: Linus Walleij 
Cc: Dong Aisheng 
Cc: linux-g...@vger.kernel.org
Signed-off-by: Paul Gortmaker 
---
 drivers/pinctrl/freescale/pinctrl-imx6q.c | 10 --
 1 file changed, 10 deletions(-)

diff --git a/drivers/pinctrl/freescale/pinctrl-imx6q.c 
b/drivers/pinctrl/freescale/pinctrl-imx6q.c
index 55cd8a0e367d..d61651c40458 100644
--- a/drivers/pinctrl/freescale/pinctrl-imx6q.c
+++ b/drivers/pinctrl/freescale/pinctrl-imx6q.c
@@ -15,7 +15,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -490,12 +489,3 @@ static int __init imx6q_pinctrl_init(void)
return platform_driver_register(_pinctrl_driver);
 }
 arch_initcall(imx6q_pinctrl_init);
-
-static void __exit imx6q_pinctrl_exit(void)
-{
-   platform_driver_unregister(_pinctrl_driver);
-}
-module_exit(imx6q_pinctrl_exit);
-MODULE_AUTHOR("Dong Aisheng ");
-MODULE_DESCRIPTION("Freescale IMX6Q pinctrl driver");
-MODULE_LICENSE("GPL v2");
-- 
2.8.4



  1   2   3   4   5   6   >