All of lore.kernel.org
 help / color / mirror / Atom feed
* Re: [GIT PULL] mm: frontswap (for 3.2 window)
From: KAMEZAWA Hiroyuki @ 2011-11-01  0:50 UTC (permalink / raw)
  To: Dan Magenheimer
  Cc: Linus Torvalds, linux-mm, LKML, Andrew Morton, Konrad Wilk,
	Jeremy Fitzhardinge, Seth Jennings, ngupta, levinsasha928,
	Chris Mason, JBeulich, Dave Hansen, Jonathan Corbet, Neo Jia
In-Reply-To: <ef778e79-72d0-4c58-99e8-3b36d85fa30d@default>

On Mon, 31 Oct 2011 09:38:12 -0700 (PDT)
Dan Magenheimer <dan.magenheimer@oracle.com> wrote:

> > From: KAMEZAWA Hiroyuki [mailto:kamezawa.hiroyu@jp.fujitsu.com]
> > Subject: Re: [GIT PULL] mm: frontswap (for 3.2 window)
> 
> Hi Kame --
> 
> Thanks for your reply and for your earlier reviews of frontswap,
> and my apologies that I accidentally left you off of the Cc list \
> for the basenote of this git-pull request.
> 
> > I don't have heavy concerns to the codes itself but this process as bypassing -mm
> > or linux-next seems ugly.
> 
> First, frontswap IS in linux-next and it has been since June 3
> and v11 has been in linux-next since September 23.  This
> is stated in the base git-pull request.
>  

Ok, I'm sorry. I found frontswap.c in my tree.


> > Why bypass -mm tree ?
> > 
> > I think you planned to merge this via -mm tree and, then, posted patches
> > to linux-mm with CC -mm guys.
> 
> Hmmm... the mm process is not clear or well-documented.

not complicated to me.

post -> akpm's -mm tree -> mainline.

But your tree seems to be in -mm via linux-next. Hmm, complicated ;(
I'm sorry I didn't notice frontswap.c was there....


> > I think you posted 2011/09/16 at the last time, v10. But no further submission
> > to gather acks/reviews from Mel, Johannes, Andrew, Hugh etc.. and no inclusion
> > request to -mm or -next. _AND_, IIUC, at v10, the number of posted pathces was 6.
> > Why now 8 ? Just because it's simple changes ?
> 
> See https://lkml.org/lkml/2011/9/21/373.  Konrad Wilk
> helped me to reorganize the patches (closer to what you
> suggested I think), but there were no code changes between
> v10 and v11, just dividing up the patches differently
> as Konrad thought there should be more smaller commits.
> So no code change between v10 and v11 but the number of
> patches went from 6 to 8.
> 
> My last line in that post should also make it clear that
> I thought I was done and ready for the 3.2 window, so there
> was no evil intent on my part to subvert a process.
> It would have been nice if someone had told me there
> were uncompleted steps in the -mm process or, even better,
> pointed me to a (non-existent?) document where I could see
> for myself if I was missing steps!
> 
> So... now what?
> 

As far as I know, patches for memory management should go through akpm's tree.
And most of developpers in that area see that tree.
Now, your tree goes through linux-next. It complicates the problem.

When a patch goes through -mm tree, its justification is already checked by
, at least, akpm. And while in -mm tree, other developpers checks it and
some improvements are done there.

Now, you tries to push patches via linux-next and your
justification for patches is checked _now_. That's what happens.
It's not complicated. I think other linux-next patches are checked
its justification at pull request.

So, all your work will be to convice people that this feature is
necessary and not-intrusive, here. 

>From my point of view,

  - I have no concerns with performance cost. But, at the same time,
    I want to see performance improvement numbers. 

  - At discussing an fujitsu user support guy (just now), he asked
    'why it's not designed as device driver ?"
    I couldn't answered. 
 
    So, I have small concerns with frontswap.ops ABI design.
    Do we need ABI and other modules should be pluggable ?
    Can frontswap be implemented as something like

    # setup frontswap via device-mapper or some.
    # swapon /dev/frontswap 
    ?
    It seems required hooks are just before/after read/write swap device.
    other hooks can be implemented in notifier..no ?

Thanks,
-Kame

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply

* [PATCH 3/9] bq27x00: Report -ENODATA if bq27000 battery was not calibrated
From: Pali Rohár @ 2011-11-01  0:43 UTC (permalink / raw)
  To: linux-kernel, Anton Vorontsov, syed rafiuddin, Rodolfo Giometti,
	Lars-Peter Clausen, David Woodhouse
  Cc: Pali Rohár
In-Reply-To: <1320108191-6647-1-git-send-email-pali.rohar@gmail.com>

* CI (Capacity Inaccurate) flag is set after full reset on bq27000 battery
* when is set, all capacity properties should be reported incorrectly, because there was no learning cycle and battery was not calibrated
* instead reporting incorrect values, report -ENODATA

Signed-off-by: Pali Rohár <pali.rohar@gmail.com>
---
 drivers/power/bq27x00_battery.c |   19 ++++++++++++++-----
 1 files changed, 14 insertions(+), 5 deletions(-)

diff --git a/drivers/power/bq27x00_battery.c b/drivers/power/bq27x00_battery.c
index a531122..6c8dfdb 100644
--- a/drivers/power/bq27x00_battery.c
+++ b/drivers/power/bq27x00_battery.c
@@ -56,6 +56,7 @@
 #define BQ27000_REG_ILMD		0x76 /* Initial last measured discharge */
 #define BQ27000_FLAG_EDVF		BIT(0) /* Final End-of-Discharge-Voltage flag */
 #define BQ27000_FLAG_EDV1		BIT(1) /* First End-of-Discharge-Voltage flag */
+#define BQ27000_FLAG_CI			BIT(4) /* Capacity Inaccurate flag */
 #define BQ27000_FLAG_FC			BIT(5)
 #define BQ27000_FLAG_CHGS		BIT(7) /* Charge state flag */
 
@@ -265,12 +266,20 @@ static void bq27x00_update(struct bq27x00_device_info *di)
 
 	cache.flags = bq27x00_read(di, BQ27x00_REG_FLAGS, is_bq27500);
 	if (cache.flags >= 0) {
-		cache.capacity = bq27x00_battery_read_rsoc(di);
+		if (!is_bq27500 && (cache.flags & BQ27000_FLAG_CI)) {
+			cache.capacity = -ENODATA;
+			cache.time_to_empty = -ENODATA;
+			cache.time_to_empty_avg = -ENODATA;
+			cache.time_to_full = -ENODATA;
+			cache.charge_full = -ENODATA;
+		} else {
+			cache.capacity = bq27x00_battery_read_rsoc(di);
+			cache.time_to_empty = bq27x00_battery_read_time(di, BQ27x00_REG_TTE);
+			cache.time_to_empty_avg = bq27x00_battery_read_time(di, BQ27x00_REG_TTECP);
+			cache.time_to_full = bq27x00_battery_read_time(di, BQ27x00_REG_TTF);
+			cache.charge_full = bq27x00_battery_read_lmd(di);
+		}
 		cache.temperature = bq27x00_read(di, BQ27x00_REG_TEMP, false);
-		cache.time_to_empty = bq27x00_battery_read_time(di, BQ27x00_REG_TTE);
-		cache.time_to_empty_avg = bq27x00_battery_read_time(di, BQ27x00_REG_TTECP);
-		cache.time_to_full = bq27x00_battery_read_time(di, BQ27x00_REG_TTF);
-		cache.charge_full = bq27x00_battery_read_lmd(di);
 		cache.cycle_count = bq27x00_battery_read_cyct(di);
 
 		/* We only have to read charge design full once */
-- 
1.7.5.4


^ permalink raw reply related

* [PATCH 5/9] bq27x00: Cache temperature value in converted unit
From: Pali Rohár @ 2011-11-01  0:43 UTC (permalink / raw)
  To: linux-kernel, Anton Vorontsov, syed rafiuddin, Rodolfo Giometti,
	Lars-Peter Clausen, David Woodhouse
  Cc: Pali Rohár
In-Reply-To: <1320108191-6647-1-git-send-email-pali.rohar@gmail.com>

Signed-off-by: Pali Rohár <pali.rohar@gmail.com>
---
 drivers/power/bq27x00_battery.c |   45 ++++++++++++++++++++------------------
 1 files changed, 24 insertions(+), 21 deletions(-)

diff --git a/drivers/power/bq27x00_battery.c b/drivers/power/bq27x00_battery.c
index e9aeb53..a22124a 100644
--- a/drivers/power/bq27x00_battery.c
+++ b/drivers/power/bq27x00_battery.c
@@ -248,6 +248,28 @@ static int bq27x00_battery_read_energy(struct bq27x00_device_info *di)
 }
 
 /*
+ * Return the battery temperature in tenths of degree Celsius
+ * Or < 0 if something fails.
+ */
+static int bq27x00_battery_read_temperature(struct bq27x00_device_info *di)
+{
+	int temp;
+
+	temp = bq27x00_read(di, BQ27x00_REG_TEMP, false);
+	if (temp < 0) {
+		dev_err(di->dev, "error reading temperature\n");
+		return temp;
+	}
+
+	if (di->chip == BQ27500)
+		temp -= 2731;
+	else
+		temp = ((temp * 5) - 5463) / 2;
+
+	return temp;
+}
+
+/*
  * Return the battery Cycle count total
  * Or < 0 if something fails.
  */
@@ -304,7 +326,7 @@ static void bq27x00_update(struct bq27x00_device_info *di)
 			cache.time_to_full = bq27x00_battery_read_time(di, BQ27x00_REG_TTF);
 			cache.charge_full = bq27x00_battery_read_lmd(di);
 		}
-		cache.temperature = bq27x00_read(di, BQ27x00_REG_TEMP, false);
+		cache.temperature = bq27x00_battery_read_temperature(di);
 		cache.cycle_count = bq27x00_battery_read_cyct(di);
 
 		/* We only have to read charge design full once */
@@ -334,25 +356,6 @@ static void bq27x00_battery_poll(struct work_struct *work)
 	}
 }
 
-
-/*
- * Return the battery temperature in tenths of degree Celsius
- * Or < 0 if something fails.
- */
-static int bq27x00_battery_temperature(struct bq27x00_device_info *di,
-	union power_supply_propval *val)
-{
-	if (di->cache.temperature < 0)
-		return di->cache.temperature;
-
-	if (di->chip == BQ27500)
-		val->intval = di->cache.temperature - 2731;
-	else
-		val->intval = ((di->cache.temperature * 5) - 5463) / 2;
-
-	return 0;
-}
-
 /*
  * Return the battery average current in µA
  * Note that current can be negative signed as well
@@ -511,7 +514,7 @@ static int bq27x00_battery_get_property(struct power_supply *psy,
 		ret = bq27x00_battery_capacity_level(di, val);
 		break;
 	case POWER_SUPPLY_PROP_TEMP:
-		ret = bq27x00_battery_temperature(di, val);
+		ret = bq27x00_simple_value(di->cache.temperature, val);
 		break;
 	case POWER_SUPPLY_PROP_TIME_TO_EMPTY_NOW:
 		ret = bq27x00_simple_value(di->cache.time_to_empty, val);
-- 
1.7.5.4


^ permalink raw reply related

* [PATCH 7/9] bq27x00: Fix reporting error messages
From: Pali Rohár @ 2011-11-01  0:43 UTC (permalink / raw)
  To: linux-kernel, Anton Vorontsov, syed rafiuddin, Rodolfo Giometti,
	Lars-Peter Clausen, David Woodhouse
  Cc: Pali Rohár
In-Reply-To: <1320108191-6647-1-git-send-email-pali.rohar@gmail.com>

* Do not be noise if battery is not calibrated (use dev_dbg)

Signed-off-by: Pali Rohár <pali.rohar@gmail.com>
---
 drivers/power/bq27x00_battery.c |   19 ++++++++++++-------
 1 files changed, 12 insertions(+), 7 deletions(-)

diff --git a/drivers/power/bq27x00_battery.c b/drivers/power/bq27x00_battery.c
index c4c403e..63cfb5a 100644
--- a/drivers/power/bq27x00_battery.c
+++ b/drivers/power/bq27x00_battery.c
@@ -155,7 +155,7 @@ static int bq27x00_battery_read_rsoc(struct bq27x00_device_info *di)
 		rsoc = bq27x00_read(di, BQ27000_REG_RSOC, true);
 
 	if (rsoc < 0)
-		dev_err(di->dev, "error reading relative State-of-Charge\n");
+		dev_dbg(di->dev, "error reading relative State-of-Charge\n");
 
 	return rsoc;
 }
@@ -170,7 +170,7 @@ static int bq27x00_battery_read_charge(struct bq27x00_device_info *di, u8 reg)
 
 	charge = bq27x00_read(di, reg, false);
 	if (charge < 0) {
-		dev_err(di->dev, "error reading nominal available capacity\n");
+		dev_dbg(di->dev, "error reading charge register %02x: %d\n", reg, charge);
 		return charge;
 	}
 
@@ -214,7 +214,7 @@ static int bq27x00_battery_read_ilmd(struct bq27x00_device_info *di)
 		ilmd = bq27x00_read(di, BQ27000_REG_ILMD, true);
 
 	if (ilmd < 0) {
-		dev_err(di->dev, "error reading initial last measured discharge\n");
+		dev_dbg(di->dev, "error reading initial last measured discharge\n");
 		return ilmd;
 	}
 
@@ -236,7 +236,7 @@ static int bq27x00_battery_read_energy(struct bq27x00_device_info *di)
 
 	ae = bq27x00_read(di, BQ27x00_REG_AE, false);
 	if (ae < 0) {
-		dev_err(di->dev, "error reading available energy\n");
+		dev_dbg(di->dev, "error reading available energy\n");
 		return ae;
 	}
 
@@ -295,7 +295,7 @@ static int bq27x00_battery_read_time(struct bq27x00_device_info *di, u8 reg)
 
 	tval = bq27x00_read(di, reg, false);
 	if (tval < 0) {
-		dev_err(di->dev, "error reading register %02x: %d\n", reg, tval);
+		dev_dbg(di->dev, "error reading time register %02x: %d\n", reg, tval);
 		return tval;
 	}
 
@@ -313,6 +313,7 @@ static void bq27x00_update(struct bq27x00_device_info *di)
 	cache.flags = bq27x00_read(di, BQ27x00_REG_FLAGS, is_bq27500);
 	if (cache.flags >= 0) {
 		if (!is_bq27500 && (cache.flags & BQ27000_FLAG_CI)) {
+			dev_info(di->dev, "battery is not calibrated! ignoring capacity values\n");
 			cache.capacity = -ENODATA;
 			cache.energy = -ENODATA;
 			cache.time_to_empty = -ENODATA;
@@ -369,8 +370,10 @@ static int bq27x00_battery_current(struct bq27x00_device_info *di,
 	int flags;
 
 	curr = bq27x00_read(di, BQ27x00_REG_AI, false);
-	if (curr < 0)
+	if (curr < 0) {
+		dev_err(di->dev, "error reading current\n");
 		return curr;
+	}
 
 	if (di->chip == BQ27500) {
 		/* bq27500 returns signed value */
