Re: [PATCH 0/6] staging: vt6655: Cleanup in usage of macros

2012-07-09 Thread Marcos Souza
2012/7/9 Joe Perches j...@perches.com

 On Sun, 2012-07-08 at 23:51 -0300, Marcos Paulo de Souza wrote:
  Hi kernel guys!
 
  This patchset aims to clean all unused and commented macros.
 
  For this challenge, forgotten-macros tool helped us.

 Perhaps there may be false positives in your code.

Not in this case. After each changes in a file, I compiled all driver again.

 Many times, macros like the below are used:

 #define SUBSYSTEM_PREFIX_FOO1
 #define SUBSYSTEM_PREFIX_BAR2
 #define SUBSYSTEM_PREFIX_BAZ3

 #define USE_TYPE(type)  SUBSYSTEM_PREFIX_##type

 It doesn't seem your code knows that style.

True! The tool is under development. A more robust method will be
 implemented, but for now, the tool can find the most easy dead macros.

 Also, the tool might be more flexible if it was
 written using perl or python.

Yeah, I believe it's true!

Thanks for the comments!

But, for the changes, do I have your ack?

Thanks Joe!

--
Att,

Marcos Paulo de Souza
Acadêmico de Ciencia da Computação - FURB - SC
Uma vida sem desafios é uma vida sem razão
A life without challenges, is a non reason life
___
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/devel


Re: [PATCH 0/4] zsmalloc improvements

2012-07-09 Thread Seth Jennings
On 07/06/2012 10:07 AM, Seth Jennings wrote:
 On 07/04/2012 03:43 PM, Konrad Rzeszutek Wilk wrote:
 On Mon, Jul 02, 2012 at 04:15:48PM -0500, Seth Jennings wrote:
 This exposed an interesting and unexpected result: in all
 cases that I tried, copying the objects that span pages instead
 of using the page table to map them, was _always_ faster.  I could
 not find a case in which the page table mapping method was faster.

 Which architecture was this under? It sounds x86-ish? Is this on
 Westmere and more modern machines? What about Core2 architecture?

 Oh how did it work on AMD Phenom boxes?
 
 I don't have a Phenom box but I have an Athlon X2 I can try out.
 I'll get this information next Monday.

Actually, I'm running some production stuff on that box, so
I rather not put testing stuff on it.  Is there any
particular reason that you wanted this information? Do you
have a reason to believe that mapping will be faster than
copy for AMD procs?

(To everyone) I'd like to get this acked before the 3.6
merge window if there are no concerns/objections.

Thanks,
Seth

___
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/devel


[PATCH NEXT]staging speakup Fix typos.

2012-07-09 Thread Justin P. Mattock
From: Justin P. Mattock justinmatt...@gmail.com

Signed-off-by: Justin P. Mattock justinmatt...@gmail.com

---

The below patch fixes typos found while reading through staging speakup.

 drivers/staging/speakup/i18n.c  |2 +-
 drivers/staging/speakup/speakup_acnt.h  |2 +-
 drivers/staging/speakup/speakup_decpc.c |2 +-
 drivers/staging/speakup/synth.c |2 +-
 4 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/speakup/i18n.c b/drivers/staging/speakup/i18n.c
index c211943..ca01734 100644
--- a/drivers/staging/speakup/i18n.c
+++ b/drivers/staging/speakup/i18n.c
@@ -71,7 +71,7 @@ static char *speakup_default_msgs[MSG_LAST_INDEX] = {
[MSG_CTL_SHIFT] = shift,
[MSG_CTL_ALTGR] = altgr,
[MSG_CTL_CONTROL] = control,
-   [MSG_CTL_ALT] = ault,
+   [MSG_CTL_ALT] = alt,
[MSG_CTL_LSHIFT] = l shift,
[MSG_CTL_SPEAKUP] = speakup,
[MSG_CTL_LCONTROL] = l control,
diff --git a/drivers/staging/speakup/speakup_acnt.h 
b/drivers/staging/speakup/speakup_acnt.h
index 2d88365..6376fca 100644
--- a/drivers/staging/speakup/speakup_acnt.h
+++ b/drivers/staging/speakup/speakup_acnt.h
@@ -12,5 +12,5 @@
   to accept a byte of data. */
 #define SYNTH_QUIET'S' /* synth is not speaking */
 #define SYNTH_FULL 'F' /* synth is full. */
-#define SYNTH_ALMOST_EMPTY 'M' /* synth has les than 2 seconds of text left */
+#define SYNTH_ALMOST_EMPTY 'M' /* synth has less than 2 seconds of text left */
 #define SYNTH_SPEAKING 's' /* synth is speaking and has a fare way to go */
diff --git a/drivers/staging/speakup/speakup_decpc.c 
b/drivers/staging/speakup/speakup_decpc.c
index de25527..a09a0c9 100644
--- a/drivers/staging/speakup/speakup_decpc.c
+++ b/drivers/staging/speakup/speakup_decpc.c
@@ -66,7 +66,7 @@
 #defineCMD_null0x  /* post status */
 #defineCMD_control 0x1000  /* hard control command */
 #defineCTRL_mask   0x0F00  /*   mask off control nibble */
-#defineCTRL_data   0x00FF  /*   madk to get data byte */
+#defineCTRL_data   0x00FF  /*   mask to get data byte */
 #defineCTRL_null   0x  /*   null control */
 #defineCTRL_vol_up 0x0100  /*   increase volume */
 #defineCTRL_vol_down   0x0200  /*   decrease volume */
diff --git a/drivers/staging/speakup/synth.c b/drivers/staging/speakup/synth.c
index 331eae7..df95337 100644
--- a/drivers/staging/speakup/synth.c
+++ b/drivers/staging/speakup/synth.c
@@ -64,7 +64,7 @@ EXPORT_SYMBOL_GPL(serial_synth_probe);
 /* Main loop of the progression thread: keep eating from the buffer
  * and push to the serial port, waiting as needed
  *
- * For devices that have a full notification mecanism, the driver can
+ * For devices that have a full notification mechanism, the driver can
  * adapt the loop the way they prefer.
  */
 void spk_do_catch_up(struct spk_synth *synth)
-- 
1.7.5.4

___
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/devel


[PATCH 1/3] staging/slicoss: remove not-needed ASSERT

2012-07-09 Thread Devendra Naga
As the private pointer is valid at the remove of driver, and remove wont' be 
called if probe fails, so no point for checking of ASSERT

Signed-off-by: Devendra Naga devendra.a...@gmail.com
---
 drivers/staging/slicoss/slicoss.c |1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/staging/slicoss/slicoss.c 
b/drivers/staging/slicoss/slicoss.c
index d2b82a7..a511a2b 100644
--- a/drivers/staging/slicoss/slicoss.c
+++ b/drivers/staging/slicoss/slicoss.c
@@ -3196,7 +3196,6 @@ static void __devexit slic_entry_remove(struct pci_dev 
*pcidev)
struct sliccard *card;
struct mcast_address *mcaddr, *mlist;
 
-   ASSERT(adapter);
slic_adapter_freeresources(adapter);
slic_unmap_mmio_space(adapter);
unregister_netdev(dev);
-- 
1.7.9.5

___
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/devel


[PATCH 2/3] staging/slicoss: disable pci device at remove

2012-07-09 Thread Devendra Naga
at probe we enabled the device, and we should disable it at remove.

Signed-off-by: Devendra Naga devendra.a...@gmail.com
---
 drivers/staging/slicoss/slicoss.c |1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/staging/slicoss/slicoss.c 
b/drivers/staging/slicoss/slicoss.c
index a511a2b..5bd3825 100644
--- a/drivers/staging/slicoss/slicoss.c
+++ b/drivers/staging/slicoss/slicoss.c
@@ -3234,6 +3234,7 @@ static void __devexit slic_entry_remove(struct pci_dev 
*pcidev)
}
free_netdev(dev);
pci_release_regions(pcidev);
+   pci_disable_device(pcidev);
 }
 
 static int slic_entry_halt(struct net_device *dev)
-- 
1.7.9.5

___
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/devel


[PATCH 3/3] staging/slicoss: return -ENODEV if no devid matches

2012-07-09 Thread Devendra Naga
if no case matches we are simply asserting and doing break.
and i think we may need to return that -ENODEV , no device is
present, rather assert'ing.

Signed-off-by: Devendra Naga devendra.a...@gmail.com
---
 drivers/staging/slicoss/slicoss.c |3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/staging/slicoss/slicoss.c 