@@ -460,8 +463,10 @@ static int bq27x00_battery_voltage(struct bq27x00_device_info *di,
 	int volt;
 
 	volt = bq27x00_read(di, BQ27x00_REG_VOLT, false);
-	if (volt < 0)
+	if (volt < 0) {
+		dev_err(di->dev, "error reading voltage\n");
 		return volt;
+	}
 
 	val->intval = volt * 1000;
 
-- 
1.7.5.4


^ permalink raw reply related

* [PATCH 9/9] bq27x00: Fix OOPS caused by unregistring bq27x00 driver
From: Pali Rohár @ 2011-11-01  0:43 UTC (permalink / raw)
  To: linux-kernel, Anton Vorontsov, syed rafiuddin, Rodolfo Giometti,
	Lars-Peter Clausen, David Woodhouse
  Cc: Pali Rohár
In-Reply-To: <1320108191-6647-1-git-send-email-pali.rohar@gmail.com>

* power_supply_unregister call bq27x00_battery_get_property which call bq27x00_battery_poll
* make sure that bq27x00_battery_poll will not call schedule_delayed_work again after unregister (which cause OOPS)

Signed-off-by: Pali Rohár <pali.rohar@gmail.com>
---
 drivers/power/bq27x00_battery.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/drivers/power/bq27x00_battery.c b/drivers/power/bq27x00_battery.c
index 15ecd42..29ce907 100644
--- a/drivers/power/bq27x00_battery.c
+++ b/drivers/power/bq27x00_battery.c
@@ -722,6 +722,10 @@ static int bq27x00_powersupply_init(struct bq27x00_device_info *di)
 
 static void bq27x00_powersupply_unregister(struct bq27x00_device_info *di)
 {
+	/* power_supply_unregister call bq27x00_battery_get_property which call bq27x00_battery_poll */
+	/* make sure that bq27x00_battery_poll will not call schedule_delayed_work again after unregister (which cause OOPS) */
+	poll_interval = 0;
+
 	cancel_delayed_work_sync(&di->work);
 
 	bq27x00_battery_reg_exit(di);
-- 
1.7.5.4


^ permalink raw reply related

* [PATCH 8/9] bq27x00: Add miscdevice for each battery with ioctl for reading registers
From: Pali Rohár @ 2011-11-01  0:43 UTC (permalink / raw)
  To: linux-kernel, Anton Vorontsov, syed rafiuddin, Rodolfo Giometti,
	Lars-Peter Clausen, David Woodhouse
  Cc: Pali Rohár
In-Reply-To: <1320108191-6647-1-git-send-email-pali.rohar@gmail.com>

* When bq27x00_battery module is loaded it take control of bq27200 i2c battery chip and then it is not possible to use i2cget program from user space (returns -EBUSY)
* This patch adds new miscdevice for each battery which has ioctl BQ27X00_READ_REG for reading battery registers from user space

* ioctl cmd:
  #define BQ27X00_READ_REG _IO(MISC_MAJOR, 0)

* ioctl arg:
  struct bq27x00_reg_parms {
    int reg; /* battery register (in) */
    int single; /* 1 - 8bit register, 0 - 16bit register (in) */
    int ret; /* register status, negative indicate error (out) */
  };

Signed-off-by: Pali Rohár <pali.rohar@gmail.com>
---
 drivers/power/bq27x00_battery.c       |  136 +++++++++++++++++++++++++++++++--
 include/linux/power/bq27x00_battery.h |   15 ++++
 2 files changed, 145 insertions(+), 6 deletions(-)

diff --git a/drivers/power/bq27x00_battery.c b/drivers/power/bq27x00_battery.c
index 63cfb5a..15ecd42 100644
--- a/drivers/power/bq27x00_battery.c
+++ b/drivers/power/bq27x00_battery.c
@@ -29,12 +29,15 @@
 #include <linux/jiffies.h>
 #include <linux/workqueue.h>
 #include <linux/delay.h>
+#include <linux/fs.h>
+#include <linux/miscdevice.h>
 #include <linux/platform_device.h>
 #include <linux/power_supply.h>
 #include <linux/idr.h>
 #include <linux/i2c.h>
 #include <linux/slab.h>
 #include <asm/unaligned.h>
+#include <asm/uaccess.h>
 
 #include <linux/power/bq27x00_battery.h>
 
@@ -89,8 +92,15 @@ struct bq27x00_reg_cache {
 	int flags;
 };
 
+struct bq27x00_reg_device {
+	struct miscdevice miscdev;
+	struct bq27x00_device_info *di;
+	struct list_head list;
+};
+
 struct bq27x00_device_info {
 	struct device 		*dev;
+	struct bq27x00_reg_device *regdev;
 	int			id;
 	enum bq27x00_chip	chip;
 
@@ -131,6 +141,13 @@ module_param(poll_interval, uint, 0644);
 MODULE_PARM_DESC(poll_interval, "battery poll interval in seconds - " \
 				"0 disables polling");
 
+/* If the system has several batteries we need a different name for each
+ * of them...
+ */
+static DEFINE_IDR(battery_id);
+static DEFINE_MUTEX(battery_mutex);
+static LIST_HEAD(battery_list);
+
 /*
  * Common code for BQ27x00 devices
  */
@@ -568,6 +585,114 @@ static void bq27x00_external_power_changed(struct power_supply *psy)
 	schedule_delayed_work(&di->work, 0);
 }
 
+/* Code for register device access */
+
+static struct bq27x00_reg_device * bq27x00_battery_reg_find_device(int minor)
+{
+	struct bq27x00_reg_device *regdev;
+
+	list_for_each_entry(regdev, &battery_list, list)
+		if (regdev->miscdev.minor == minor)
+			return regdev;
+
+	return NULL;
+}
+
+static long bq27x00_battery_reg_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
+{
+	int ret;
+	int minor = iminor(filp->f_dentry->d_inode);
+	struct bq27x00_reg_parms param;
+	struct bq27x00_reg_device *regdev = bq27x00_battery_reg_find_device(minor);
+
+	if (!regdev)
+		return -ENXIO;
+
+	if (cmd != BQ27X00_READ_REG)
+		return -EINVAL;
+
+	ret = copy_from_user(&param, (void __user *)arg, sizeof(param));
+	if (ret != 0)
+		return -EACCES;
+
+	param.ret = bq27x00_read(regdev->di, param.reg, param.single);
+
+	ret = copy_to_user((void __user *)arg, &param, sizeof(param));
+	if (ret != 0)
+		return -EACCES;
+
+	return 0;
+}
+
+static int bq27x00_battery_reg_open(struct inode *inode, struct file *file)
+{
+	if (!try_module_get(THIS_MODULE))
+		return -EPERM;
+
+	return 0;
+}
+
+static int bq27x00_battery_reg_release(struct inode *inode, struct file *file)
+{
+	module_put(THIS_MODULE);
+	return 0;
+}
+
+static struct file_operations bq27x00_reg_fileops = {
+	.owner = THIS_MODULE,
+	.unlocked_ioctl = bq27x00_battery_reg_ioctl,
+	.open = bq27x00_battery_reg_open,
+	.release = bq27x00_battery_reg_release,
+};
+
+static int bq27x00_battery_reg_init(struct bq27x00_device_info *di)
+{
+	struct bq27x00_reg_device *regdev;
+	int ret;
+
+	di->regdev = NULL;
+
+	regdev = kzalloc(sizeof *regdev, GFP_KERNEL);
+	if (!regdev)
+		return -ENOMEM;
+
+	regdev->miscdev.minor = MISC_DYNAMIC_MINOR;
+	regdev->miscdev.name = di->bat.name;
+	regdev->miscdev.fops = &bq27x00_reg_fileops;
+
+	ret = misc_register(&regdev->miscdev);
+	if (ret != 0) {
+		kfree(regdev);
+		return ret;
+	}
+
+	regdev->di = di;
+	di->regdev = regdev;
+
+	INIT_LIST_HEAD(&regdev->list);
+
+	mutex_lock(&battery_mutex);
+	list_add(&regdev->list, &battery_list);
+	mutex_unlock(&battery_mutex);
+
+	return 0;
+}
+
+static void bq27x00_battery_reg_exit(struct bq27x00_device_info *di)
+{
+	if (!di->regdev)
+		return;
+
+	misc_deregister(&di->regdev->miscdev);
+
+	mutex_lock(&battery_mutex);
+	list_del(&di->regdev->list);
+	mutex_unlock(&battery_mutex);
+
+	kfree(di->regdev);
+	di->regdev = NULL;
+}
+
 static int bq27x00_powersupply_init(struct bq27x00_device_info *di)
 {
 	int ret;
@@ -590,6 +715,7 @@ static int bq27x00_powersupply_init(struct bq27x00_device_info *di)
 	dev_info(di->dev, "support ver. %s enabled\n", DRIVER_VERSION);
 
 	bq27x00_update(di);
+	bq27x00_battery_reg_init(di);
 
 	return 0;
 }
@@ -598,6 +724,8 @@ static void bq27x00_powersupply_unregister(struct bq27x00_device_info *di)
 {
 	cancel_delayed_work_sync(&di->work);
 
+	bq27x00_battery_reg_exit(di);
+
 	power_supply_unregister(&di->bat);
 
 	mutex_destroy(&di->lock);
@@ -607,12 +735,6 @@ static void bq27x00_powersupply_unregister(struct bq27x00_device_info *di)
 /* i2c specific code */
 #ifdef CONFIG_BATTERY_BQ27X00_I2C
 
-/* If the system has several batteries we need a different name for each
- * of them...
- */
-static DEFINE_IDR(battery_id);
-static DEFINE_MUTEX(battery_mutex);
-
 static int bq27x00_read_i2c(struct bq27x00_device_info *di, u8 reg, bool single)
 {
 	struct i2c_client *client = to_i2c_client(di->dev);
@@ -635,7 +757,9 @@ static int bq27x00_read_i2c(struct bq27x00_device_info *di, u8 reg, bool single)
 	else
 		msg[1].len = 2;
 
+	mutex_lock(&battery_mutex);
 	ret = i2c_transfer(client->adapter, msg, ARRAY_SIZE(msg));
+	mutex_unlock(&battery_mutex);
 	if (ret < 0)
 		return ret;
 
diff --git a/include/linux/power/bq27x00_battery.h b/include/linux/power/bq27x00_battery.h
index a857f71..02c1c6e 100644
--- a/include/linux/power/bq27x00_battery.h
+++ b/include/linux/power/bq27x00_battery.h
@@ -16,4 +16,19 @@ struct bq27000_platform_data {
 	int (*read)(struct device *dev, unsigned int);
 };
 
+
+#define BQ27X00_READ_REG _IO(MISC_MAJOR, 0)
+
+/**
+ * struct bq27x00_reg_params - User space data for ioctl BQ27X00_READ_REG
+ * @reg: Battery register (in)
+ * @single: 1 - 8bit register, 0 - 16bit register (in)
+ * @ret: register status, negative indicate error (out)
+ */
+struct bq27x00_reg_parms {
+	int reg;
+	int single;
+	int ret;
+};
+
 #endif
-- 
1.7.5.4


^ permalink raw reply related

* [PATCH 6/9] bq27x00: Fix reporting status value for bq27500 battery
From: Pali Rohár @ 2011-11-01  0:43 UTC (permalink / raw)
  To: linux-kernel, Anton Vorontsov, syed rafiuddin, Rodolfo Giometti,
	Lars-Peter Clausen, David Woodhouse
  Cc: Pali Rohár
In-Reply-To: <1320108191-6647-1-git-send-email-pali.rohar@gmail.com>

Signed-off-by: Pali Rohár <pali.rohar@gmail.com>
---
 drivers/power/bq27x00_battery.c |   13 +++++++++----
 1 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/drivers/power/bq27x00_battery.c b/drivers/power/bq27x00_battery.c
index a22124a..c4c403e 100644
--- a/drivers/power/bq27x00_battery.c
+++ b/drivers/power/bq27x00_battery.c
@@ -62,10 +62,11 @@
 
 #define BQ27500_REG_SOC			0x2C
 #define BQ27500_REG_DCAP		0x3C /* Design capacity */
-#define BQ27500_FLAG_DSC		BIT(0)
+#define BQ27500_FLAG_DSG		BIT(0) /* Discharging */
 #define BQ27500_FLAG_SOCF		BIT(1) /* State-of-Charge threshold final */
 #define BQ27500_FLAG_SOC1		BIT(2) /* State-of-Charge threshold 1 */
-#define BQ27500_FLAG_FC			BIT(9)
+#define BQ27500_FLAG_CHG		BIT(8) /* Charging */
+#define BQ27500_FLAG_FC			BIT(9) /* Fully charged */
 
 #define BQ27000_RS			20 /* Resistor sense */
 
@@ -395,10 +396,14 @@ static int bq27x00_battery_status(struct bq27x00_device_info *di,
 	if (di->chip == BQ27500) {
 		if (di->cache.flags & BQ27500_FLAG_FC)
 			status = POWER_SUPPLY_STATUS_FULL;
-		else if (di->cache.flags & BQ27500_FLAG_DSC)
+		else if (di->cache.flags & BQ27500_FLAG_DSG)
 			status = POWER_SUPPLY_STATUS_DISCHARGING;
-		else
+		else if (di->cache.flags & BQ27500_FLAG_CHG)
 			status = POWER_SUPPLY_STATUS_CHARGING;
+		else if (power_supply_am_i_supplied(&di->bat))
+			status = POWER_SUPPLY_STATUS_NOT_CHARGING;
+		else
+			status = POWER_SUPPLY_STATUS_UNKNOWN;
 	} else {
 		if (di->cache.flags & BQ27000_FLAG_FC)
 			status = POWER_SUPPLY_STATUS_FULL;
-- 
1.7.5.4


^ permalink raw reply related

* [PATCH 4/9] bq27x00: Cache energy property
From: Pali Rohár @ 2011-11-01  0:43 UTC (permalink / raw)
  To: linux-kernel, Anton Vorontsov, syed rafiuddin, Rodolfo Giometti,
	Lars-Peter Clausen, David Woodhouse
  Cc: Pali Rohár
In-Reply-To: <1320108191-6647-1-git-send-email-pali.rohar@gmail.com>

Signed-off-by: Pali Rohár <pali.rohar@gmail.com>
---
 drivers/power/bq27x00_battery.c |   53 +++++++++++++++++++--------------------
 1 files changed, 26 insertions(+), 27 deletions(-)

diff --git a/drivers/power/bq27x00_battery.c b/drivers/power/bq27x00_battery.c
index 6c8dfdb..e9aeb53 100644
--- a/drivers/power/bq27x00_battery.c
+++ b/drivers/power/bq27x00_battery.c
@@ -84,6 +84,7 @@ struct bq27x00_reg_cache {
 	int charge_full;
 	int cycle_count;
 	int capacity;
+	int energy;
 	int flags;
 };
 
@@ -225,6 +226,28 @@ static int bq27x00_battery_read_ilmd(struct bq27x00_device_info *di)
 }
 
 /*
+ * Return the battery Available energy in µWh
+ * Or < 0 if something fails.
+ */
+static int bq27x00_battery_read_energy(struct bq27x00_device_info *di)
+{
+	int ae;
+
+	ae = bq27x00_read(di, BQ27x00_REG_AE, false);
+	if (ae < 0) {
+		dev_err(di->dev, "error reading available energy\n");
+		return ae;
+	}
+
+	if (di->chip == BQ27500)
+		ae *= 1000;
+	else
+		ae = ae * 29200 / BQ27000_RS;
+
+	return ae;
+}
+
+/*
  * Return the battery Cycle count total
  * Or < 0 if something fails.
  */
@@ -268,12 +291,14 @@ static void bq27x00_update(struct bq27x00_device_info *di)
 	if (cache.flags >= 0) {
 		if (!is_bq27500 && (cache.flags & BQ27000_FLAG_CI)) {
 			cache.capacity = -ENODATA;
+			cache.energy = -ENODATA;
 			cache.time_to_empty = -ENODATA;
 			cache.time_to_empty_avg = -ENODATA;
 			cache.time_to_full = -ENODATA;
 			cache.charge_full = -ENODATA;
 		} else {
 			cache.capacity = bq27x00_battery_read_rsoc(di);
+			cache.energy = bq27x00_battery_read_energy(di);
 			cache.time_to_empty = bq27x00_battery_read_time(di, BQ27x00_REG_TTE);
 			cache.time_to_empty_avg = bq27x00_battery_read_time(di, BQ27x00_REG_TTECP);
 			cache.time_to_full = bq27x00_battery_read_time(di, BQ27x00_REG_TTF);
@@ -435,32 +460,6 @@ static int bq27x00_battery_voltage(struct bq27x00_device_info *di,
 	return 0;
 }
 
-/*
- * Return the battery Available energy in µWh
- * Or < 0 if something fails.
- */
-static int bq27x00_battery_energy(struct bq27x00_device_info *di,
-	union power_supply_propval *val)
-{
-	int ae;
-
-	ae = bq27x00_read(di, BQ27x00_REG_AE, false);
-	if (ae < 0) {
-		dev_err(di->dev, "error reading available energy\n");
-		return ae;
-	}
-
-	if (di->chip == BQ27500)
-		ae *= 1000;
-	else
-		ae = ae * 29200 / BQ27000_RS;
-
-	val->intval = ae;
-
-	return 0;
-}
-
-
 static int bq27x00_simple_value(int value,
 	union power_supply_propval *val)
 {
@@ -539,7 +538,7 @@ static int bq27x00_battery_get_property(struct power_supply *psy,
 		ret = bq27x00_simple_value(di->cache.cycle_count, val);
 		break;
 	case POWER_SUPPLY_PROP_ENERGY_NOW:
-		ret = bq27x00_battery_energy(di, val);
+		ret = bq27x00_simple_value(di->cache.energy, val);
 		break;
 	default:
 		return -EINVAL;
-- 
1.7.5.4


^ permalink raw reply related

* [PATCH 2/9] bq27x00: Add support for property POWER_SUPPLY_PROP_CAPACITY_LEVEL
From: Pali Rohár @ 2011-11-01  0:43 UTC (permalink / raw)
  To: linux-kernel, Anton Vorontsov, syed rafiuddin, Rodolfo Giometti,
	Lars-Peter Clausen, David Woodhouse
  Cc: Pali Rohár
In-Reply-To: <1320108191-6647-1-git-send-email-pali.rohar@gmail.com>

Signed-off-by: Pali Rohár <pali.rohar@gmail.com>
---
 drivers/power/bq27x00_battery.c |   40 ++++++++++++++++++++++++++++++++++++++-
 1 files changed, 39 insertions(+), 1 deletions(-)

diff --git a/drivers/power/bq27x00_battery.c b/drivers/power/bq27x00_battery.c
index d238144..a531122 100644
--- a/drivers/power/bq27x00_battery.c
+++ b/drivers/power/bq27x00_battery.c
@@ -54,12 +54,16 @@
 
 #define BQ27000_REG_RSOC		0x0B /* Relative State-of-Charge */
 #define BQ27000_REG_ILMD		0x76 /* Initial last measured discharge */
-#define BQ27000_FLAG_CHGS		BIT(7)
+#define BQ27000_FLAG_EDVF		BIT(0) /* Final End-of-Discharge-Voltage flag */
+#define BQ27000_FLAG_EDV1		BIT(1) /* First End-of-Discharge-Voltage flag */
 #define BQ27000_FLAG_FC			BIT(5)
+#define BQ27000_FLAG_CHGS		BIT(7) /* Charge state flag */
 
 #define BQ27500_REG_SOC			0x2C
 #define BQ27500_REG_DCAP		0x3C /* Design capacity */
 #define BQ27500_FLAG_DSC		BIT(0)
+#define BQ27500_FLAG_SOCF		BIT(1) /* State-of-Charge threshold final */
+#define BQ27500_FLAG_SOC1		BIT(2) /* State-of-Charge threshold 1 */
 #define BQ27500_FLAG_FC			BIT(9)
 
 #define BQ27000_RS			20 /* Resistor sense */
@@ -106,6 +110,7 @@ static enum power_supply_property bq27x00_battery_props[] = {
 	POWER_SUPPLY_PROP_VOLTAGE_NOW,
 	POWER_SUPPLY_PROP_CURRENT_NOW,
 	POWER_SUPPLY_PROP_CAPACITY,
+	POWER_SUPPLY_PROP_CAPACITY_LEVEL,
 	POWER_SUPPLY_PROP_TEMP,
 	POWER_SUPPLY_PROP_TIME_TO_EMPTY_NOW,
 	POWER_SUPPLY_PROP_TIME_TO_EMPTY_AVG,
@@ -373,6 +378,36 @@ static int bq27x00_battery_status(struct bq27x00_device_info *di,
 	return 0;
 }
 
+static int bq27x00_battery_capacity_level(struct bq27x00_device_info *di,
+	union power_supply_propval *val)
+{
+	int level;
+
+	if (di->chip == BQ27500) {
+		if (di->cache.flags & BQ27500_FLAG_FC)
+			level = POWER_SUPPLY_CAPACITY_LEVEL_FULL;
+		else if (di->cache.flags & BQ27500_FLAG_SOC1)
+			level = POWER_SUPPLY_CAPACITY_LEVEL_LOW;
+		else if (di->cache.flags & BQ27500_FLAG_SOCF)
+			level = POWER_SUPPLY_CAPACITY_LEVEL_CRITICAL;
+		else
+			level = POWER_SUPPLY_CAPACITY_LEVEL_NORMAL;
+	} else {
+		if (di->cache.flags & BQ27000_FLAG_FC)
+			level = POWER_SUPPLY_CAPACITY_LEVEL_FULL;
+		else if (di->cache.flags & BQ27000_FLAG_EDV1)
+			level = POWER_SUPPLY_CAPACITY_LEVEL_LOW;
+		else if (di->cache.flags & BQ27000_FLAG_EDVF)
+			level = POWER_SUPPLY_CAPACITY_LEVEL_CRITICAL;
+		else
+			level = POWER_SUPPLY_CAPACITY_LEVEL_NORMAL;
+	}
+
+	val->intval = level;
+
+	return 0;
+}
+
 /*
  * Return the battery Voltage in milivolts
  * Or < 0 if something fails.
@@ -464,6 +499,9 @@ static int bq27x00_battery_get_property(struct power_supply *psy,
 	case POWER_SUPPLY_PROP_CAPACITY:
 		ret = bq27x00_simple_value(di->cache.capacity, val);
 		break;
+	case POWER_SUPPLY_PROP_CAPACITY_LEVEL:
+		ret = bq27x00_battery_capacity_level(di, val);
+		break;
 	case POWER_SUPPLY_PROP_TEMP:
 		ret = bq27x00_battery_temperature(di, val);
 		break;
-- 
1.7.5.4


^ permalink raw reply related

* [PATCH 1/9] bq27x00: Do not cache current_now value for bq27000 batery
From: Pali Rohár @ 2011-11-01  0:43 UTC (permalink / raw)
  To: linux-kernel, Anton Vorontsov, syed rafiuddin, Rodolfo Giometti,
	Lars-Peter Clausen, David Woodhouse
  Cc: Pali Rohár
In-Reply-To: <1316531933-7159-1-git-send-email-pali.rohar@gmail.com>

* This prevent reporting old current_now value for bq27000
* Also ask for current flags, to make sure that current_now will be reported with correct signature

Signed-off-by: Pali Rohár <pali.rohar@gmail.com>
---
 drivers/power/bq27x00_battery.c |   19 +++++--------------
 1 files changed, 5 insertions(+), 14 deletions(-)

diff --git a/drivers/power/bq27x00_battery.c b/drivers/power/bq27x00_battery.c
index bb16f5b..d238144 100644
--- a/drivers/power/bq27x00_battery.c
+++ b/drivers/power/bq27x00_battery.c
@@ -80,8 +80,6 @@ struct bq27x00_reg_cache {
 	int cycle_count;
 	int capacity;
 	int flags;
-
-	int current_now;
 };
 
 struct bq27x00_device_info {
@@ -270,17 +268,12 @@ static void bq27x00_update(struct bq27x00_device_info *di)
 		cache.charge_full = bq27x00_battery_read_lmd(di);
 		cache.cycle_count = bq27x00_battery_read_cyct(di);
 
-		if (!is_bq27500)
-			cache.current_now = bq27x00_read(di, BQ27x00_REG_AI, false);
-
 		/* We only have to read charge design full once */
 		if (di->charge_design_full <= 0)
 			di->charge_design_full = bq27x00_battery_read_ilmd(di);
 	}
 
-	/* Ignore current_now which is a snapshot of the current battery state
-	 * and is likely to be different even between two consecutive reads */
-	if (memcmp(&di->cache, &cache, sizeof(cache) - sizeof(int)) != 0) {
+	if (memcmp(&di->cache, &cache, sizeof(cache)) != 0) {
 		di->cache = cache;
 		power_supply_changed(&di->bat);
 	}
@@ -330,12 +323,9 @@ static int bq27x00_battery_current(struct bq27x00_device_info *di,
 	union power_supply_propval *val)
 {
 	int curr;
+	int flags;
 
-	if (di->chip == BQ27500)
-	    curr = bq27x00_read(di, BQ27x00_REG_AI, false);
-	else
-	    curr = di->cache.current_now;
-
+	curr = bq27x00_read(di, BQ27x00_REG_AI, false);
 	if (curr < 0)
 		return curr;
 
@@ -343,7 +333,8 @@ static int bq27x00_battery_current(struct bq27x00_device_info *di,
 		/* bq27500 returns signed value */
 		val->intval = (int)((s16)curr) * 1000;
 	} else {
-		if (di->cache.flags & BQ27000_FLAG_CHGS) {
+		flags = bq27x00_read(di, BQ27x00_REG_FLAGS, false);
+		if (flags & BQ27000_FLAG_CHGS) {
 			dev_dbg(di->dev, "negative current!\n");
 			curr = -curr;
 		}
-- 
1.7.5.4


^ permalink raw reply related

* [GIT PULL] introduce export.h; reduce module.h usage
From: Paul Gortmaker @ 2011-11-01  0:45 UTC (permalink / raw)
  To: torvalds; +Cc: rusty, mingo, akpm, sfr, linux-kernel

Linus,

Please pull the below to get the module.h split content.  It has been
tested on v3.1-rc6, soaked in linux-next, and re-tested again lots more
today after rebasing it to allow most of the linux-next finds to be
blended in, where they could not be on the original v3.1-rc6 baseline.

A special thanks to Stephen for all his efforts in assisting with this.

Paul.

---


The following changes since commit 839d8810747bbf39e0a5a7f223b67bffa7945f8d:

  Merge branch 'i2c-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jdelvare/staging (2011-10-30 15:54:59 -0700)

are available in the git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/paulg/linux.git modsplit-Oct31_2011

Axel Lin (1):
      unicore32: EXPORT_SYMBOL needs export.h

Heiko Carstens (1):
      s390: add missing module.h/export.h includes

Mark Brown (1):
      cpufreq: Fix build of s3c64xx cpufreq driver for header change

Paul Gortmaker (224):
      module.h: split out the EXPORT_SYMBOL into export.h
      module.h: relocate MODULE_PARM_DESC into moduleparam.h
      range: fix bogus misuse of module.h to get printk()
      mm: delete various needless include <linux/module.h>
      mm: Add export.h for EXPORT_SYMBOL to active symbol exporters
      mm: Map most files to use export.h instead of module.h
      mm: fix implicit stat.h usage in dmapool.c
      kernel: Map most files to use export.h instead of module.h
      kernel: Add <linux/module.h> to files using it implicitly
      kernel: fix several implicit usasges of kmod.h
      kernel: fix two implicit header assumptions in irq_work.c
      kernel: ksysfs.c is implicitly using stat.h
      kernel: params.c needs module.h not moduleparam.h
      kernel: fix up module header handling in rcutiny files
      kernel: Fix files explicitly needing EXPORT_SYMBOL infrastructure
      net: Fix files explicitly needing to include module.h
      net: add moduleparam.h for users of module_param/MODULE_PARM_DESC
      net: Add export.h for EXPORT_SYMBOL/THIS_MODULE to non-modules
      net: fix implicit kmod.h usage in bridge/br_stp_if.c
      fs: add export.h to files using EXPORT_SYMBOL/THIS_MODULE macros
      fs: add module.h to files that were implicitly using it
      acpi: add module.h to files implicitly using/relying on it.
      acpi: delete module.h include from files explicitly not needing it
      acpi: downgrade files from module.h to export.h where possible.
      acpi: add export.h to files using THIS_MODULE/EXPORT_SYMBOL
      x86: fix implicit include of <linux/topology.h> in vsyscall_64
      x86: Fix files explicitly requiring export.h for EXPORT_SYMBOL/THIS_MODULE
      x86: fix up files really needing to include module.h
      x86: efi_32.c is implicitly getting asm/desc.h via module.h
      powerpc: io-workarounds.c was implicitly getting init_mm
      powerpc: add export.h to files making use of EXPORT_SYMBOL
      powerpc: include export.h for files using EXPORT_SYMBOL/THIS_MODULE
      powerpc: Fix up modules that should be including module.h
      powerpc: Fix up implicit stat.h users
      powerpc: Fix up implicit sched.h users
      powerpc: cell/beat_wrapper.h is implicitly using memcpy functions
      powerpc: fix implicit notifier use in converting to export.h
      powerpc: fix implicit use of cache.h in kernel/firmware.c
      powerpc: fix implicit use of mutex.h by include/asm/spu.h
      powerpc: fix two implicit header uses in pseries/plpar_wrappers.h
      powerpc: convert hvconsole.c to export.h ; fix implicit use of errno.h
      powerpc: various straight conversions from module.h --> export.h
      powerpc: remove non-required uses of include <linux/module.h>
      arm: add elf.h to arch/arm/kernel/ptrace.c
      arm: fix implicit memset/string.h usage in various arch/arm files
      arm: fix implicit use of page.h in several arch/arm files
      arm: fix implicit use of moduleparam in mach-mx31*.c
      arm: fix implicit use of sched.h in bcmring/dma.c
      arm: add slab.h to plat-samsung files for GFP_KERNEL
      arm: remove several unnecessary module.h include instances
      arm: convert core files from module.h to export.h
      arm: Add export.h to ARM specific files as required.
      arm: fix implicit module.h users by adding it to arch/arm as required.
      arm: Add moduleparam.h to arch/arm files as required
      sparc: fix implicit use of spitfire.h in pcr.c and of_device_64.c
      sparc: fix implicit use of uaccess.h header in mdesc.c
      sparc: add export.h to arch/sparc files as required
      sparc: move symbol exporters to use export.h not module.h
      sparc: remove several unnecessary module.h include instances
      sparc: Add module.h to files previously implicitly using it.
      mips: fix implicit use of asm/elf.h in kernel/cpu-probe.c
      mips: fix implicit smp.h usage in various files.
      mips: migrate core kernel file from module.h --> export.h
      mips: remove needless include of module.h from core kernel files.
      mips: add export.h to files using EXPORT_SYMBOL/THIS_MODULE
      ia64: Add export.h to arch/ia64 specific files as required
      m68k: Add export.h to the m68k specific files as required
      avr32: add export.h to arch/avr32 for EXPORT_SYMBOL/THIS_MODULE
      parisc: Add export.h to files needing EXPORT_SYMBOL/THIS_MODULE
      parisc: add module.h to files really requiring it
      blackfin: Add export.h to files using EXPORT_SYMBOL/THIS_MODULE
      blackfin: add module.h to files implicitly expecting to use it.
      alpha: fix implicit stat.h usage in pci-sysfs.c
      alpha: Add export.h for THIS_MODULE/EXPORT_SYMBOL
      sh: fix implicit use of stat.h in arch/sh specific files
      sh: Add module.h to arch/sh specific files as required.
      sh: Add export.h to arch/sh specific files as required.
      microblaze: Add export.h to arch/microblaze files as required
      drivers/net: Add module.h to drivers who were implicitly using it
      drivers/net: Add export.h to files using EXPORT_SYMBOL/THIS_MODULE
      drivers/net: change moduleparam.h to module.h as required.
      drivers/net: Add moduleparam.h to drivers as required.
      drivers/net: wireless/ath/ath5k/debug.c does not need module.h
      drivers/net: fix mislocated headers in cxgb4/l2t.c
      crypto: add module.h to those files that are explicitly using it
      mtd: Add export.h for EXPORT_SYMBOL/THIS_MODULE where needed
      mtd: Add module.h to drivers users that were implicitly using it.
      block: add export.h to files using EXPORT_SYMBOL/THIS_MODULE macros
      block: Fix files that are modules and hence need module.h
      block: Change module.h -> export.h in bsg-lib.c
      of: of_pci.c needs export.h since it uses EXPORT_SYMBOLS
      drivers/base: transport_class explicitly requires EXPORT_SYMBOL
      drivers: power_supply_sysfs.c needs stat.h
      drivers/input: Add module.h to modular drivers implicitly using it
      drivers/input: add export.h to symbol exporting files.
      hid: Add module.h to fix up implicit users of it
      hid: Fix up files needing export.h for EXPORT_SYMBOL
      md: Add module.h to all files using it implicitly
      md: Add in export.h for files using EXPORT_SYMBOL
      sound: fix drivers needing module.h not moduleparam.h
      sound: add moduleparam.h to users of module_param/MODULE_PARM_DESC
      sound: Add module.h to the previously silent sound users
      sound: Add export.h for THIS_MODULE/EXPORT_SYMBOL where needed
      pci: Fix files needing export.h for EXPORT_SYMBOL/THIS_MODULE
      pci: add module.h to files implicitly relying on its presence.
      scsi: Add export.h for EXPORT_SYMBOL/THIS_MODULE as required
      scsi: Fix up files implicitly depending on module.h inclusion
      usb: Add module.h to drivers/usb consumers who really use it.
      usb: Add export.h for EXPORT_SYMBOL/THIS_MODULE where needed
      usb: fix implicit usage of gfp.h in host/xhci-hub.c
      bluetooth: add module.h to drivers/bluetooth files as required.
      tty: Add module.h to drivers/tty users who just expect it there.
      tty: Add export.h for EXPORT_SYMBOL/THIS_MODULE to exporters
      rtc: Add module.h to implicit users in drivers/rtc
      i2c: add export.h to i2c-boardinfo.c for EXPORT_SYMBOL
      i2c: Add module.h to modular files prev. implicitly getting it
      cpuidle: Add module.h to drivers/cpuidle files as required.
      cpuidle: ladder.c needs module.h and not just moduleparam.h
      cpufreq: cpufreq_stats.c is a module, and should include module.h
      selinux: Add export.h to files using EXPORT_SYMBOL/THIS_MODULE
      video: Add export.h for THIS_MODULE/EXPORT_SYMBOL to drivers/video
      video: Add module.h to drivers/video files who really use it.
      infiniband: Fix up users implicitly relying on getting stat.h
      infiniband: Fix up module files that need to include module.h
      infiniband: add in export.h for files using EXPORT_SYMBOL/THIS_MODULE
      infiniband: add moduleparam.h to drivers/infiniband as required
      ide/ata: Add export.h for EXPORT_SYMBOL/THIS_MODULE where needed
      ide/ata: Add module.h to the implicit modular users
      drivers/base: Add export.h for EXPORT_SYMBOL/THIS_MODULE as required.
      drivers/base: dma-coherent.c is a module and needs module.h
      drivers/base: base.h implicitly depends on <linux/notifier.h>
      drivers/base: change module.h -> export.h in power/common.c
      drivers/char: Add module.h to those who were using it implicitly
      drivers/char: Add export.h for EXPORT_SYMBOL/THIS_MODULE as required
      drivers/char: Fix implicit use of err.h in ramoops.c
      drivers/clocksource: Add module.h to those who were using it implicitly
      drivers/dca: Add module.h to dca-core.c
      drivers/dca: Add export.h for THIS_MODULE to dca-sysfs.c
      drivers/dma: Add module.h to files implicitly using it.
      drivers/dma: Add export.h to ste_dma40.c
      drivers/edac: Add module.h to mce_amd_inj.c
      drivers/firewire: Add export.h for EXPORT_SYMBOL to core-iso.c
      drivers/firmware: Add module.h to google/gsmi.c
      drivers/gpio: Fix drivers who are implicit users of module.h
      drivers/hwmon: add module.h to ultra45_env.c
      drivers/isdn: Add module.h to ISDN files implicitly using it.
      drivers/isdn: Add export.h for EXPORT_SYMBOL/THIS_MODULE as required.
      drivers/leds: Add module.h to files using it implicitly
      drivers/leds: Add export.h for THIS_MODULE to leds-cobalt-raq.c
      drivers/media: Add export.h for EXPORT_SYMBOL/THIS_MODULE as required
      drivers/media: Add module.h to all files using it implicitly
      drivers/memstick: Add module.h to the prev. implicit modular users
      drivers/message: Add module.h to i2o/pci.c
      drivers/misc: Add module.h to files who are really modular.
      drivers/misc: Add export.h for EXPORT_SYMBOL/THIS_MODULE as required.
      drivers/nfc: add module.h to nfcwilink.c
      drivers/of: Add module.h to of_spi.c
      drivers/of: include export.h for EXPORT_SYMBOL_GPL/THIS_MODULE as required
      drivers/power: Add module.h to the actual modules in drivers/power
      drivers/rapidio: idt_gen2.c is implicitly relying on getting stat.h
      drivers/sh: Add export.h for EXPORT_SYMBOL to intc/virq.c
      drivers/target: Add export.h to files as required.
      drivers/target: Add module.h to drivers/target files as required.
      drivers/w1: Add export.h for EXPORT_SYMBOL/THIS_MODULE
      drivers/w1: Add moduleparam.h to drivers/w1/w1_int.c
      drivers/zorro: Add export.h to proc.c
      bcma: add module.h to the modular portions of this driver
      bcma: fix implicit use of export.h contents
      gpu: Add export.h as required to drivers/gpu files.
      gpu: add module.h to drivers/gpu files as required.
      gpu: add moduleparam.h to drivers/gpu/drm/drm_crtc_helper.c
      mfd: Add module.h to the implicit drivers/mfd users
      mfd: Add export.h for EXPORT_SYMBOL/THIS_MODULE as required
      mmc: Add module.h to drivers/mmc users assuming implicit presence.
      mmc: Add export.h for EXPORT_SYMBOL/THIS_MODULE as required
      mmc: Fix implicit use of stat.h header in associated files
      ssb: Add module.h to the real modules in drivers/ssb
      ssb: Add export.h to files using EXPORT_SYMBOL/THIS_MODULE
      staging: Add export.h for THIS_MODULE/EXPORT_SYMBOL to drivers/staging users.
      staging: Add moduleparam.h to drivers/staging files as required
      staging: Add module.h to more drivers implicitly using it.
      uio: Add module.h to implicit drivers/uio users
      xen: Add module.h to modular drivers/xen users.
      xen: Add export.h for THIS_MODULE/EXPORT_SYMBOL to various xen users.
      kvm: fix implicit use of stat.h header file
      kvm: iommu.c file requires the full module.h present.
      lguest: add export.h to lguest files for THIS_MODULE/EXPORT_SYMBOL
      virtio: Add module.h to drivers/virtio users.
      intel-iommu: now needs export.h for EXPORT_SYMBOL_GPL
      regulator: Add export.h for THIS_MODULE to dummy.c
      regulator: Add module.h to drivers/regulator users as required
      regulator: Fix implicit use of notifier.h by driver.h
      spi: Add module.h to implicit users in drivers/spi
      spi: Add export.h for THIS_MODULE/EXPORT_SYMBOL to spi.c
      drivers/uwb: fix implicit use of stat.h
      uwb: Add module.h to the real uwb modular users.
      uwb: Add export.h for EXPORT_SYMBOL/THIS_MODULE as required
      pcmcia: add module.h to db1xxx_ss.c since it is modular.
      pcmcia: Add export.h to drivers/pcmcia as required.
      pnp: Add export.h for EXPORT_SYMBOL/THIS_MODULE as required
      watchdog: Add module.h to drivers/watchdog/stmp3xxx_wdt.c
      lib: dma-debug needs export.h for EXPORT_SYMBOL
      vermagic: delete unused include of <linux/module.h>
      sysdev.h: dont include <linux/module.h> for no reason
      net: inet_timewait_sock doesnt need <linux/module.h>
      net: sch_generic remove redundant use of <linux/module.h>
      device_cgroup.h: delete needless include <linux/module.h>
      miscdevice.h: delete unnecessary inclusion of module.h
      acpi: remove module.h include from platform/aclinux.h
      of_platform.h: delete needless include <linux/module.h>
      of: fix implicit use of errno.h in include/linux/of.h
      stop_machine.h: fix implicit use of smp.h for smp_processor_id
      miscdevice.h: fix up implicit use of lists and types
      linux/dmaengine.h: fix implicit use of bitmap.h and asm/page.h
      pm_runtime.h: explicitly requires notifier.h
      uwb.h: fix implicit use of asm/page.h for PAGE_SIZE
      crypto.h: remove unused crypto_tfm_alg_modname() inline
      include: convert various register fcns to macros to avoid include chaining
      include: replace linux/module.h with "struct module" wherever possible
      nf_conntrack.h: fix up fallout from implicit moduleparam.h presence
      ip_vs.h: fix implicit use of module_get/module_put from module.h
      bluetooth: macroize two small inlines to avoid module.h
      irq: don't put module.h into irq.h for tracking irqgen modules.
      Revert "tracing: Include module.h in define_trace.h"

Randy Dunlap (1):
      drivers/sfi: sfi_acpi.c needs sysfs.h

Stephen Rothwell (2):
      drivers/media: ir-raw.c needs kmod.h for request_module
      pinctrl: EXPORT_SYMBOL needs export.h

 include/acpi/platform/aclinux.h                    |    1 -
 include/drm/drmP.h                                 |    3 +-
 include/linux/bcma/bcma.h                          |    7 +-
 include/linux/blkdev.h                             |    2 +-
 include/linux/cpuidle.h                            |    3 +-
 include/linux/crypto.h                             |    6 --
 include/linux/device.h                             |   15 ++-
 include/linux/device_cgroup.h                      |    1 -
 include/linux/dmaengine.h                          |    2 +
 include/linux/export.h                             |   89 ++++++++++++++++++++
 include/linux/firmware.h                           |    2 +-
 include/linux/ftrace.h                             |    2 +-
 include/linux/gameport.h                           |   17 ++--
 include/linux/hid.h                                |    9 +-
 include/linux/i2c.h                                |   10 +-
 include/linux/ipmi.h                               |    3 +-
 include/linux/ipmi_smi.h                           |    1 -
 include/linux/irq.h                                |   32 +++-----
 include/linux/irqdesc.h                            |    1 +
 include/linux/mdio-bitbang.h                       |    3 +-
 include/linux/miscdevice.h                         |    3 +-
 include/linux/module.h                             |   73 +----------------
 include/linux/moduleparam.h                        |    5 +
 include/linux/mtd/mtd.h                            |    3 +-
 include/linux/of.h                                 |    1 +
 include/linux/of_platform.h                        |    1 -
 include/linux/pci_hotplug.h                        |   10 +--
 include/linux/pm_runtime.h                         |    1 +
 include/linux/regmap.h                             |    2 +-
 include/linux/regulator/driver.h                   |    1 +
 include/linux/serio.h                              |   20 +++--
 include/linux/ssb/ssb.h                            |    7 +-
 include/linux/stop_machine.h                       |    1 +
 include/linux/sunrpc/svc_xprt.h                    |    3 +-
 include/linux/sysdev.h                             |    1 -
 include/linux/textsearch.h                         |    3 +-
 include/linux/uio_driver.h                         |   12 ++--
 include/linux/usb.h                                |    9 +-
 include/linux/uwb.h                                |    1 +
 include/linux/uwb/umc.h                            |    7 +-
 include/linux/vermagic.h                           |    1 -
 include/linux/vlynq.h                              |    3 +-
 include/media/saa7146.h                            |    3 +-
 include/media/v4l2-int-device.h                    |    3 +-
 include/net/bluetooth/hci_core.h                   |   24 +++---
 include/net/inet_timewait_sock.h                   |    1 -
 include/net/ip_vs.h                                |   15 ++--
 include/net/lib80211.h                             |    3 +-
 include/net/netfilter/nf_conntrack.h               |    2 +
 include/net/sch_generic.h                          |    1 -
 include/net/sock.h                                 |    2 +-
 include/sound/core.h                               |    2 +-
 include/trace/define_trace.h                       |   10 --
 include/trace/events/module.h                      |    2 +-
 include/xen/xenbus.h                               |    1 +

 [ ...snip lots of one line change per file diffstat info ... ]

 2059 files changed, 2251 insertions(+), 606 deletions(-)
 create mode 100644 include/linux/export.h

^ permalink raw reply

* Re: Plans for OE classic future
From: Ulf Samuelsson @ 2011-11-01  0:38 UTC (permalink / raw)
  To: openembedded-devel
In-Reply-To: <20111027122735.GC12609@jama.jama.net>

2011-10-27 14:27, Martin Jansa skrev:
> On Thu, Oct 27, 2011 at 01:56:43PM +0200, Henning Heinold wrote:
>> On Thu, Oct 27, 2011 at 10:53:13AM +0000, Mats Kärrman wrote:
>>> Hi,
>>>
>>> Are there any plans for new releases and/or maintenance branches of OE classic?
>>>
>>> BR / Mats
>> Hi,
>>
>> http://cgit.openembedded.org/openembedded/log/?h=org.openembedded.dev
>>
>> and
>>
>> http://cgit.openembedded.org/openembedded/log/?h=2011.03-maintenance
>>
>> Bye Henning
> Are you showing that maintenance ibranch is not so old and that only few
> things changed in old OE-classic since then? :)
>
> Afaik: nobody plans to do another release from OE-classic and
> oe-core/meta-oe/BSP's/... are veryclose to first release

What repository is used for the BSP's ?

BR
Ulf Samuelsson

> Regards
>
>> PS: Feel free to update the wiki
>>
>> _______________________________________________
>> Openembedded-devel mailing list
>> Openembedded-devel@lists.openembedded.org
>> http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-devel
>
>
> _______________________________________________
> Openembedded-devel mailing list
> Openembedded-devel@lists.openembedded.org
> http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-devel


-- 
Best Regards
Ulf Samuelsson



^ permalink raw reply

* [PATCH v2] gpio/samsung: Add device tree support for Exynos4
From: Thomas Abraham @ 2011-11-01  0:43 UTC (permalink / raw)
  To: devicetree-discuss
  Cc: linux-samsung-soc, grant.likely, rob.herring, arnd, kgene.kim,
	linux-arm-kernel, Thomas Abraham

As gpio chips get registered, a device tree node which represents the
gpio chip is searched and attached to it. A translate function is also
provided to convert the gpio specifier into actual platform settings
for pin function selection, pull up/down and driver strength settings.

Signed-off-by: Thomas Abraham <thomas.abraham@linaro.org>
Acked-by: Grant Likely <grant.likely@secretlab.ca>
---
Changes since v1:
- As suggested by Rob and Grant, the gpio controller node lookup is based
  on the base address of the gpio controller instead of the unique
  per-controller compatible property value.

This patch is based on the following tree and branch.
git://git.linaro.org/git/people/arnd/arm-soc.git  branch: for-next

 .../devicetree/bindings/gpio/gpio-samsung.txt      |   40 ++++++++++++
 drivers/gpio/gpio-samsung.c                        |   66 ++++++++++++++++++++
 2 files changed, 106 insertions(+), 0 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/gpio/gpio-samsung.txt

diff --git a/Documentation/devicetree/bindings/gpio/gpio-samsung.txt b/Documentation/devicetree/bindings/gpio/gpio-samsung.txt
new file mode 100644
index 0000000..c143058
--- /dev/null
+++ b/Documentation/devicetree/bindings/gpio/gpio-samsung.txt
@@ -0,0 +1,40 @@
+Samsung Exynos4 GPIO Controller
+
+Required properties:
+- compatible: Compatible property value should be "samsung,exynos4-gpio>".
+
+- reg: Physical base address of the controller and length of memory mapped
+  region.
+
+- #gpio-cells: Should be 4. The syntax of the gpio specifier used by client nodes
+  should be the following with values derived from the SoC user manual.
+     <[phandle of the gpio controller node]
+      [pin number within the gpio controller]
+      [mux function]
+      [pull up/down]
+      [drive strength]>
+
+  Values for gpio specifier:
+  - Pin number: is a value between 0 to 7.
+  - Pull Up/Down: 0 - Pull Up/Down Disabled.
+                  1 - Pull Down Enabled.
+                  3 - Pull Up Enabled.
+  - Drive Strength: 0 - 1x,
+                    1 - 3x,
+                    2 - 2x,
+                    3 - 4x
+
+- gpio-controller: Specifies that the node is a gpio controller.
+- #address-cells: should be 1.
+- #size-cells: should be 1. 
+
+Example:
+
+	gpa0: gpio-controller@11400000 {
+		#address-cells = <1>;
+		#size-cells = <1>;
+		compatible = "samsung,exynos4-gpio";
+		reg = <0x11400000 0x20>;
+		#gpio-cells = <4>;
+		gpio-controller;
+	};
diff --git a/drivers/gpio/gpio-samsung.c b/drivers/gpio/gpio-samsung.c
index 8662518..0140756 100644
--- a/drivers/gpio/gpio-samsung.c
+++ b/drivers/gpio/gpio-samsung.c
@@ -24,6 +24,9 @@
 #include <linux/interrupt.h>
 #include <linux/sysdev.h>
 #include <linux/ioport.h>
+#include <linux/of.h>
+#include <linux/slab.h>
+#include <linux/of_address.h>
 
 #include <asm/irq.h>
 
@@ -2374,6 +2377,63 @@ static struct samsung_gpio_chip exynos4_gpios_3[] = {
 #endif
 };
 
+#if defined(CONFIG_ARCH_EXYNOS4) && defined(CONFIG_OF)
+int exynos4_gpio_xlate(struct gpio_chip *gc, struct device_node *np,
+			 const void *gpio_spec, u32 *flags)
+{
+	const __be32 *gpio = gpio_spec;
+	const u32 n = be32_to_cpup(gpio);
+	unsigned int pin = gc->base + be32_to_cpu(gpio[0]);
+
+	if (gc->of_gpio_n_cells < 4) {
+		WARN_ON(1);
+		return -EINVAL;
+	}
+
+	if (n > gc->ngpio)
+		return -EINVAL;
+
+	s3c_gpio_cfgpin(pin, S3C_GPIO_SFN(be32_to_cpu(gpio[1])));
+	s3c_gpio_setpull(pin, be32_to_cpu(gpio[2]));
+	s5p_gpio_set_drvstr(pin, be32_to_cpu(gpio[3]));
+	return n;
+}
+
+static const struct of_device_id exynos4_gpio_dt_match[] __initdata = {
+	{ .compatible = "samsung,exynos4-gpio", },
+	{}
+};
+
+static __init void exynos4_gpiolib_attach_ofnode(struct samsung_gpio_chip *chip,
+						u64 base, u64 offset)
+{
+	struct gpio_chip *gc =  &chip->chip;
+	u64 address;
+
+	if (!of_have_populated_dt())
+		return;
+
+	address = (chip->base) ? (base + ((u32)chip->base & 0xfff)) :
+			(base + offset);
+
+	gc->of_node = of_find_matching_node_by_address(NULL,
+			exynos4_gpio_dt_match, address);
+	if (!gc->of_node) {
+		pr_info("gpio: device tree node not found for gpio controller"
+			" with base address %08llx\n", address);
+		return;
+	}
+	gc->of_gpio_n_cells = 4;
+	gc->of_xlate = exynos4_gpio_xlate;
+}
+#else
+static __init void exynos4_gpiolib_attach_ofnode(struct samsung_gpio_chip *chip,
+						u64 base, u64 offset)
+{
+	return;
+}
+#endif /* defined(CONFIG_ARCH_EXYNOS4) && defined(CONFIG_OF) */
+
 /* TODO: cleanup soc_is_* */
 static __init int samsung_gpiolib_init(void)
 {
@@ -2455,6 +2515,8 @@ static __init int samsung_gpiolib_init(void)
 				chip->config = &exynos4_gpio_cfg;
 				chip->group = group++;
 			}
+			exynos4_gpiolib_attach_ofnode(chip,
+					EXYNOS4_PA_GPIO1, i * 0x20);
 		}
 		samsung_gpiolib_add_4bit_chips(exynos4_gpios_1, nr_chips, S5P_VA_GPIO1);
 
@@ -2467,6 +2529,8 @@ static __init int samsung_gpiolib_init(void)
 				chip->config = &exynos4_gpio_cfg;
 				chip->group = group++;
 			}
+			exynos4_gpiolib_attach_ofnode(chip,
+					EXYNOS4_PA_GPIO2, i * 0x20);
 		}
 		samsung_gpiolib_add_4bit_chips(exynos4_gpios_2, nr_chips, S5P_VA_GPIO2);
 
@@ -2479,6 +2543,8 @@ static __init int samsung_gpiolib_init(void)
 				chip->config = &exynos4_gpio_cfg;
 				chip->group = group++;
 			}
+			exynos4_gpiolib_attach_ofnode(chip,
+					EXYNOS4_PA_GPIO3, i * 0x20);
 		}
 		samsung_gpiolib_add_4bit_chips(exynos4_gpios_3, nr_chips, S5P_VA_GPIO3);
 
-- 
1.7.4.4

^ permalink raw reply related

* [PATCH v2] gpio/samsung: Add device tree support for Exynos4
From: Thomas Abraham @ 2011-11-01  0:43 UTC (permalink / raw)
  To: linux-arm-kernel

As gpio chips get registered, a device tree node which represents the
gpio chip is searched and attached to it. A translate function is also
provided to convert the gpio specifier into actual platform settings
for pin function selection, pull up/down and driver strength settings.

Signed-off-by: Thomas Abraham <thomas.abraham@linaro.org>
Acked-by: Grant Likely <grant.likely@secretlab.ca>
---
Changes since v1:
- As suggested by Rob and Grant, the gpio controller node lookup is based
  on the base address of the gpio controller instead of the unique
  per-controller compatible property value.

This patch is based on the following tree and branch.
git://git.linaro.org/git/people/arnd/arm-soc.git  branch: for-next

 .../devicetree/bindings/gpio/gpio-samsung.txt      |   40 ++++++++++++
 drivers/gpio/gpio-samsung.c                        |   66 ++++++++++++++++++++
 2 files changed, 106 insertions(+), 0 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/gpio/gpio-samsung.txt

diff --git a/Documentation/devicetree/bindings/gpio/gpio-samsung.txt b/Documentation/devicetree/bindings/gpio/gpio-samsung.txt
new file mode 100644
index 0000000..c143058
--- /dev/null
+++ b/Documentation/devicetree/bindings/gpio/gpio-samsung.txt
@@ -0,0 +1,40 @@
+Samsung Exynos4 GPIO Controller
+
+Required properties:
+- compatible: Compatible property value should be "samsung,exynos4-gpio>".
+
+- reg: Physical base address of the controller and length of memory mapped
+  region.
+
+- #gpio-cells: Should be 4. The syntax of the gpio specifier used by client nodes
+  should be the following with values derived from the SoC user manual.
+     <[phandle of the gpio controller node]
+      [pin number within the gpio controller]
+      [mux function]
+      [pull up/down]
+      [drive strength]>
+
+  Values for gpio specifier:
+  - Pin number: is a value between 0 to 7.
+  - Pull Up/Down: 0 - Pull Up/Down Disabled.
+                  1 - Pull Down Enabled.
+                  3 - Pull Up Enabled.
+  - Drive Strength: 0 - 1x,
+                    1 - 3x,
+                    2 - 2x,
+                    3 - 4x
+
+- gpio-controller: Specifies that the node is a gpio controller.
+- #address-cells: should be 1.
+- #size-cells: should be 1. 
+
+Example:
+
+	gpa0: gpio-controller at 11400000 {
+		#address-cells = <1>;
+		#size-cells = <1>;
+		compatible = "samsung,exynos4-gpio";
+		reg = <0x11400000 0x20>;
+		#gpio-cells = <4>;
+		gpio-controller;
+	};
diff --git a/drivers/gpio/gpio-samsung.c b/drivers/gpio/gpio-samsung.c
index 8662518..0140756 100644
--- a/drivers/gpio/gpio-samsung.c
+++ b/drivers/gpio/gpio-samsung.c
@@ -24,6 +24,9 @@
 #include <linux/interrupt.h>
 #include <linux/sysdev.h>
 #include <linux/ioport.h>
+#include <linux/of.h>
+#include <linux/slab.h>
+#include <linux/of_address.h>
 
 #include <asm/irq.h>
 
@@ -2374,6 +2377,63 @@ static struct samsung_gpio_chip exynos4_gpios_3[] = {
 #endif
 };
 
+#if defined(CONFIG_ARCH_EXYNOS4) && defined(CONFIG_OF)
+int exynos4_gpio_xlate(struct gpio_chip *gc, struct device_node *np,
+			 const void *gpio_spec, u32 *flags)
+{
+	const __be32 *gpio = gpio_spec;
+	const u32 n = be32_to_cpup(gpio);
+	unsigned int pin = gc->base + be32_to_cpu(gpio[0]);
+
+	if (gc->of_gpio_n_cells < 4) {
+		WARN_ON(1);
+		return -EINVAL;
+	}
+
+	if (n > gc->ngpio)
+		return -EINVAL;
+
+	s3c_gpio_cfgpin(pin, S3C_GPIO_SFN(be32_to_cpu(gpio[1])));
+	s3c_gpio_setpull(pin, be32_to_cpu(gpio[2]));
+	s5p_gpio_set_drvstr(pin, be32_to_cpu(gpio[3]));
+	return n;
+}
+
+static const struct of_device_id exynos4_gpio_dt_match[] __initdata = {
+	{ .compatible = "samsung,exynos4-gpio", },
+	{}
+};
+
+static __init void exynos4_gpiolib_attach_ofnode(struct samsung_gpio_chip *chip,
+						u64 base, u64 offset)
+{
+	struct gpio_chip *gc =  &chip->chip;
+	u64 address;
+
+	if (!of_have_populated_dt())
+		return;
+
+	address = (chip->base) ? (base + ((u32)chip->base & 0xfff)) :
+			(base + offset);
+
+	gc->of_node = of_find_matching_node_by_address(NULL,
+			exynos4_gpio_dt_match, address);
+	if (!gc->of_node) {
+		pr_info("gpio: device tree node not found for gpio controller"
+			" with base address %08llx\n", address);
+		return;
+	}
+	gc->of_gpio_n_cells = 4;
+	gc->of_xlate = exynos4_gpio_xlate;
+}
+#else
+static __init void exynos4_gpiolib_attach_ofnode(struct samsung_gpio_chip *chip,
+						u64 base, u64 offset)
+{
+	return;
+}
+#endif /* defined(CONFIG_ARCH_EXYNOS4) && defined(CONFIG_OF) */
+
 /* TODO: cleanup soc_is_* */
 static __init int samsung_gpiolib_init(void)
 {
@@ -2455,6 +2515,8 @@ static __init int samsung_gpiolib_init(void)
 				chip->config = &exynos4_gpio_cfg;
 				chip->group = group++;
 			}
+			exynos4_gpiolib_attach_ofnode(chip,
+					EXYNOS4_PA_GPIO1, i * 0x20);
 		}
 		samsung_gpiolib_add_4bit_chips(exynos4_gpios_1, nr_chips, S5P_VA_GPIO1);
 
@@ -2467,6 +2529,8 @@ static __init int samsung_gpiolib_init(void)
 				chip->config = &exynos4_gpio_cfg;
 				chip->group = group++;
 			}
+			exynos4_gpiolib_attach_ofnode(chip,
+					EXYNOS4_PA_GPIO2, i * 0x20);
 		}
 		samsung_gpiolib_add_4bit_chips(exynos4_gpios_2, nr_chips, S5P_VA_GPIO2);
 
@@ -2479,6 +2543,8 @@ static __init int samsung_gpiolib_init(void)
 				chip->config = &exynos4_gpio_cfg;
 				chip->group = group++;
 			}
+			exynos4_gpiolib_attach_ofnode(chip,
+					EXYNOS4_PA_GPIO3, i * 0x20);
 		}
 		samsung_gpiolib_add_4bit_chips(exynos4_gpios_3, nr_chips, S5P_VA_GPIO3);
 
-- 
1.7.4.4

^ permalink raw reply related

* Re: [git patches] libata updates, GPG signed (but see admin notes)
From: H. Peter Anvin @ 2011-11-01  0:42 UTC (permalink / raw)
  To: Jeff Garzik
  Cc: Junio C Hamano, Linus Torvalds, git, James Bottomley,
	Andrew Morton, linux-ide, LKML
In-Reply-To: <4EAF3556.3000001@garzik.org>

> 
> The main worry is Linus ($human_who_pulls) gets
> cryptographically-verified data at the time he pulls.  Once Linus
> republishes his tree (git push), there will be few, if any, wanting to
> verify Jeff Garzik's signature.
> 
> So no, I don't see that as a _driving_ need in the kernel's case.
> 
> And IMO the kernel will be a mix of signed and unsigned content for a
> while, possibly forever.
> 

I think the desire is to be able to deconstruct things if things were to
go wrong.

	-hpa

-- 
H. Peter Anvin, Intel Open Source Technology Center
I work for Intel.  I don't speak on their behalf.


^ permalink raw reply

* Re: HT (Hyper Threading) aware process scheduling doesn't work as it should
From: Con Kolivas @ 2011-11-01  0:41 UTC (permalink / raw)
  To: Mike Galbraith; +Cc: Artem S. Tashkinov, linux-kernel
In-Reply-To: <1320061348.6389.18.camel@marge.simson.net>

On Mon, 31 Oct 2011 12:42:28 PM Mike Galbraith wrote:
> On Mon, 2011-10-31 at 21:06 +1100, Con Kolivas wrote:
> > On Sun, 30 Oct 2011 07:57:12 PM Artem S. Tashkinov wrote:
> > > I've found out that even on Linux 3.0.8 the process scheduler
> > > doesn't
> > > correctly distributes the load amongst virtual CPUs. E.g. on a
> > > 4-core
> > > system (8 total virtual CPUs) the process scheduler often run some
> > > instances of four different tasks on the same physical CPU.
> > > 
> > > Any thoughts? comments? I think this is quite a serious problem.
> > 
> > Intense cache locality logic, power saving concepts, cpu frequency
> > governor behaviour and separate runqueues per CPU within the current
> > CPU process scheduler in the current mainline linux kernel will
> > ocasionally do this. Some workloads will be better, while others will
> > be worse. Feel free to try my BFS cpu scheduler if you wish a CPU
> > process scheduler that spreads work more evenly across CPUs.
> > 
> > Alas the last version I synced up with will not apply cleanly past about
> > 3.0.6 I believe:
> > 
> > http://ck.kolivas.org/patches/bfs/3.0.0/3.0-sched-bfs-413.patch
> 
> Yeah, it handles independent tasks well, but cache misses can be
> excruciatingly painful for the others.
> 
> Q6600 box, configs as identical as possible, tbench 8
> 
> 3.0.6-bfs413       728.6 MB/sec
> 3.0.8             1146.7 MB/sec
> 
> 	-Mike

Fortunately BFS is about optimising user visible service latency for normal 
users running normal applications on normal desktops under normal workloads, 
and not about tbench throughput.

Regards,
Con
-- 
-ck

^ permalink raw reply

* RE: Question about a corner case in the CMA
From: Hefty, Sean @ 2011-11-01  0:40 UTC (permalink / raw)
  To: Dotan Barak; +Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
In-Reply-To: <CALvMawo3aR2xAUMsw8_t4-9Abe471gm+pG7Qif3V5iWpbFm7qg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>

> If a user tried to join a multicast group and the variable "mc" is being added
> to the list of the mc_list:
> 1) If the write() fails, the value of mc->next may be changed by another
> thread (for example, removing the mcast which is pointed by mc->next)
>     will the "mc->next" still point to the right location? (since i don't see
> any "volatile" or something like this).

This shouldn't matter.  On a failure, the code searches the mc_list for the entry and removes it.  mc->next can change between entering the mc entry and removing it.

- Sean
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply

* seagate drive and i/o errors
From: Peter Teoh @ 2011-11-01  0:39 UTC (permalink / raw)
  To: kernelnewbies
In-Reply-To: <4EA1B01E.1050903@tysdomain.com>

care to describe the error?   i suspect it may be hardware error.
just post your dmesg after u plug in the hardware device.   perhaps do
a lsusb -vv and show us the details of the drive?

For automatically mounting filesystem, if u are on ubuntu:

https://help.ubuntu.com/community/Fstab

(just update the fstab file) is one option.

Alternatively is automount (and using autofs kernel module) is another
option.   If u are on linux kernel 3.1.0 (mine) the kernel module is
called autofs4, not sure what is the difference, but nevertheless just
do a "modprobe autofs" (not default loaded for me):

https://help.ubuntu.com/community/Autofs

On Sat, Oct 22, 2011 at 1:47 AM, Littlefield, Tyler <tyler@tysdomain.com> wrote:
> Hello all,
> I have a quick question. When I do a ls on this drive and it's spun
> down, i get an i/o error. I'm curious if there's a way to write a module
> or do something to make the drive wake up when I do a r/w request on it?
> I've had an external and it never had this problem. I also know i could
> modify the scsi params to make it not sleep, but that doesn't work and
> that is not the best of ideas anyway. I like it sleeping, I don't even
> mind waiting for an LS. It's just hard to manage when i have to umount
> -l the directory, then figure out what sd* dev it's on.
>
> --
>
> Take care,
> Ty
> Web: http://tds-solutions.net
> The Aspen project: a light-weight barebones mud engine
> http://code.google.com/p/aspenmud
>
> Sent from my toaster.
>
>
> _______________________________________________
> Kernelnewbies mailing list
> Kernelnewbies at kernelnewbies.org
> http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
>



-- 
Regards,
Peter Teoh

^ permalink raw reply

* Protected Project.
From: Mr.Vincent Cheng @ 2011-10-31 23:58 UTC (permalink / raw)





   I am Mr. Vincent Cheng Hoi Chuen, GBS, JP Chairman of the Hong Kong and
Shanghai Banking Corporation Limited.i have a business proposal of
TwentyTwo million Five Hundred Thousand United State Dollars only for
you to transact with me from my bank to your country.

All confirmable documents to back up the claims will be made available
toyou prior to your acceptance and as soon as I receive your return mail
Via my email address: vincent_cheng011@yahoo.co.jp and I will let you know
whatis required of you.Your earliest response to this letter will be
appreciated.

Best Regards,
Mr.Vincent Cheng


^ permalink raw reply

* possibly silly question (raid failover)
From: Miles Fidelman @ 2011-11-01  0:38 UTC (permalink / raw)
  To: linux-raid@vger.kernel.org

Hi Folks,

I've been exploring various ways to build a "poor man's high 
availability cluster."  Currently I'm running two nodes, using raid on 
each box, running DRBD across the boxes, and running Xen virtual 
machines on top of that.

I now have two brand new servers - for a total of four nodes - each with 
four large drives, and four gigE ports.

Between the configuration of the systems, and rack space limitations, 
I'm trying to use each server for both storage and processing - and been 
looking at various options for building a cluster file system across all 
16 drives, that supports VM migration/failover across all for nodes, and 
that's resistant to both single-drive failures, and to losing an entire 
server (and it's 4 drives), and maybe even losing two servers (8 drives).

The approach that looks most interesting is Sheepdog - but it's both 
tied to KVM rather than Xen, and a bit immature.

But it lead me to wonder if something like this might make sense:
- mount each drive using AoE
- run md RAID 10 across all 16 drives one one node
- mount the resulting md device using AoE
- if the node running the md device fails, use pacemaker/crm to 
auto-start an md device on another node, re-assemble and republish the array
- resulting in a 16-drive raid10 array that's accessible from all nodes

Or is this just silly and/or wrongheaded?

Miles Fidelman

-- 
In theory, there is no difference between theory and practice.
In<fnord>  practice, there is.   .... Yogi Berra



^ permalink raw reply

* [PATCH pm 2/2] freezer: kill unused set_freezable_with_signal()
From: Tejun Heo @ 2011-11-01  0:37 UTC (permalink / raw)
  To: Rafael J. Wysocki, linux-pm, linux-kernel, linux-usb,
	Seth Forshee, Oleg Nesterov, Alan Stern, Greg Kroah-Hartman
In-Reply-To: <20111101003726.GM18855@google.com>

There's no in-kernel user of set_freezable_with_signal() left.  Mixing
TIF_SIGPENDING with kernel threads can lead to nasty corner cases as
kernel threads never travel signal delivery path on their own.

e.g. the current implementation is buggy in the cancelation path of
__thaw_task().  It calls recalc_sigpending_and_wake() in an attempt to
clear TIF_SIGPENDING but the function never clears it regardless of
sigpending state.  This means that signallable freezable kthreads may
continue executing with !freezing() && stuck TIF_SIGPENDING, which can
be troublesome.

This patch removes set_freezable_with_signal() along with
PF_FREEZER_NOSIG and recalc_sigpending*() calls in freezer.  User
tasks get TIF_SIGPENDING, kernel tasks get woken up and the spurious
sigpending is dealt with in the usual signal delivery path.

Signed-off-by: Tejun Heo <tj@kernel.org>
Acked-by: Oleg Nesterov <oleg@redhat.com>
---
 include/linux/freezer.h |   20 +-------------------
 include/linux/sched.h   |    1 -
 kernel/freezer.c        |   27 ++++++---------------------
 kernel/kthread.c        |    2 +-
 4 files changed, 8 insertions(+), 42 deletions(-)

diff --git a/include/linux/freezer.h b/include/linux/freezer.h
index 4b3dc4c..5f32321 100644
--- a/include/linux/freezer.h
+++ b/include/linux/freezer.h
@@ -49,7 +49,7 @@ static inline bool try_to_freeze(void)
 }
 
 extern bool freeze_task(struct task_struct *p);
-extern bool __set_freezable(bool with_signal);
+extern bool set_freezable(void);
 
 #ifdef CONFIG_CGROUP_FREEZER
 extern bool cgroup_freezing(struct task_struct *task);
@@ -105,23 +105,6 @@ static inline int freezer_should_skip(struct task_struct *p)
 }
 
 /*
- * Tell the freezer that the current task should be frozen by it
- */
-static inline bool set_freezable(void)
-{
-	return __set_freezable(false);
-}
-
-/*
- * Tell the freezer that the current task should be frozen by it and that it
- * should send a fake signal to the task to freeze it.
- */
-static inline bool set_freezable_with_signal(void)
-{
-	return __set_freezable(true);
-}
-
-/*
  * Freezer-friendly wrappers around wait_event_interruptible(),
  * wait_event_killable() and wait_event_interruptible_timeout(), originally
  * defined in <linux/wait.h>
@@ -181,7 +164,6 @@ static inline void freezer_do_not_count(void) {}
 static inline void freezer_count(void) {}
 static inline int freezer_should_skip(struct task_struct *p) { return 0; }
 static inline void set_freezable(void) {}
-static inline void set_freezable_with_signal(void) {}
 
 #define wait_event_freezable(wq, condition)				\
 		wait_event_interruptible(wq, condition)
diff --git a/include/linux/sched.h b/include/linux/sched.h
index 57f916d..84fd546 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -1781,7 +1781,6 @@ extern void thread_group_times(struct task_struct *p, cputime_t *ut, cputime_t *
 #define PF_MEMPOLICY	0x10000000	/* Non-default NUMA mempolicy */
 #define PF_MUTEX_TESTER	0x20000000	/* Thread belongs to the rt mutex tester */
 #define PF_FREEZER_SKIP	0x40000000	/* Freezer should not count it as freezable */
-#define PF_FREEZER_NOSIG 0x80000000	/* Freezer won't send signals to it */
 
 /*
  * Only the _current_ task can read/write to tsk->flags, but other
diff --git a/kernel/freezer.c b/kernel/freezer.c
index 0845321..128c5aa 100644
--- a/kernel/freezer.c
+++ b/kernel/freezer.c
@@ -39,7 +39,7 @@ bool freezing_slow_path(struct task_struct *p)
 	if (pm_nosig_freezing || cgroup_freezing(p))
 		return true;
 
-	if (pm_freezing && !(p->flags & PF_FREEZER_NOSIG))
+	if (pm_freezing && !(p->flags & PF_KTHREAD))
 		return true;
 
 	return false;
@@ -72,10 +72,6 @@ bool __refrigerator(bool check_kthr_stop)
 		schedule();
 	}
 
-	spin_lock_irq(&current->sighand->siglock);
-	recalc_sigpending(); /* We sent fake signal, clean it up */
-	spin_unlock_irq(&current->sighand->siglock);
-
 	pr_debug("%s left refrigerator\n", current->comm);
 
 	/*
@@ -120,7 +116,7 @@ bool freeze_task(struct task_struct *p)
 		return false;
 	}
 
-	if (!(p->flags & PF_FREEZER_NOSIG)) {
+	if (!(p->flags & PF_KTHREAD)) {
 		fake_signal_wake_up(p);
 		/*
 		 * fake_signal_wake_up() goes through p's scheduler
@@ -145,28 +141,19 @@ void __thaw_task(struct task_struct *p)
 	 * be visible to @p as waking up implies wmb.  Waking up inside
 	 * freezer_lock also prevents wakeups from leaking outside
 	 * refrigerator.
-	 *
-	 * If !FROZEN, @p hasn't reached refrigerator, recalc sigpending to
-	 * avoid leaving dangling TIF_SIGPENDING behind.
 	 */
 	spin_lock_irqsave(&freezer_lock, flags);