b/drivers/staging/slicoss/slicoss.c
index 5bd3825..56829fc 100644
--- a/drivers/staging/slicoss/slicoss.c
+++ b/drivers/staging/slicoss/slicoss.c
@@ -3746,8 +3746,7 @@ static u32 slic_card_locate(struct adapter *adapter)
rdhostid_offset = SLIC_RDHOSTID_1GB;
break;
default:
-   ASSERT(0);
-   break;
+   return -ENODEV;
}
 
hostid_reg =
-- 
1.7.9.5

___
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/devel


Re: [PATCHv2 1/4] staging: OMAP4+: thermal: introduce bandgap temperature sensor

2012-07-09 Thread Greg Kroah-Hartman
On Sat, Jul 07, 2012 at 10:57:49AM +0300, Eduardo Valentin wrote:
 In the System Control Module, OMAP supplies a voltage reference
 and a temperature sensor feature that are gathered in the band
 gap voltage and temperature sensor (VBGAPTS) module. The band
 gap provides current and voltage reference for its internal
 circuits and other analog IP blocks. The analog-to-digital
 converter (ADC) produces an output value that is proportional
 to the silicon temperature.
 
 This patch provides a platform driver which expose this feature.
 It is moduled as a MFD child of the System Control Module core
 MFD driver.
 
 This driver provides only APIs to access the device properties,
 like temperature, thresholds and update rate.
 
 Signed-off-by: Eduardo Valentin eduardo.valen...@ti.com
 Signed-off-by: Keerthy j-keer...@ti.com

As much as I enjoy interesting names, odds are, Keerthy is not the
real name of this person, right?  In fact, based on the copyright
comments in the code, I can almost guarantee it...

I need a full-name please, no aliases or fake names allowed in kernel
signed-off-by lines.

Please resend these with that fixed up.

greg k-h
___
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/devel


Re: [PATCH 1/4] staging:rts_pstor: Fix coding style issue in ms.c

2012-07-09 Thread Greg KH
On Sun, Jul 08, 2012 at 10:15:48AM +0900, Hitoshi Nakamori wrote:
 This is a patch to the ms.c that fixes up some brace warning found by 
 checkpatch.pl tool.

Please wrap your comments at 72 columns.

As much as I endorce splitting patches up into tiny pieces, this is a
bit overkill, as you now have 4 patches with the same identical subject:

That implies that all of these could just be one patch, right?  Please
do that.

thanks,

greg k-h
___
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/devel


Re: [PATCH 2/3] staging/slicoss: disable pci device at remove

2012-07-09 Thread Greg Kroah-Hartman
On Mon, Jul 09, 2012 at 11:04:19PM +0530, Devendra Naga wrote:
 at probe we enabled the device, and we should disable it at remove.
 
 Signed-off-by: Devendra Naga devendra.a...@gmail.com
 ---
  drivers/staging/slicoss/slicoss.c |1 +
  1 file changed, 1 insertion(+)
 
 diff --git a/drivers/staging/slicoss/slicoss.c 
 b/drivers/staging/slicoss/slicoss.c
 index a511a2b..5bd3825 100644
 --- a/drivers/staging/slicoss/slicoss.c
 +++ b/drivers/staging/slicoss/slicoss.c
 @@ -3234,6 +3234,7 @@ static void __devexit slic_entry_remove(struct pci_dev 
 *pcidev)
   }
   free_netdev(dev);
   pci_release_regions(pcidev);
 + pci_disable_device(pcidev);

No, you really shouldn't do this, see the many times this has come up on
the linux-kernel mailing list for why.

thanks,

greg k-h
___
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/devel


Re: [PATCH 4/7] tracing/function: Introduce persistent trace option