-	if (frozen(p)) {
+	if (frozen(p))
 		wake_up_process(p);
-	} else {
-		spin_lock(&p->sighand->siglock);
-		recalc_sigpending_and_wake(p);
-		spin_unlock(&p->sighand->siglock);
-	}
 	spin_unlock_irqrestore(&freezer_lock, flags);
 }
 
 /**
- * __set_freezable - make %current freezable
- * @with_signal: do we want %TIF_SIGPENDING for notification too?
+ * set_freezable - make %current freezable
  *
  * Mark %current freezable and enter refrigerator if necessary.
  */
-bool __set_freezable(bool with_signal)
+bool set_freezable(void)
 {
 	might_sleep();
 
@@ -177,10 +164,8 @@ bool __set_freezable(bool with_signal)
 	 */
 	spin_lock_irq(&freezer_lock);
 	current->flags &= ~PF_NOFREEZE;
-	if (with_signal)
-		current->flags &= ~PF_FREEZER_NOSIG;
 	spin_unlock_irq(&freezer_lock);
 
 	return try_to_freeze();
 }
-EXPORT_SYMBOL(__set_freezable);
+EXPORT_SYMBOL(set_freezable);
diff --git a/kernel/kthread.c b/kernel/kthread.c
index a6cbeea..7a4c862 100644
--- a/kernel/kthread.c
+++ b/kernel/kthread.c
@@ -282,7 +282,7 @@ int kthreadd(void *unused)
 	set_cpus_allowed_ptr(tsk, cpu_all_mask);
 	set_mems_allowed(node_states[N_HIGH_MEMORY]);
 