2012-07-09 Thread Anton Vorontsov
On Wed, Jun 27, 2012 at 08:40:12AM -0400, Steven Rostedt wrote:
 On Tue, 2012-06-26 at 16:23 -0700, Anton Vorontsov wrote:
  @@ -219,6 +232,8 @@ static int func_set_flag(u32 old_flags, u32 bit, int 
  set)
   
  return 0;
  }
  +   if (bit == TRACE_FUNC_OPT_PSTORE)
  +   return 0;
 
 Perhaps this should be a switch() statement, or at least put a
  } else if () {
 
 As it can't be bit == TRACE_FUNC_OPT_STACK and bit ==
 TRACE_FUNC_OPT_PSTORE.

Yup, thanks for the idea. I'll start using 'else if' at first, and then
will convert it to a switch statement via a separate patch, that way I'll
not clobber the functional patch with cosmetic changes.

Thanks,

-- 
Anton Vorontsov
Email: cbouatmai...@gmail.com
___
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/devel


[PATCH resend 0/3] pstore/ram: Configurable ECC size

2012-07-09 Thread Anton Vorontsov
Hi all,

Just a few patches left from the series that used to add configurable
ECC size for pstore/ram backend. Most patches were merged into -next,
and this is just a resend of the leftovers.

(Note that pstore/trace patches go on top of this series.)

Thanks,

---
 fs/pstore/ram.c|   14 +++---
 fs/pstore/ram_core.c   |   30 ++
 include/linux/pstore_ram.h |7 ++-
 3 files changed, 23 insertions(+), 28 deletions(-)

-- 
Anton Vorontsov
Email: cbouatmai...@gmail.com
___
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/devel


Re: [PATCH resend 0/3] pstore/ram: Configurable ECC size

2012-07-09 Thread Anton Vorontsov
On Mon, Jul 09, 2012 at 04:45:59PM -0700, Anton Vorontsov wrote:
 Hi all,
 
 Just a few patches left from the series that used to add configurable
 ECC size for pstore/ram backend. Most patches were merged into -next,
 and this is just a resend of the leftovers.

Oh, I fogot: actually, it's not a plain resend, I fixed Dan Carpenter's
comment (thanks!): added more text about special ecc=1 case, both
as a module param description and as a comment in the code.

-- 
Anton Vorontsov
Email: cbouatmai...@gmail.com
___
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/devel


[PATCH 1/3] pstore/ram_core: Get rid of prz-ecc_symsize and prz-ecc_poly

2012-07-09 Thread Anton Vorontsov
The struct members were never used anywhere outside of
persistent_ram_init_ecc(), so there's actually no need for them
to be in the struct.

If we ever want to make polynomial or symbol size configurable,
it would make more sense to just pass initialized rs_decoder
to the persistent_ram init functions.

Signed-off-by: Anton Vorontsov anton.voront...@linaro.org
---
 fs/pstore/ram_core.c   |7 +++
 include/linux/pstore_ram.h |2 --
 2 files changed, 3 insertions(+), 6 deletions(-)

diff --git a/fs/pstore/ram_core.c b/fs/pstore/ram_core.c
index a5a7b13..3f4d6e6 100644
--- a/fs/pstore/ram_core.c
+++ b/fs/pstore/ram_core.c
@@ -177,14 +177,14 @@ static int persistent_ram_init_ecc(struct 
persistent_ram_zone *prz)
struct persistent_ram_buffer *buffer = prz-buffer;
int ecc_blocks;
size_t ecc_total;
+   int ecc_symsize = 8;
+   int ecc_poly = 0x11d;
 
if (!prz-ecc)
return 0;
 
prz-ecc_block_size = 128;
prz-ecc_size = 16;
-   prz-ecc_symsize = 8;
-   prz-ecc_poly = 0x11d;
 
ecc_blocks = DIV_ROUND_UP(prz-buffer_size, prz-ecc_block_size);
ecc_total = (ecc_blocks + 1) * prz-ecc_size;
@@ -202,8 +202,7 @@ static int persistent_ram_init_ecc(struct 
persistent_ram_zone *prz)
 * first consecutive root is 0
 * primitive element to generate roots = 1
 */
-   prz-rs_decoder = init_rs(prz-ecc_symsize, prz-ecc_poly, 0, 1,
- prz-ecc_size);
+   prz-rs_decoder = init_rs(ecc_symsize, ecc_poly, 0, 1, prz-ecc_size);
if (prz-rs_decoder == NULL) {
pr_info(persistent_ram: init_rs failed\n);
return -EINVAL;
diff --git a/include/linux/pstore_ram.h b/include/linux/pstore_ram.h
index e681af9..a0975c0 100644
--- a/include/linux/pstore_ram.h
+++ b/include/linux/pstore_ram.h
@@ -41,8 +41,6 @@ struct persistent_ram_zone {
int bad_blocks;
int ecc_block_size;
int ecc_size;
-   int ecc_symsize;
-   int ecc_poly;
 
char *old_log;
size_t old_log_size;
-- 
1.7.10.4

___
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/devel


[PATCH 1/8] tracing: Fix initialization failure path in tracing_set_tracer()

2012-07-09 Thread Anton Vorontsov
If tracer-init() fails, current code will leave current_tracer pointing
to an unusable tracer, which at best makes 'current_tracer' report
inaccurate value.

Fix the issue by pointing current_tracer to nop tracer, and only update
current_tracer with the new one after all the initialization succeeds.

Signed-off-by: Anton Vorontsov anton.voront...@linaro.org
Acked-by: Steven Rostedt rost...@goodmis.org
---
 kernel/trace/trace.c |7 ---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
index 814ff30..954f7d7 100644
--- a/kernel/trace/trace.c
+++ b/kernel/trace/trace.c
@@ -3183,10 +3183,10 @@ static int tracing_set_tracer(const char *buf)
}
destroy_trace_option_files(topts);
 
-   current_trace = t;
+   current_trace = nop_trace;
 
-   topts = create_trace_option_files(current_trace);
-   if (current_trace-use_max_tr) {
+   topts = create_trace_option_files(t);
+   if (t-use_max_tr) {
int cpu;
/* we need to make per cpu buffer sizes equivalent */
for_each_tracing_cpu(cpu) {
@@ -3206,6 +3206,7 @@ static int tracing_set_tracer(const char *buf)
goto out;
}
 
+   current_trace = t;
trace_branch_enable(tr);
  out:
mutex_unlock(trace_types_lock);
-- 
1.7.10.4

___
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/devel


[PATCH 2/8] pstore: Introduce write_buf backend callback

2012-07-09 Thread Anton Vorontsov
For function tracing we need to stop using pstore.buf directly, since
in a tracing callback we can't use spinlocks, and thus we can't safely
use the global buffer.

With write_buf callback, backends no longer need to access pstore.buf
directly, and thus we can pass any buffers (e.g. allocated on stack).

Signed-off-by: Anton Vorontsov anton.voront...@linaro.org
---
 fs/pstore/platform.c   |   10 ++
 include/linux/pstore.h |4 
 2 files changed, 14 insertions(+)

diff --git a/fs/pstore/platform.c b/fs/pstore/platform.c
index 6b3ff04..ef5ca8a 100644
--- a/fs/pstore/platform.c
+++ b/fs/pstore/platform.c
@@ -188,6 +188,14 @@ static void pstore_register_console(void)
 static void pstore_register_console(void) {}
 #endif
 
+static int pstore_write_compat(enum pstore_type_id type,
+  enum kmsg_dump_reason reason,
+  u64 *id, unsigned int part,
+  size_t size, struct pstore_info *psi)
+{
+   return psi-write_buf(type, reason, id, part, psinfo-buf, size, psi);
+}
+
 /*
  * platform specific persistent storage driver registers with
  * us here. If pstore is already mounted, call the platform
@@ -212,6 +220,8 @@ int pstore_register(struct pstore_info *psi)
return -EINVAL;
}
 
+   if (!psi-write)
+   psi-write = pstore_write_compat;
psinfo = psi;
mutex_init(psinfo-read_mutex);
spin_unlock(pstore_lock);
diff --git a/include/linux/pstore.h b/include/linux/pstore.h
index 1bd014b..b107484 100644
--- a/include/linux/pstore.h
+++ b/include/linux/pstore.h
@@ -48,6 +48,10 @@ struct pstore_info {
int (*write)(enum pstore_type_id type,
enum kmsg_dump_reason reason, u64 *id,
unsigned int part, size_t size, struct pstore_info 
*psi);
+   int (*write_buf)(enum pstore_type_id type,
+   enum kmsg_dump_reason reason, u64 *id,
+   unsigned int part, const char *buf, size_t size,
+   struct pstore_info *psi);
int (*erase)(enum pstore_type_id type, u64 id,
struct pstore_info *psi);
void*data;
-- 
1.7.10.4

___
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/devel


[PATCH 3/8] pstore: Add persistent function tracing

2012-07-09 Thread Anton Vorontsov
With this support kernel can save function call chain log into a
persistent ram buffer that can be decoded and dumped after reboot
through pstore filesystem. It can be used to determine what function
was last called before a reset or panic.

We store the log in a binary format and then decode it at read time.

p.s.
Mostly the code comes from trace_persistent.c driver found in the
Android git tree, written by Colin Cross ccr...@android.com
(according to sign-off history). I reworked the driver a little bit,
and ported it to pstore.

Signed-off-by: Anton Vorontsov anton.voront...@linaro.org
---
 fs/pstore/Kconfig  |   12 ++
 fs/pstore/Makefile |1 +
 fs/pstore/ftrace.c |   35 +++
 fs/pstore/inode.c  |  111 ++--
 fs/pstore/internal.h   |   43 +++
 fs/pstore/platform.c   |2 +-
 include/linux/pstore.h |9 
 7 files changed, 208 insertions(+), 5 deletions(-)
 create mode 100644 fs/pstore/ftrace.c

diff --git a/fs/pstore/Kconfig b/fs/pstore/Kconfig
index d044de6..d39bb5c 100644
--- a/fs/pstore/Kconfig
+++ b/fs/pstore/Kconfig
@@ -19,6 +19,18 @@ config PSTORE_CONSOLE
  When the option is enabled, pstore will log all kernel
  messages, even if no oops or panic happened.
 
+config PSTORE_FTRACE
+   bool Persistent function tracer
+   depends on PSTORE
+   depends on FUNCTION_TRACER
+   help
+ With this option kernel traces function calls into a persistent
+ ram buffer that can be decoded and dumped after reboot through
+ pstore filesystem. It can be used to determine what function
+ was last called before a reset or panic.
+
+ If unsure, say N.
+
 config PSTORE_RAM
tristate Log panic/oops to a RAM buffer
depends on PSTORE
diff --git a/fs/pstore/Makefile b/fs/pstore/Makefile
index 278a44e..4c9095c 100644
--- a/fs/pstore/Makefile
+++ b/fs/pstore/Makefile
@@ -5,6 +5,7 @@
 obj-y += pstore.o
 
 pstore-objs += inode.o platform.o
+obj-$(CONFIG_PSTORE_FTRACE)+= ftrace.o
 
 ramoops-objs += ram.o ram_core.o
 obj-$(CONFIG_PSTORE_RAM)   += ramoops.o
diff --git a/fs/pstore/ftrace.c b/fs/pstore/ftrace.c
new file mode 100644
index 000..a130d48
--- /dev/null
+++ b/fs/pstore/ftrace.c
@@ -0,0 +1,35 @@
+/*
+ * Copyright 2012  Google, Inc.
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * 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 linux/kernel.h
+#include linux/compiler.h
+#include linux/irqflags.h
+#include linux/percpu.h
+#include linux/smp.h
+#include linux/atomic.h
+#include asm/barrier.h
+#include internal.h
+
+void notrace pstore_ftrace_call(unsigned long ip, unsigned long parent_ip)
+{
+   struct pstore_ftrace_record rec = {};
+
+   if (unlikely(oops_in_progress))
+   return;
+
+   rec.ip = ip;
+   rec.parent_ip = parent_ip;
+   pstore_ftrace_encode_cpu(rec, raw_smp_processor_id());
+   psinfo-write_buf(PSTORE_TYPE_FTRACE, 0, NULL, 0, (void *)rec,
+ sizeof(rec), psinfo);
+}
diff --git a/fs/pstore/inode.c b/fs/pstore/inode.c
index 45bff54..4ab572e 100644
--- a/fs/pstore/inode.c
+++ b/fs/pstore/inode.c
@@ -27,6 +27,7 @@
 #include linux/list.h
 #include linux/string.h
 #include linux/mount.h
+#include linux/seq_file.h
 #include linux/ramfs.h
 #include linux/parser.h
 #include linux/sched.h
@@ -52,18 +53,117 @@ struct pstore_private {
chardata[];
 };
 
+struct pstore_ftrace_seq_data {
+   const void *ptr;
+   size_t off;
+   size_t size;
+};
+
+#define REC_SIZE sizeof(struct pstore_ftrace_record)
+
+static void *pstore_ftrace_seq_start(struct seq_file *s, loff_t *pos)
+{
+   struct pstore_private *ps = s-private;
+   struct pstore_ftrace_seq_data *data;
+
+   data = kzalloc(sizeof(*data), GFP_KERNEL);
+   if (!data)
+   return NULL;
+
+   data-off = ps-size % REC_SIZE;
+   data-off += *pos * REC_SIZE;
+   if (data-off + REC_SIZE  ps-size) {
+   kfree(data);
+   return NULL;
+   }
+
+   return data;
+
+}
+
+static void pstore_ftrace_seq_stop(struct seq_file *s, void *v)
+{
+   kfree(v);
+}
+
+static void *pstore_ftrace_seq_next(struct seq_file *s, void *v, loff_t *pos)
+{
+   struct pstore_private *ps = s-private;
+   struct pstore_ftrace_seq_data *data = v;
+
+   data-off += REC_SIZE;
+   if (data-off + REC_SIZE  ps-size)
+   return NULL;
+
+   (*pos)++;
+   return data;
+}
+
+static int pstore_ftrace_seq_show(struct seq_file *s, void *v)
+{
+   

[PATCH 4/8] tracing/function: Introduce persistent trace option

2012-07-09 Thread Anton Vorontsov
This patch introduces 'func_ptrace' option, now available in
/sys/kernel/debug/tracing/options when function tracer
is selected.

The patch also adds some tiny code that calls back to pstore
to record the trace. The callback is no-op when PSTORE=n.

Signed-off-by: Anton Vorontsov anton.voront...@linaro.org
---
 kernel/trace/trace_functions.c |   25 -
 1 file changed, 20 insertions(+), 5 deletions(-)

diff --git a/kernel/trace/trace_functions.c b/kernel/trace/trace_functions.c
index c7b0c6a..13770ab 100644
--- a/kernel/trace/trace_functions.c
+++ b/kernel/trace/trace_functions.c
@@ -13,6 +13,7 @@
 #include linux/debugfs.h
 #include linux/uaccess.h
 #include linux/ftrace.h
+#include linux/pstore.h
 #include linux/fs.h
 
 #include trace.h
@@ -74,6 +75,14 @@ function_trace_call_preempt_only(unsigned long ip, unsigned 
long parent_ip)
preempt_enable_notrace();
 }
 
+/* Our two options */
+enum {
+   TRACE_FUNC_OPT_STACK= 0x1,
+   TRACE_FUNC_OPT_PSTORE   = 0x2,
+};
+
+static struct tracer_flags func_flags;
+
 static void
 function_trace_call(unsigned long ip, unsigned long parent_ip)
 {
@@ -97,6 +106,12 @@ function_trace_call(unsigned long ip, unsigned long 
parent_ip)
disabled = atomic_inc_return(data-disabled);
 
if (likely(disabled == 1)) {
+   /*
+* So far tracing doesn't support multiple buffers, so
+* we make an explicit call for now.
+*/
+   if (unlikely(func_flags.val  TRACE_FUNC_OPT_PSTORE))
+   pstore_ftrace_call(ip, parent_ip);
pc = preempt_count();
trace_function(tr, ip, parent_ip, flags, pc);
}
@@ -158,15 +173,13 @@ static struct ftrace_ops trace_stack_ops __read_mostly =
.flags = FTRACE_OPS_FL_GLOBAL,
 };
 
-/* Our two options */
-enum {
-   TRACE_FUNC_OPT_STACK = 0x1,
-};
-
 static struct tracer_opt func_opts[] = {
 #ifdef CONFIG_STACKTRACE
{ TRACER_OPT(func_stack_trace, TRACE_FUNC_OPT_STACK) },
 #endif
+#ifdef CONFIG_PSTORE_FTRACE
+   { TRACER_OPT(func_pstore, TRACE_FUNC_OPT_PSTORE) },
+#endif
{ } /* Always set a last empty entry */
 };
 
@@ -218,6 +231,8 @@ static int func_set_flag(u32 old_flags, u32 bit, int set)
}
 
return 0;
+   } else if (bit == TRACE_FUNC_OPT_PSTORE) {
+   return 0;
}
 
return -EINVAL;
-- 
1.7.10.4

___
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/devel


[PATCH 5/8] pstore/ram: Convert to write_buf callback

2012-07-09 Thread Anton Vorontsov
Don't use pstore.buf directly, instead convert the code to write_buf callback
which passes a pointer to a buffer as an argument.

Signed-off-by: Anton Vorontsov anton.voront...@linaro.org
---
 fs/pstore/ram.c |   17 +
 1 file changed, 9 insertions(+), 8 deletions(-)

diff --git a/fs/pstore/ram.c b/fs/pstore/ram.c
index b39aebb..74f4111 100644
--- a/fs/pstore/ram.c
+++ b/fs/pstore/ram.c
@@ -170,11 +170,12 @@ static size_t ramoops_write_kmsg_hdr(struct 
persistent_ram_zone *prz)
return len;
 }
 
-static int ramoops_pstore_write(enum pstore_type_id type,
-   enum kmsg_dump_reason reason,
-   u64 *id,
-   unsigned int part,
-   size_t size, struct pstore_info *psi)
+
+static int ramoops_pstore_write_buf(enum pstore_type_id type,
+   enum kmsg_dump_reason reason,
+   u64 *id, unsigned int part,
+   const char *buf, size_t size,
+   struct pstore_info *psi)
 {
struct ramoops_context *cxt = psi-data;
struct persistent_ram_zone *prz = cxt-przs[cxt-dump_write_cnt];
@@ -183,7 +184,7 @@ static int ramoops_pstore_write(enum pstore_type_id type,
if (type == PSTORE_TYPE_CONSOLE) {
if (!cxt-cprz)
return -ENOMEM;
-   persistent_ram_write(cxt-cprz, cxt-pstore.buf, size);
+   persistent_ram_write(cxt-cprz, buf, size);
return 0;
}
 
@@ -212,7 +213,7 @@ static int ramoops_pstore_write(enum pstore_type_id type,
hlen = ramoops_write_kmsg_hdr(prz);
if (size + hlen  prz-buffer_size)
size = prz-buffer_size - hlen;
-   persistent_ram_write(prz, cxt-pstore.buf, size);
+   persistent_ram_write(prz, buf, size);
 
cxt-dump_write_cnt = (cxt-dump_write_cnt + 1) % cxt-max_dump_cnt;
 
@@ -250,7 +251,7 @@ static struct ramoops_context oops_cxt = {
.name   = ramoops,
.open   = ramoops_pstore_open,
.read   = ramoops_pstore_read,
-   .write  = ramoops_pstore_write,
+   .write_buf  = ramoops_pstore_write_buf,
.erase  = ramoops_pstore_erase,
},
 };
-- 
1.7.10.4

___
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/devel


[PATCH 6/8] pstore/ram: Add ftrace messages handling

2012-07-09 Thread Anton Vorontsov
The ftrace log size is configurable via ramoops.ftrace_size
module option, and the log itself is available via
pstore-mount/ftrace-ramoops file.

Signed-off-by: Anton Vorontsov anton.voront...@linaro.org
---
 Documentation/ramoops.txt  |   25 +
 fs/pstore/ram.c|   37 +
 include/linux/pstore_ram.h |1 +
 3 files changed, 59 insertions(+), 4 deletions(-)

diff --git a/Documentation/ramoops.txt b/Documentation/ramoops.txt
index 59a74a8..197ad59 100644
--- a/Documentation/ramoops.txt
+++ b/Documentation/ramoops.txt
@@ -94,3 +94,28 @@ timestamp and a new line. The dump then continues with the 
actual data.
 The dump data can be read from the pstore filesystem. The format for these
 files is dmesg-ramoops-N, where N is the record number in memory. To delete
 a stored record from RAM, simply unlink the respective pstore file.
+
+5. Persistent function tracing
+
+Persistent function tracing might be useful for debugging software or hardware
+related hangs. The functions call chain log is stored in a ftrace-ramoops
+file. Here is an example of usage:
+
+ # mount -t debugfs debugfs /sys/kernel/debug/
+ # cd /sys/kernel/debug/tracing
+ # echo function  current_tracer
+ # echo 1  options/func_pstore
+ # reboot -f
+ [...]
+ # mount -t pstore pstore /mnt/
+ # tail /mnt/ftrace-ramoops
+ 0 8101ea64  8101bcda  native_apic_mem_read - 
disconnect_bsp_APIC+0x6a/0xc0
+ 0 8101ea44  8101bcf6  native_apic_mem_write - 
disconnect_bsp_APIC+0x86/0xc0
+ 0 81020084  8101a4b5  hpet_disable - 
native_machine_shutdown+0x75/0x90
+ 0 81005f94  8101a4bb  iommu_shutdown_noop - 
native_machine_shutdown+0x7b/0x90
+ 0 8101a6a1  8101a437  native_machine_emergency_restart - 
native_machine_restart+0x37/0x40
+ 0 811f9876  8101a73a  acpi_reboot - 
native_machine_emergency_restart+0xaa/0x1e0
+ 0 8101a514  8101a772  mach_reboot_fixups - 
native_machine_emergency_restart+0xe2/0x1e0
+ 0 811d9c54  8101a7a0  __const_udelay - 
native_machine_emergency_restart+0x110/0x1e0
+ 0 811d9c34  811d9c80  __delay - __const_udelay+0x30/0x40
+ 0 811d9d14  811d9c3f  delay_tsc - __delay+0xf/0x20
diff --git a/fs/pstore/ram.c b/fs/pstore/ram.c
index 74f4111..1dd108e 100644
--- a/fs/pstore/ram.c
+++ b/fs/pstore/ram.c
@@ -45,6 +45,10 @@ static ulong ramoops_console_size = MIN_MEM_SIZE;
 module_param_named(console_size, ramoops_console_size, ulong, 0400);
 MODULE_PARM_DESC(console_size, size of kernel console log);
 
+static ulong ramoops_ftrace_size = MIN_MEM_SIZE;
+module_param_named(ftrace_size, ramoops_ftrace_size, ulong, 0400);
+MODULE_PARM_DESC(ftrace_size, size of ftrace log);
+
 static ulong mem_address;
 module_param(mem_address, ulong, 0400);
 MODULE_PARM_DESC(mem_address,
@@ -70,16 +74,19 @@ MODULE_PARM_DESC(ramoops_ecc,
 struct ramoops_context {
struct persistent_ram_zone **przs;
struct persistent_ram_zone *cprz;
+   struct persistent_ram_zone *fprz;
phys_addr_t phys_addr;
unsigned long size;
size_t record_size;
size_t console_size;
+   size_t ftrace_size;
int dump_oops;
int ecc_size;
unsigned int max_dump_cnt;
unsigned int dump_write_cnt;
unsigned int dump_read_cnt;
unsigned int console_read_cnt;
+   unsigned int ftrace_read_cnt;
struct pstore_info pstore;
 };
 
@@ -138,6 +145,9 @@ static ssize_t ramoops_pstore_read(u64 *id, enum 
pstore_type_id *type,
prz = ramoops_get_next_prz(cxt-cprz, cxt-console_read_cnt,
   1, id, type, PSTORE_TYPE_CONSOLE, 0);
if (!prz)
+   prz = ramoops_get_next_prz(cxt-fprz, cxt-ftrace_read_cnt,
+  1, id, type, PSTORE_TYPE_FTRACE, 0);
+   if (!prz)
return 0;
 
/* TODO(kees): Bogus time for the moment. */
@@ -186,6 +196,11 @@ static int ramoops_pstore_write_buf(enum pstore_type_id 
type,
return -ENOMEM;
persistent_ram_write(cxt-cprz, buf, size);
return 0;
+   } else if (type == PSTORE_TYPE_FTRACE) {
+   if (!cxt-fprz)
+   return -ENOMEM;
+   persistent_ram_write(cxt-fprz, buf, size);
+   return 0;
}
 
if (type != PSTORE_TYPE_DMESG)
@@ -235,6 +250,9 @@ static int ramoops_pstore_erase(enum pstore_type_id type, 
u64 id,
case PSTORE_TYPE_CONSOLE:
prz = cxt-cprz;
break;
+   case PSTORE_TYPE_FTRACE:
+   prz = cxt-fprz;
+   break;
default:
return -EINVAL;
}
@@ -348,7 +366,8 @@ static int __devinit ramoops_probe(struct platform_device 
*pdev)
if (cxt-max_dump_cnt)
goto fail_out;
 
-   if (!pdata-mem_size 

[PATCH 8/8] tracing/function: Convert func_set_flag() to a switch statement

2012-07-09 Thread Anton Vorontsov
Since the function accepts just one bit, we can use the switch
construction instead of if/else if/...

Just a cosmetic change, there should be no functional changes.

Suggested-by: Steven Rostedt rost...@goodmis.org
Signed-off-by: Anton Vorontsov anton.voront...@linaro.org
---
 kernel/trace/trace_functions.c |   15 +--
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/kernel/trace/trace_functions.c b/kernel/trace/trace_functions.c
index 13770ab..a426f41 100644
--- a/kernel/trace/trace_functions.c
+++ b/kernel/trace/trace_functions.c
@@ -217,10 +217,11 @@ static void tracing_stop_function_trace(void)
 
 static int func_set_flag(u32 old_flags, u32 bit, int set)
 {
-   if (bit == TRACE_FUNC_OPT_STACK) {
+   switch (bit) {
+   case TRACE_FUNC_OPT_STACK:
/* do nothing if already set */
if (!!set == !!(func_flags.val  TRACE_FUNC_OPT_STACK))
-   return 0;
+   break;
 
if (set) {
unregister_ftrace_function(trace_ops);
@@ -230,12 +231,14 @@ static int func_set_flag(u32 old_flags, u32 bit, int set)
register_ftrace_function(trace_ops);
}
 
-   return 0;
-   } else if (bit == TRACE_FUNC_OPT_PSTORE) {
-   return 0;
+   break;
+   case TRACE_FUNC_OPT_PSTORE:
+   break;
+   default:
+   return -EINVAL;
}
 
-   return -EINVAL;
+   return 0;
 }
 
 static struct tracer function_trace __read_mostly =
-- 
1.7.10.4

___
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/devel


[PATCH 1/3] staging: bcm: Remove code that will never execute

2012-07-09 Thread Marcos Paulo de Souza
This patch removes all references of if 0 blocks in the bcm drivers.

Signed-off-by: Marcos Paulo de Souza marcos.souza@gmail.com
---
 drivers/staging/bcm/Misc.c |   63 
 1 file changed, 63 deletions(-)

diff --git a/drivers/staging/bcm/Misc.c b/drivers/staging/bcm/Misc.c
index c36fd76..d7c662d 100644
--- a/drivers/staging/bcm/Misc.c
+++ b/drivers/staging/bcm/Misc.c
@@ -402,30 +402,6 @@ INT CopyBufferToControlPacket(struct bcm_mini_adapter 
*Adapter, PVOID ioBuffer)
return Status;
 }
 
-#if 0
-/*
-* Function- SendStatisticsPointerRequest()
-*
-* Description - This function builds and forwards the Statistics
-* Pointer Request control Packet.
-*
-* Parameters  - Adapter: Pointer to 
Adapter structure.
-* - pstStatisticsPtrRequest : Pointer to link request.
-*
-* Returns - None.
-*/
-static VOID SendStatisticsPointerRequest(struct bcm_mini_adapter *Adapter, 
struct bcm_link_request *pstStatisticsPtrRequest)
-{
-   BCM_DEBUG_PRINT(Adapter, DBG_TYPE_RX, RX_DPC, DBG_LVL_ALL, ==);
-   pstStatisticsPtrRequest-Leader.Status = STATS_POINTER_REQ_STATUS;
-   pstStatisticsPtrRequest-Leader.PLength = sizeof(ULONG); /* minimum 4 
bytes */
-   pstStatisticsPtrRequest-szData[0] = STATISTICS_POINTER_REQ;
-   CopyBufferToControlPacket(Adapter, pstStatisticsPtrRequest);
-   BCM_DEBUG_PRINT(Adapter, DBG_TYPE_RX, RX_DPC, DBG_LVL_ALL, =);
-   return;
-}
-#endif
-
 /**
 * Function- LinkMessage()
 *
@@ -1217,45 +1193,6 @@ static VOID doPowerAutoCorrection(struct 
bcm_mini_adapter *psAdapter)
}
 }
 
-#if 0
-static unsigned char *ReadMacAddrEEPROM(struct bcm_mini_adapter *Adapter, 
ulong dwAddress)
-{
-   int status = 0, i = 0;
-   unsigned int temp = 0;
-   unsigned char *pucmacaddr = kmalloc(MAC_ADDRESS_SIZE, GFP_KERNEL);
-   int bytes;
-
-   if (!pucmacaddr) {
-   BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, No Buffers to 
Read the EEPROM Address\n);
-   return NULL;
-   }
-
-   dwAddress |= 0x5b00;
-   status = wrmalt(Adapter, EEPROM_COMMAND_Q_REG, (PUINT)dwAddress, 
sizeof(UINT));
-   if (status != STATUS_SUCCESS) {
-   BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, wrm 
Failed..\n);
-   kfree(pucmacaddr);
-   pucmacaddr = NULL;
-   goto OUT;
-   }
-
-   for (i = 0; i  MAC_ADDRESS_SIZE; i++) {
-   bytes = rdmalt(Adapter, EEPROM_READ_DATA_Q_REG, temp, 
sizeof(temp));
-   if (bytes  0) {
-   status = bytes;
-   BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, rdm 
Failed..\n);
-   kfree(pucmacaddr);
-   pucmacaddr = NULL;
-   goto OUT;
-   }
-   pucmacaddr[i] = temp  0xff;
-   BCM_DEBUG_PRINT(Adapter, DBG_TYPE_INITEXIT, DRV_ENTRY, 
DBG_LVL_ALL, %x\n, pucmacaddr[i]);
-   }
-OUT:
-   return pucmacaddr;
-}
-#endif
-
 static void convertEndian(B_UINT8 rwFlag, PUINT puiBuffer, UINT uiByteCount)
 {
UINT uiIndex = 0;
-- 
1.7.10.4

___
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/devel


[PATCH 2/3] staging: bcm: Remove all commented macros

2012-07-09 Thread Marcos Paulo de Souza
All these macros are commented, and can be removed.

Signed-off-by: Marcos Paulo de Souza marcos.souza@gmail.com
---
 drivers/staging/bcm/CmHost.c |1 -
 drivers/staging/bcm/Debug.h  |5 -
 drivers/staging/bcm/Macros.h |1 -
 drivers/staging/bcm/PHSDefines.h |1 -
 4 files changed, 8 deletions(-)

diff --git a/drivers/staging/bcm/CmHost.c b/drivers/staging/bcm/CmHost.c
index 9c8c9b1..b54ec97 100644
--- a/drivers/staging/bcm/CmHost.c
+++ b/drivers/staging/bcm/CmHost.c
@@ -4,7 +4,6 @@
  * Management.
  /
 
-/* #define CONN_MSG */
 #include headers.h
 
 enum E_CLASSIFIER_ACTION {
diff --git a/drivers/staging/bcm/Debug.h b/drivers/staging/bcm/Debug.h
index 420382d..8018a18 100644
--- a/drivers/staging/bcm/Debug.h
+++ b/drivers/staging/bcm/Debug.h
@@ -42,10 +42,6 @@
 #define ARP_REQ(TX5)
 #define ARP_RESP   (TX6)
 
-// dhcp.c
-//#define DHCP TX
-//#define DHCP_REQ (DHCP7)
-
 // Leakybucket.c
 #define TOKEN_COUNTS (TX8)
 #define CHECK_TOKENS (TX9)
@@ -147,7 +143,6 @@ DriverEntry.c, bcmfwup.c, ChipDetectTask.c, HaltnReset.c, 
InterfaceDDR.c */
 
 #define HOST_MIBS  (OTHERS  28)
 #define CONN_MSG   (CMHOST  29)
-//#define OTHERS_MISC  (OTHERS  29)  // ProcSupport.c
 /*-END SUBTYPEs--*/
 
 
diff --git a/drivers/staging/bcm/Macros.h b/drivers/staging/bcm/Macros.h
index b5ca6f6..46f5f0f 100644
--- a/drivers/staging/bcm/Macros.h
+++ b/drivers/staging/bcm/Macros.h
@@ -6,7 +6,6 @@
 
 #define TX_TIMER_PERIOD 10 /*10 msec*/
 #define MAX_CLASSIFIERS 100
-/* #define MAX_CLASSIFIERS_PER_SF  20 */
 #define MAX_TARGET_DSX_BUFFERS 24
 
 #define MAX_CNTRL_PKTS100
diff --git a/drivers/staging/bcm/PHSDefines.h b/drivers/staging/bcm/PHSDefines.h
index eed4cfc..6016fc5 100644
--- a/drivers/staging/bcm/PHSDefines.h
+++ b/drivers/staging/bcm/PHSDefines.h
@@ -27,7 +27,6 @@
 #define PHS_BUFFER_SIZE 1532
 
 
-//#define MAX_PHS_LENGTHS 100
 #define MAX_PHSRULE_PER_SF   20
 #define MAX_SERVICEFLOWS17
 
-- 
1.7.10.4

___
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/devel


[PATCH 3/3] staging: bcm: Misc.c: Remove unused macros

2012-07-09 Thread Marcos Paulo de Souza
These macros were reported by forgotten-macros tool
(https://github.com/marcosps/forgotten_macros).

Signed-off-by: Marcos Paulo de Souza marcos.souza@gmail.com
---
 drivers/staging/bcm/Misc.c |3 ---
 1 file changed, 3 deletions(-)

diff --git a/drivers/staging/bcm/Misc.c b/drivers/staging/bcm/Misc.c
index d7c662d..9a60d4c 100644
--- a/drivers/staging/bcm/Misc.c
+++ b/drivers/staging/bcm/Misc.c
@@ -1206,9 +1206,6 @@ static void convertEndian(B_UINT8 rwFlag, PUINT 
puiBuffer, UINT uiByteCount)
}
 }
 
-#define CACHE_ADDRESS_MASK 0x8000
-#define UNCACHE_ADDRESS_MASK 0xa000
-
 int rdm(struct bcm_mini_adapter *Adapter, UINT uiAddress, PCHAR pucBuff, 
size_t sSize)
 {
return Adapter-interface_rdm(Adapter-pvInterfaceAdapter,
-- 
1.7.10.4

___
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/devel


Re: [PATCH 1/4] zsmalloc: remove x86 dependency

2012-07-09 Thread Minchan Kim
On 07/03/2012 06:15 AM, Seth Jennings wrote:
 This patch replaces the page table assisted object mapping
 method, which has x86 dependencies, with a arch-independent
 method that does a simple copy into a temporary per-cpu
 buffer.
 
 While a copy seems like it would be worse than mapping the pages,
 tests demonstrate the copying is always faster and, in the case of
 running inside a KVM guest, roughly 4x faster.
 
 Signed-off-by: Seth Jennings sjenn...@linux.vnet.ibm.com
 ---
  drivers/staging/zsmalloc/Kconfig |4 --
  drivers/staging/zsmalloc/zsmalloc-main.c |   99 
 +-
  drivers/staging/zsmalloc/zsmalloc_int.h  |5 +-
  3 files changed, 72 insertions(+), 36 deletions(-)
 
 diff --git a/drivers/staging/zsmalloc/Kconfig 
 b/drivers/staging/zsmalloc/Kconfig
 index a5ab720..9084565 100644
 --- a/drivers/staging/zsmalloc/Kconfig
 +++ b/drivers/staging/zsmalloc/Kconfig
 @@ -1,9 +1,5 @@
  config ZSMALLOC
   tristate Memory allocator for compressed pages
 - # X86 dependency is because of the use of __flush_tlb_one and set_pte
 - # in zsmalloc-main.c.
 - # TODO: convert these to portable functions
 - depends on X86
   default n
   help
 zsmalloc is a slab-based memory allocator designed to store
 diff --git a/drivers/staging/zsmalloc/zsmalloc-main.c 
 b/drivers/staging/zsmalloc/zsmalloc-main.c
 index 10b0d60..a7a6f22 100644
 --- a/drivers/staging/zsmalloc/zsmalloc-main.c
 +++ b/drivers/staging/zsmalloc/zsmalloc-main.c
 @@ -470,6 +470,57 @@ static struct page *find_get_zspage(struct size_class 
 *class)
   return page;
  }
  
 +static void zs_copy_map_object(char *buf, struct page *firstpage,
 + int off, int size)

firstpage is rather misleading.
As you know, we use firstpage term for real firstpage of zspage but
in case of zs_copy_map_object, it could be a middle page of zspage.
So I would like to use page instead of firstpage.

 +{
 + struct page *pages[2];
 + int sizes[2];
 + void *addr;
 +
 + pages[0] = firstpage;
 + pages[1] = get_next_page(firstpage);
 + BUG_ON(!pages[1]);
 +
 + sizes[0] = PAGE_SIZE - off;
 + sizes[1] = size - sizes[0];
 +
 + /* disable page faults to match kmap_atomic() return conditions */
 + pagefault_disable();

If I understand your intention correctly, you want to prevent calling
this function on non-atomic context. Right?
Please write down description more clearly as point of view what's happen
if we didn't.

 +
 + /* copy object to per-cpu buffer */
 + addr = kmap_atomic(pages[0]);
 + memcpy(buf, addr + off, sizes[0]);
 + kunmap_atomic(addr);
 + addr = kmap_atomic(pages[1]);
 + memcpy(buf + sizes[0], addr, sizes[1]);
 + kunmap_atomic(addr);
 +}
 +
 +static void zs_copy_unmap_object(char *buf, struct page *firstpage,
 + int off, int size)

Ditto firstpage.

Otherwise, Looks good to me.

-- 
Kind regards,
Minchan Kim


___
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/devel


Re: [PATCH 2/4] zsmalloc: add single-page object fastpath in unmap

2012-07-09 Thread Minchan Kim
On 07/03/2012 06:15 AM, Seth Jennings wrote:
 Improve zs_unmap_object() performance by adding a fast path for
 objects that don't span pages.
 
 Signed-off-by: Seth Jennings sjenn...@linux.vnet.ibm.com
 ---
  drivers/staging/zsmalloc/zsmalloc-main.c |   15 ++-
  1 file changed, 10 insertions(+), 5 deletions(-)
 
 diff --git a/drivers/staging/zsmalloc/zsmalloc-main.c 
 b/drivers/staging/zsmalloc/zsmalloc-main.c
 index a7a6f22..4942d41 100644
 --- a/drivers/staging/zsmalloc/zsmalloc-main.c
 +++ b/drivers/staging/zsmalloc/zsmalloc-main.c
 @@ -774,6 +774,7 @@ void *zs_map_object(struct zs_pool *pool, unsigned long 
 handle)
   }
  
   zs_copy_map_object(area-vm_buf, page, off, class-size);
 + area-vm_addr = NULL;
   return area-vm_buf;
  }
  EXPORT_SYMBOL_GPL(zs_map_object);
 @@ -788,6 +789,14 @@ void zs_unmap_object(struct zs_pool *pool, unsigned long 
 handle)
   struct size_class *class;
   struct mapping_area *area;
  
 + area = __get_cpu_var(zs_map_area);
 + if (area-vm_addr) {
 + /* single-page object fastpath */
 + kunmap_atomic(area-vm_addr);
 + put_cpu_var(zs_map_area);
 + return;
 + }
 +

Please locate this after below BUG_ON.
The BUG check is still effective regardless of your fast path patch.

   BUG_ON(!handle);
  
   obj_handle_to_location(handle, page, obj_idx);
 @@ -795,11 +804,7 @@ void zs_unmap_object(struct zs_pool *pool, unsigned long 
 handle)
   class = pool-size_class[class_idx];
   off = obj_idx_to_offset(page, obj_idx, class-size);
  
 - area = __get_cpu_var(zs_map_area);
 - if (off + class-size = PAGE_SIZE)
 - kunmap_atomic(area-vm_addr);
 - else
 - zs_copy_unmap_object(area-vm_buf, page, off, class-size);
 + zs_copy_unmap_object(area-vm_buf, page, off, class-size);
   put_cpu_var(zs_map_area);
  }
  EXPORT_SYMBOL_GPL(zs_unmap_object);
 


-- 
Kind regards,
Minchan Kim


___
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/devel


Re: [PATCH 3/4] zsmalloc: add details to zs_map_object boiler plate

2012-07-09 Thread Minchan Kim
On 07/03/2012 06:15 AM, Seth Jennings wrote:
 Add information on the usage limits of zs_map_object()
 
 Signed-off-by: Seth Jennings sjenn...@linux.vnet.ibm.com
 ---
  drivers/staging/zsmalloc/zsmalloc-main.c |7 ++-
  1 file changed, 6 insertions(+), 1 deletion(-)
 
 diff --git a/drivers/staging/zsmalloc/zsmalloc-main.c 
 b/drivers/staging/zsmalloc/zsmalloc-main.c
 index 4942d41..abf7c13 100644
 --- a/drivers/staging/zsmalloc/zsmalloc-main.c
 +++ b/drivers/staging/zsmalloc/zsmalloc-main.c
 @@ -747,7 +747,12 @@ EXPORT_SYMBOL_GPL(zs_free);
   *
   * Before using an object allocated from zs_malloc, it must be mapped using
   * this function. When done with the object, it must be unmapped using
 - * zs_unmap_object
 + * zs_unmap_object.
 + *
 + * Only one object can be mapped per cpu at a time. There is no protection
 + * against nested mappings.
 + *
 + * This function returns with preemption and page faults disabled.
  */
  void *zs_map_object(struct zs_pool *pool, unsigned long handle)
  {
 

The comment is good but I hope we can detect it automatically with DEBUG
option. It wouldn't be hard but it's a debug patch so not critical
until we receive some report about the bug.

The possibility for nesting is that it is used by irq context.

A uses the mapping
.
.
.
IRQ happen
B uses the mapping in IRQ context
.
.
.

Maybe we need local_irq_save/restore in zs_[un]map_object path.

-- 
Kind regards,
Minchan Kim


___
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/devel


Re: [PATCH 0/3] staging: bcm: Cleanup bcm driver

2012-07-09 Thread Kevin McKinney
On Mon, Jul 09, 2012 at 10:32:37PM -0300, Marcos Paulo de Souza wrote:
 Hi Kernel guys!

 This new patchset tries to clean a little the bcm driver, removing
 some unused macros and some dead code.
   
 These macros and dead code were reported by the forgotten-macros tool
 (https://github.com/marcosps/forgotten_macros).
   
 The tool is under development, but all the patches looks like OK.   

 This patchset is based in staging-next.
   
 Thanks guys!

The patchset looks good!

Thanks,
Kevin
___
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/devel


[PATCH 0/5] staging: csr: Cleanup driver

2012-07-09 Thread Marcos Paulo de Souza
Hi kernel guys!

This patchset aims to clean a little the csr driver by removing dead code and
unused/commented macros.

All the macros and dead code was reported by the forgotten-macros tool
(https://github.com/marcosps/forgotten_macros).

This patchset is against staging-next.

I hope you like it :)

Marcos Paulo de Souza (5):
  staging: csr: Remove dead code
  staging: csr: csr_util.h: Remove commented macros
  staging: csr: netdev.c: Remove unused macros
  staging: csr: unifi_sme.c: Remove unused macros
  staging: csr: Remove unused macros

 drivers/staging/csr/csr_util.h   |7 ---
 drivers/staging/csr/csr_wifi_hip_card_sdio.c |3 --
 drivers/staging/csr/drv.c|1 -
 drivers/staging/csr/firmware.c   |1 -
 drivers/staging/csr/mlme.c   |5 ---
 drivers/staging/csr/monitor.c|   59 --
 drivers/staging/csr/netdev.c |5 ---
 drivers/staging/csr/sme_sys.c|1 -
 drivers/staging/csr/unifi_native.h   |   19 -
 drivers/staging/csr/unifi_sme.c  |6 ---
 10 files changed, 107 deletions(-)

-- 
1.7.10.4

___
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/devel


[PATCH 3/5] staging: csr: netdev.c: Remove unused macros

2012-07-09 Thread Marcos Paulo de Souza
These macros are not used, so we can remove it.

Signed-off-by: Marcos Paulo de Souza marcos.souza@gmail.com
---
 drivers/staging/csr/netdev.c |5 -
 1 file changed, 5 deletions(-)

diff --git a/drivers/staging/csr/netdev.c b/drivers/staging/csr/netdev.c
index cf19f11..55149df 100644
--- a/drivers/staging/csr/netdev.c
+++ b/drivers/staging/csr/netdev.c
@@ -70,11 +70,6 @@
  */
 #define ALLOW_Q_PAUSE
 
-#define ieee2host16(n)  __le16_to_cpu(n)
-#define ieee2host32(n)  __le32_to_cpu(n)
-#define host2ieee16(n)  __cpu_to_le16(n)
-#define host2ieee32(n)  __cpu_to_le32(n)
-
 #if LINUX_VERSION_CODE = KERNEL_VERSION(2,6,28)
 #ifdef UNIFI_NET_NAME
 #define UF_ALLOC_NETDEV(_dev, _size, _name, _setup, _num_of_queues) \
-- 
1.7.10.4

___
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/devel


[PATCH 2/5] staging: csr: csr_util.h: Remove commented macros

2012-07-09 Thread Marcos Paulo de Souza
All these macros are commented, so we can removed it.

Signed-off-by: Marcos Paulo de Souza marcos.souza@gmail.com
---
 drivers/staging/csr/csr_util.h |7 ---
 1 file changed, 7 deletions(-)

diff --git a/drivers/staging/csr/csr_util.h b/drivers/staging/csr/csr_util.h
index ce39c7e..5cd6cb4 100644
--- a/drivers/staging/csr/csr_util.h
+++ b/drivers/staging/csr/csr_util.h
@@ -47,17 +47,10 @@ void CsrUInt32ToHex(CsrUint32 number, CsrCharString *str);
 #define CsrMemCmp(s1, s2, n) ((CsrInt32) memcmp((s1), (s2), (n)))
 #define CsrStrCmp(s1, s2) ((CsrInt32) strcmp((s1), (s2)))
 #define CsrStrNCmp(s1, s2, n) ((CsrInt32) strncmp((s1), (s2), (n)))
-/*#define CsrMemChr memchr*/
 #define CsrStrChr strchr
-/*#define CsrStrCSpn strcspn*/
-/*#define CsrStrPBrk strpbrk*/
-/*#define CsrStrRChr strrchr*/
-/*#define CsrStrSpn strspn*/
 #define CsrStrStr strstr
-/*#define CsrStrTok strtok*/
 #define CsrMemSet memset
 #define CsrStrLen strlen
-/*#define CsrVsnprintf(s, n, format, arg) ((CsrInt32) vsnprintf((s), (n), 
(format), (arg)))*/
 #else /* !CSR_USE_STDC_LIB */
 void *CsrMemCpy(void *dest, const void *src, CsrSize count);
 void *CsrMemMove(void *dest, const void *src, CsrSize count);
-- 
1.7.10.4

___
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/devel


[PATCH 4/5] staging: csr: unifi_sme.c: Remove unused macros

2012-07-09 Thread Marcos Paulo de Souza
These macros are not used, so remove it.

Signed-off-by: Marcos Paulo de Souza marcos.souza@gmail.com
---
 drivers/staging/csr/unifi_sme.c |6 --
 1 file changed, 6 deletions(-)

diff --git a/drivers/staging/csr/unifi_sme.c b/drivers/staging/csr/unifi_sme.c
index 6e7cbbf..5ad1d5f 100644
--- a/drivers/staging/csr/unifi_sme.c
+++ b/drivers/staging/csr/unifi_sme.c
@@ -78,12 +78,6 @@ sme_log_event(ul_client_t *pcli,
 CsrResult result = CSR_RESULT_SUCCESS;
 int r;
 
-/* Following bits are encoded in hostTag These are there to ensure that 
hostTags are unique*/
-#define CSR_SME_DATA 0x  /* Frames Sent by SME */
-#define CSR_PAL_DATA 0X1000  /* Frames Sent by PAL-D*/
-#define CSR_NME_DATA 0x2000  /* Frames Sent by NME*/
-#define APPLICATION_DATA 0x3000  /* Frames Sent by Application*/
-
 func_enter();
 /* Just a sanity check */
 if ((signal == NULL) || (signal_len = 0)) {
-- 
1.7.10.4

___
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/devel


[PATCH 5/5] staging: csr: Remove unused macros

2012-07-09 Thread Marcos Paulo de Souza
These macros are not used, so remove it.

Signed-off-by: Marcos Paulo de Souza marcos.souza@gmail.com
---
 drivers/staging/csr/csr_wifi_hip_card_sdio.c |3 ---
 drivers/staging/csr/drv.c|1 -
 drivers/staging/csr/firmware.c   |1 -
 drivers/staging/csr/mlme.c   |5 -
 drivers/staging/csr/monitor.c|2 --
 drivers/staging/csr/sme_sys.c|1 -
 6 files changed, 13 deletions(-)

diff --git a/drivers/staging/csr/csr_wifi_hip_card_sdio.c 
b/drivers/staging/csr/csr_wifi_hip_card_sdio.c
index 91976b8..5a86ff9 100644
--- a/drivers/staging/csr/csr_wifi_hip_card_sdio.c
+++ b/drivers/staging/csr/csr_wifi_hip_card_sdio.c
@@ -36,9 +36,6 @@
 #define MAILBOX2_TIMEOUT5   /* in millisecs */
 #define MAILBOX2_ATTEMPTS   10  /* 50ms */
 
-#define MAILBOX2_RESET_ATTEMPTS 10
-#define MAILBOX2_RESET_TIMEOUT  5   /* in millisecs */
-
 #define RESET_SETTLE_DELAY  25  /* in millisecs */
 
 static CsrResult card_init_slots(card_t *card);
diff --git a/drivers/staging/csr/drv.c b/drivers/staging/csr/drv.c
index fbe8630..4be6d95 100644
--- a/drivers/staging/csr/drv.c
+++ b/drivers/staging/csr/drv.c
@@ -63,7 +63,6 @@ int coredump_max = CSR_WIFI_HIP_NUM_COREDUMP_BUFFERS;
 int run_bh_once = -1;  /* Set for scheduled interrupt mode, -1 = 
default */
 int bh_priority = -1;
 #ifdef CSR_WIFI_HIP_DEBUG_OFFLINE
-#define UNIFI_LOG_HIP_SIGNALS_FILTER_SIGNAL (1  0)
 #define UNIFI_LOG_HIP_SIGNALS_FILTER_BULKDATA   (1  1)
 #define UNIFI_LOG_HIP_SIGNALS_FILTER_TIMESTAMP  (1  2)
 int log_hip_signals = 0;
diff --git a/drivers/staging/csr/firmware.c b/drivers/staging/csr/firmware.c
index 03da0d5..98e27d6 100644
--- a/drivers/staging/csr/firmware.c
+++ b/drivers/staging/csr/firmware.c
@@ -220,7 +220,6 @@ unifi_fw_read(void *ospriv, void *arg, CsrUint32 offset, 
void *buf, CsrUint32 le
 
 
 
-#define UNIFIHELPER_INIT_MODE_SMEEMB0
 #define UNIFIHELPER_INIT_MODE_SMEUSER   2
 #define UNIFIHELPER_INIT_MODE_NATIVE1
 
diff --git a/drivers/staging/csr/mlme.c b/drivers/staging/csr/mlme.c
index 790d5d7..ed767ec 100644
--- a/drivers/staging/csr/mlme.c
+++ b/drivers/staging/csr/mlme.c
@@ -15,11 +15,6 @@
 #include csr_wifi_hip_unifi.h
 #include unifi_priv.h
 
-
-/* The additional time taken by the UniFi to do a scan per channel */
-#define SCAN_STARTUP_TIME   300 /* in millisecs */
-
-
 /*
  * ---
  * unifi_mlme_wait_for_reply
diff --git a/drivers/staging/csr/monitor.c b/drivers/staging/csr/monitor.c
index 8c35b7e..628782a 100644
--- a/drivers/staging/csr/monitor.c
+++ b/drivers/staging/csr/monitor.c
@@ -242,9 +242,7 @@ netrx_prism(unifi_priv_t *priv,
 unsigned char *ptr;
 unsigned char *base;
 int ind_data_len = skb_orig-len - 2 - ETH_HLEN;
-#define WLANCAP_MAGIC_COOKIE_BASE 0x80211000
 #define WLANCAP_MAGIC_COOKIE_V1 0x80211001
-#define WLANCAP_MAGIC_COOKIE_V2 0x80211002
 struct avs_header_v1 {
 uint32  version;
 uint32  length;
diff --git a/drivers/staging/csr/sme_sys.c b/drivers/staging/csr/sme_sys.c
index 9c3aa74..5f38f9d 100644
--- a/drivers/staging/csr/sme_sys.c
+++ b/drivers/staging/csr/sme_sys.c
@@ -1572,7 +1572,6 @@ void CsrWifiRouterMaPacketReqHandler(void* drvpriv, 
CsrWifiFsmEvent* msg)
 r = _sys_packet_req(priv, signal, mareq-subscriptionHandle,
 mareq-frameLength, mareq-frame, snap_protocol);
 
-#define MAX_RETRY 2
 if (r  mareq-cfmRequested)
 {
 CsrWifiRouterMaPacketCfmSend(msg-source,interfaceTag,
-- 
1.7.10.4

___
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/devel


[PATCH 2/2] staging/sm7xxfb: return a proper err for smtc_alloc_fb_info failure

2012-07-09 Thread Devendra Naga
as smtc_alloc_fb_info can fail, but we are returning the 0,
how? because the pci_enable_device succeeded, which makes the probe
return 0, and may cause panics or some strange problems at remove
when driver unloaded by modprobe -r.

so return err properly as smtc_alloc_fb_info is doing kzallocs its
good to do -ENOMEM

Signed-off-by: Devendra Naga devendra.a...@gmail.com
---
 drivers/staging/sm7xxfb/sm7xxfb.c |4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/sm7xxfb/sm7xxfb.c 
b/drivers/staging/sm7xxfb/sm7xxfb.c
index 0c0b603..7395196 100644
--- a/drivers/staging/sm7xxfb/sm7xxfb.c
+++ b/drivers/staging/sm7xxfb/sm7xxfb.c
@@ -808,8 +808,10 @@ static int __devinit smtcfb_pci_probe(struct pci_dev *pdev,
 
sfb = smtc_alloc_fb_info(pdev, name);
 
-   if (!sfb)
+   if (!sfb) {
+   err = -ENOMEM;
goto failed_free;
+   }
 
sfb-chip_id = ent-device;
sprintf(name, sm%Xfb, sfb-chip_id);
-- 
1.7.9.5

___
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/devel