-	current->flags |= PF_NOFREEZE | PF_FREEZER_NOSIG;
+	current->flags |= PF_NOFREEZE;
 
 	for (;;) {
 		set_current_state(TASK_INTERRUPTIBLE);
-- 
1.7.3.1


^ permalink raw reply related

* [PATCH pm 1/2] usb_storage: don't use set_freezable_with_signal()
From: Tejun Heo @ 2011-11-01  0:37 UTC (permalink / raw)
  To: Rafael J. Wysocki, linux-pm, linux-kernel, linux-usb,
	Seth Forshee, Oleg Nesterov, Alan Stern, Greg Kroah-Hartman

The current implementation of set_freezable_with_signal() is buggy and
tricky to get right.  usb-storage is the only user and its use can be
avoided trivially.

All usb-storage wants is to be able to sleep with timeout and get
woken up if freezing() becomes true.  This can be trivially
implemented by doing interruptible wait w/ freezing() included in the
wait condition.  There's no reason to use set_freezable_with_signal().

Perform interruptible wait on freezing() instead of using
set_freezable_with_signal(), which is scheduled for removal.

Signed-off-by: Tejun Heo <tj@kernel.org>
Cc: Oleg Nesterov <oleg@redhat.com>
Cc: "Rafael J. Wysocki" <rjw@sisk.pl>
Cc: Seth Forshee <seth.forshee@canonical.com>
Cc: Alan Stern <stern@rowland.harvard.edu>
Cc: Greg Kroah-Hartman <gregkh@suse.de>
---

These two patches are on top of "freezer: fix various bugs and
simplify implementation, take#2" patchset[1] and are also available in
the following git branch.

 git://git.kernel.org/pub/scm/linux/kernel/git/tj/misc.git pm-kill-freezable_with_signal

If usb-storage ppl are okay with it, I think routing this through pm
would be the easiest.  Oh, and this definitely is for the next merge
window.

Thank you.

[1] http://thread.gmane.org/gmane.linux.kernel/1209247

 drivers/usb/storage/usb.c |   13 +++++++------
 1 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/drivers/usb/storage/usb.c b/drivers/usb/storage/usb.c
index c325e69..aa84b3d 100644
--- a/drivers/usb/storage/usb.c
+++ b/drivers/usb/storage/usb.c
@@ -831,7 +831,8 @@ static int usb_stor_scan_thread(void * __us)
 
 	dev_dbg(dev, "device found\n");
 
-	set_freezable_with_signal();
+	set_freezable();
+
 	/*
 	 * Wait for the timeout to expire or for a disconnect
 	 *
@@ -839,16 +840,16 @@ static int usb_stor_scan_thread(void * __us)
 	 * fail to freeze, but we can't be non-freezable either. Nor can
 	 * khubd freeze while waiting for scanning to complete as it may
 	 * hold the device lock, causing a hang when suspending devices.
-	 * So we request a fake signal when freezing and use
-	 * interruptible sleep to kick us out of our wait early when
-	 * freezing happens.
+	 * So instead of using wait_event_freezable(), explicitly test
+	 * for (DONT_SCAN || freezing) in interruptible wait and proceed
+	 * if any of DONT_SCAN, freezing or timeout has happened.
 	 */
 	if (delay_use > 0) {
 		dev_dbg(dev, "waiting for device to settle "
 				"before scanning\n");
 		wait_event_interruptible_timeout(us->delay_wait,
-				test_bit(US_FLIDX_DONT_SCAN, &us->dflags),
-				delay_use * HZ);
+				test_bit(US_FLIDX_DONT_SCAN, &us->dflags) ||
+				freezing(current), delay_use * HZ);
 	}
 
 	/* If the device is still connected, perform the scanning */
-- 
1.7.3.1


^ permalink raw reply related

* [Qemu-devel] [PATCH] block.c typo in comment fixed
From: matthias.bgg @ 2011-11-01  1:36 UTC (permalink / raw)
  To: qemu-devel; +Cc: Matthias Brugger

From: Matthias Brugger <matthias.bgg@gmail.com>


Signed-off-by: Matthias Brugger <matthias.bgg@gmail.com>
---
 block.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/block.c b/block.c
index 9bb236c..480aae2 100644
--- a/block.c
+++ b/block.c
@@ -497,7 +497,7 @@ static int bdrv_open_common(BlockDriverState *bs, const char *filename,
     open_flags = flags & ~(BDRV_O_SNAPSHOT | BDRV_O_NO_BACKING);
 
     /*
-     * Snapshots should be writable.
+     * Snapshots should be writeable.
      */
     if (bs->is_temporary) {
         open_flags |= BDRV_O_RDWR;
-- 
1.7.1

^ permalink raw reply related

* Re: [PATCHv2] Compile fix for MSVC
From: Erik Faye-Lund @ 2011-11-01  0:36 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Vincent van Ravesteijn, git, ramsay, msysgit
In-Reply-To: <7vd3dcq4s5.fsf@alter.siamese.dyndns.org>

On Mon, Oct 31, 2011 at 9:34 PM, Junio C Hamano <gitster@pobox.com> wrote:
> Thanks. The patch looks good from a POSIX person's point of view, and I do
> not immediately see how this would break other variants of Windows build
> at least from the code inspection.
>
> So I'll queue this, but I'll leave it to you and msysgit folks to decide
> if this topic should be merged to 1.7.8-rc1, as I do not have equipment,
> expertise, nor time to judge it myself (other than the code inspection we
> have already done here).
>
> Please give me an Ack or two by the end of this week. Thanks.

The result of applying this on top of the current master (1.7.8-rc0)
compiles and seem to runs fine for me, both with the MinGW supplied by
msysGit, and MSVC (as outlined by compat/vcbuild/README). Without the
patches, it fails to build with MSVC. In addition, the changes looks
good to me. So:

Acked-by: Erik Faye-Lund <kusmabite@gmail.com>

^ permalink raw reply

* Re: [Qemu-devel] [PATCH 3/3] monitor: add ability to dump SLB entries
From: Alexander Graf @ 2011-11-01  0:35 UTC (permalink / raw)
  To: Nishanth Aravamudan; +Cc: qemu-ppc, qemu-devel
In-Reply-To: <20111031225340.GC4078@us.ibm.com>


On 31.10.2011, at 15:53, Nishanth Aravamudan wrote:

> On 31.10.2011 [15:14:12 +1100], David Gibson wrote:
>> Good points below.  I forgot to CC Nish, the original patch author on
>> my post, so I've added him to the list now.
>> 
>> Nish, can you correct these problems and resend the patch please?
> 
> Yep, I'll work on this shortly.
> 
>> On Mon, Oct 31, 2011 at 04:35:54AM +0100, Alexander Graf wrote:
>>> 
>>> On 31.10.2011, at 04:16, David Gibson wrote:
>>> 
>>>> From: Nishanth Aravamudan <nacc@us.ibm.com>
>>>> 
>>>> When run with a PPC Book3S (server) CPU Currently 'info tlb' in the
>>>> qemu monitor reports "dump_mmu: unimplemented".  However, during
>>>> bringup work, it can be quite handy to have the SLB entries, which are
>>>> available in the CPUPPCState.  This patch adds an implementation of
>>>> info tlb for book3s, which dumps the SLB.
>>>> 
>>>> Signed-off-by: Nishanth Aravamudan <nacc@us.ibm.com>
>>>> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
>>>> ---
>>>> target-ppc/helper.c |   32 +++++++++++++++++++++++++++-----
>>>> 1 files changed, 27 insertions(+), 5 deletions(-)
>>>> 
>>>> diff --git a/target-ppc/helper.c b/target-ppc/helper.c
>>>> index 137a494..29c7050 100644
>>>> --- a/target-ppc/helper.c
>>>> +++ b/target-ppc/helper.c
>>>> @@ -1545,14 +1545,36 @@ static void mmubooke206_dump_mmu(FILE *f, fprintf_function cpu_fprintf,
>>>>    }
>>>> }
>>>> 
>>>> +static void mmubooks_dump_mmu(FILE *f, fprintf_function cpu_fprintf,
>>>> +                              CPUState *env)
>>>> +{
>>>> +    int i;
>>>> +    uint64_t slbe, slbv;
>>>> +
>>>> +    cpu_synchronize_state(env);
>>>> +
>>>> +    cpu_fprintf(f, "SLB\tESID\t\t\tVSID\n");
>>>> +    for (i = 0; i < env->slb_nr; i++) {
>>>> +        slbe = env->slb[i].esid;
>>>> +        slbv = env->slb[i].vsid;
>>> 
>>> From cpu.h:
>>> 
>>> #if defined(TARGET_PPC64)
>>>    /* Address space register */
>>>    target_ulong asr;
>>>    /* PowerPC 64 SLB area */
>>>    ppc_slb_t slb[64];
>>>    int slb_nr;
>>> #endif
> 
> Being unfamiliar with qemu's coding style (and not immediately seeing it
> in CODING_STYLE), would the right approach be to wrap this definition in
> an #if defined(TARGET_PPC64)?

It's the only way to make it compile :)

> 
>>>> +        if (slbe == 0 && slbv == 0) {
>>>> +            continue;
>>>> +        }
>>>> +        cpu_fprintf(f, "%d\t0x%016" PRIx64 "\t0x%016" PRIx64 "\n",
>>>> +                    i, slbe, slbv);
>>>> +    }
>>>> +}
>>>> +
>>>> void dump_mmu(FILE *f, fprintf_function cpu_fprintf, CPUState *env)
>>>> {
>>>> -    switch (env->mmu_model) {
>>>> -    case POWERPC_MMU_BOOKE206:
>>>> +    if (env->mmu_model == POWERPC_MMU_BOOKE206) {
>>>>        mmubooke206_dump_mmu(f, cpu_fprintf, env);
>>>> -        break;
>>>> -    default:
>>>> -        cpu_fprintf(f, "%s: unimplemented\n", __func__);
>>>> +    } else {
>>>> +        if ((env->mmu_model & POWERPC_MMU_64B) != 0) {
>>> 
>>> I would actually prefer to explicitly keep the switch and match on
>>> all implementations explicitly. Also, have you verified this works
>>> without CONFIG_PPC64 set? In cpu.h I see the following:
>>> 
>>> #if defined(TARGET_PPC64)
>>> #define POWERPC_MMU_64       0x00010000
>>> #define POWERPC_MMU_1TSEG    0x00020000
>>>    /* 64 bits PowerPC MMU                                     */
>>>    POWERPC_MMU_64B        = POWERPC_MMU_64 | 0x00000001,
>>>    /* 620 variant (no segment exceptions)                     */
>>>    POWERPC_MMU_620        = POWERPC_MMU_64 | 0x00000002,
>>>    /* Architecture 2.06 variant                               */
>>>    POWERPC_MMU_2_06       = POWERPC_MMU_64 | POWERPC_MMU_1TSEG | 0x00000003,
>>> #endif /* defined(TARGET_PPC64) */
>>> 
>>> So POWERPC_MMU_64B shouldn't be defined for qemu-system-ppc.
> 
> And similarly here, only have the MMU_2_06 and MMU_64B cases in the
> switch be defined #if defined(TARGET_PPC64)?

Yup :).

> Basically, asking if #ifdefs in the middle of functions are ok :)

It's the only valid way of making it work, yes. The alternative would be to drop all the TARGET_PPC64 ifdefery, but let's keep that for later.


Alex

^ permalink raw reply


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