Re: [PATCH] Staging: lustre: api-ni.c: adding tabs because lines were too long.

2015-04-03 Thread Dan Carpenter
Fix your from header so it has your name.

On Thu, Apr 02, 2015 at 04:57:52PM +0200, vcaba...@clipper.ens.fr wrote:
 From 654380760bfc5b35ed3d3d4a7d3eb126fe747959 Mon Sep 17 00:00:00 2001
 From: Vivien Cabannes vcaba...@clipper.ens.fr
 Date: Thu, 2 Apr 2015 16:32:15 +0200
 Subject: [PATCH] Staging: lustre: api-ni.c: adding tabs because lines were
  too long.

Remove this block of text.  Read Documentation/email-clients.txt.
Send the patch to yourself and apply it with git am.  Review the log.
Resend when that works.

 
 Adding tabs because lines were too long.
 

No signed off.


 ---
  drivers/staging/lustre/lnet/lnet/api-ni.c |   23 +++
  1 file changed, 15 insertions(+), 8 deletions(-)
 
 diff --git a/drivers/staging/lustre/lnet/lnet/api-ni.c 
 b/drivers/staging/lustre/lnet/lnet/api-ni.c
 index faceb95..4b5d465 100644
 --- a/drivers/staging/lustre/lnet/lnet/api-ni.c
 +++ b/drivers/staging/lustre/lnet/lnet/api-ni.c
 @@ -74,7 +74,8 @@ lnet_get_networks(void)
   int rc;
  
   if (*networks != 0  *ip2nets != 0) {
 - LCONSOLE_ERROR_MSG(0x101, Please specify EITHER 'networks' or 
 'ip2nets' but not both at once\n);
 + LCONSOLE_ERROR_MSG(0x101, Please specify EITHER 'networks'
 + or 'ip2nets' but not both at once\n);

No.  You've just mangled the output that will be printed on the users
computer by introducing random white space changes in the middle of a
string.

regards,
dan carpenter


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


Re: [PATCH] Staging: lustre: o2iblnd.c: Finished cleaning code style

2015-04-03 Thread Dan Carpenter
On Thu, Apr 02, 2015 at 07:52:07PM +0200, Guillaume Matheron wrote:
 I fixed lines over 80 characters and unnecessary returns
 
 Signed-off-by: Guillaume Matheron guillaume.mathe...@ens.fr
 ---
  .../staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c| 53 
 +-
  1 file changed, 31 insertions(+), 22 deletions(-)
 
 diff --git a/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c 
 b/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c
 index ae4069e..14c1d2b 100644
 --- a/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c
 +++ b/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c
 @@ -559,8 +559,9 @@ static kib_conn_t *kiblnd_get_conn_by_idx(lnet_ni_t *ni, 
 int index)
   conn = list_entry(ctmp, kib_conn_t,
 ibc_list);
   kiblnd_conn_addref(conn);
 - 
 read_unlock_irqrestore(kiblnd_data.kib_global_lock,
 -flags);
 + read_unlock_irqrestore(
 + kiblnd_data.kib_global_lock,
 + flags);

The original was basically fine and the new one is also ok.

   return conn;
   }
   }
 @@ -879,7 +880,8 @@ void kiblnd_destroy_conn(kib_conn_t *conn)
  
   if (conn-ibc_rxs != NULL) {
   LIBCFS_FREE(conn-ibc_rxs,
 - IBLND_RX_MSGS(conn-ibc_version) * 
 sizeof(kib_rx_t));
 + IBLND_RX_MSGS(conn-ibc_version)
 +   * sizeof(kib_rx_t));

Actually, could you move the * to the first line and align it like.

LIBCFS_FREE(conn-ibc_rxs,
IBLND_RX_MSGS(conn-ibc_version) *
sizeof(kib_rx_t));

[tab][tab][tab][space][space][space][space]

   }
  
   if (conn-ibc_connvars != NULL)
 @@ -936,7 +938,8 @@ int kiblnd_close_stale_conns_locked(kib_peer_t *peer,
   conn-ibc_incarnation == incarnation)
   continue;
  
 - CDEBUG(D_NET, Closing stale conn - %s version: %x, 
 incarnation:%#llx(%x, %#llx)\n,
 + CDEBUG(D_NET,
 +Closing stale conn - %s version: %x, 
 incarnation:%#llx(%x, %#llx)\n,
  libcfs_nid2str(peer-ibp_nid),
  conn-ibc_version, conn-ibc_incarnation,
  version, incarnation);
 @@ -1079,7 +1082,6 @@ void kiblnd_query(lnet_ni_t *ni, lnet_nid_t nid, 
 unsigned long *when)
   CDEBUG(D_NET, Peer %s %p, alive %ld secs ago\n,
  libcfs_nid2str(nid), peer,
  last_alive ? cfs_duration_sec(now - last_alive) : -1);
 - return;
  }
  
  void kiblnd_free_pages(kib_pages_t *p)
 @@ -1166,7 +1168,8 @@ void kiblnd_map_rx_descs(kib_conn_t *conn)
   rx-rx_msg = (kib_msg_t *)(((char *)page_address(pg)) + pg_off);
  
   rx-rx_msgaddr = 
 kiblnd_dma_map_single(conn-ibc_hdev-ibh_ibdev,
 -rx-rx_msg, 
 IBLND_MSG_SIZE,
 +rx-rx_msg,
 +IBLND_MSG_SIZE,
  DMA_FROM_DEVICE);
   LASSERT(!kiblnd_dma_mapping_error(conn-ibc_hdev-ibh_ibdev,
  rx-rx_msgaddr));
 @@ -1446,8 +1449,9 @@ static void kiblnd_fini_fmr_poolset(kib_fmr_poolset_t 
 *fps)
   }
  }
  
 -static int kiblnd_init_fmr_poolset(kib_fmr_poolset_t *fps, int cpt, 
 kib_net_t *net,
 -int pool_size, int flush_trigger)
 +static int kiblnd_init_fmr_poolset(kib_fmr_poolset_t *fps, int cpt,
 +kib_net_t *net, int pool_size,
 +int flush_trigger)
  {
   kib_fmr_pool_t *fpo;
   int  rc;
 @@ -1557,7 +1561,8 @@ int kiblnd_fmr_pool_map(kib_fmr_poolset_t *fps, __u64 
 *pages, int npages,
  
   if (fps-fps_increasing) {
   spin_unlock(fps-fps_lock);
 - CDEBUG(D_NET, Another thread is allocating new FMR pool, 
 waiting for her to complete\n);
 + CDEBUG(D_NET,
 + Another thread is allocating new FMR pool, waiting for 
 her to complete\n);


Slightly better to align it like:

CDEBUG(D_NET,
   Another thread is allocating new FMR pool, waiting for 
her to complete\n);


[tab][tab][space][space][space][space][space][space][space]Another

 @@ -2808,7 +2813,8 @@ static int kiblnd_base_startup(void)
   LASSERT(kiblnd_data.kib_init == IBLND_INIT_NOTHING);
  
   try_module_get(THIS_MODULE);
 - memset(kiblnd_data, 0, sizeof(kiblnd_data)); /* zero pointers, flags 
 etc */
 + /* zero pointers, flags etc */

These comments are obvious.  Just 

Re: [PATCH V2 2/3] staging: android: ion_test: unregister the misc device

2015-04-03 Thread Greg KH
On Thu, Apr 02, 2015 at 09:36:06PM +0700, Phong Tran wrote:
 Add the remove() method for deregister from misc device
 when it's unloaded.
 
 Signed-off-by: Phong Tran tranmanph...@gmail.com
 ---
  drivers/staging/android/ion/ion_test.c | 12 
  1 file changed, 12 insertions(+)
 
 diff --git a/drivers/staging/android/ion/ion_test.c 
 b/drivers/staging/android/ion/ion_test.c
 index 3bc461c..d6a9653 100644
 --- a/drivers/staging/android/ion/ion_test.c
 +++ b/drivers/staging/android/ion/ion_test.c
 @@ -261,7 +261,19 @@ static int __init ion_test_probe(struct platform_device 
 *pdev)
   return 0;
  }
  
 +static int ion_test_remove(struct platform_device *pdev)
 +{
 + struct ion_test_device *testdev;
 +
 + testdev = platform_get_drvdata(pdev);
 + if (!testdev)
 + return -ENODATA;
 +
 + return  misc_deregister(testdev-misc);

Extra space here :(

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


Re: [PATCH/RFC 5/6] staging: board: Add support for devices with complex dependencies

2015-04-03 Thread Dan Carpenter
On Fri, Apr 03, 2015 at 02:42:02PM +0200, Geert Uytterhoeven wrote:
 +int __init board_staging_register_clock(const struct board_staging_clk *bsc)
 +{
 + struct clk *clk;
 + int error;
 +
 + pr_debug(Registering clock %s for con_id %s dev_id %s\n, bsc-clk,
 +  bsc-con_id, bsc-dev_id);
 + clk = clk_get(NULL, bsc-clk);
 + if (IS_ERR(clk)) {
 + error = PTR_ERR(clk);
 + pr_err(Failed to get clock %s (%d)\n, bsc-clk, error);
 + return error;
 + }
 +
 + error = clk_register_clkdev(clk, bsc-con_id, bsc-dev_id);
 + if (error)
 + pr_err(Failed to register clock %s (%d)\n, bsc-clk, error);
 + return error;

Missing curly braces.  Also it's weird that don't we need a clk_put()
on the error patch as well as the success path?

 +
 + clk_put(clk);
 + return 0;
 +}


regards,
dan carpenter
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] drivers: staging: speakup: fix sparse warning: expression using sizeof bool

2015-04-03 Thread Greg Kroah-Hartman
On Fri, Mar 27, 2015 at 09:29:43PM +0100, Witos wrote:
 Changed bool to u8.
 
 Signed-off-by: Piotr Witoslawski pwi...@gmail.com

Your From: email line and signed-off-by: line names do not match, so I
can't take this patch :(

Please fix up and resend.

 ---
  drivers/staging/speakup/fakekey.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
 
 diff --git a/drivers/staging/speakup/fakekey.c 
 b/drivers/staging/speakup/fakekey.c
 index 4299cf4..3dfb6bd 100644
 --- a/drivers/staging/speakup/fakekey.c
 +++ b/drivers/staging/speakup/fakekey.c
 @@ -28,7 +28,7 @@
  #define PRESSED 1
  #define RELEASED 0
  
 -static DEFINE_PER_CPU(bool, reporting_keystroke);
 +static DEFINE_PER_CPU(u8, reporting_keystroke);

What is this fixing?  Why can't we have a bool as a per-cpu variable?
We are only writing true or false to it.

thanks,

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


Re: [PATCH] drivers: staging: speakup: fix sparse warning: expression using sizeof bool

2015-04-03 Thread Greg Kroah-Hartman
On Fri, Mar 27, 2015 at 09:36:07PM +0100, Witos wrote:
 Changed bool to u8 to get rid of sparse warning.
 
 Signed-off-by: Piotr Witoslawski pwi...@gmail.com
 ---
  drivers/staging/speakup/fakekey.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
 
 diff --git a/drivers/staging/speakup/fakekey.c 
 b/drivers/staging/speakup/fakekey.c
 index 4299cf4..3dfb6bd 100644
 --- a/drivers/staging/speakup/fakekey.c
 +++ b/drivers/staging/speakup/fakekey.c
 @@ -28,7 +28,7 @@
  #define PRESSED 1
  #define RELEASED 0
  
 -static DEFINE_PER_CPU(bool, reporting_keystroke);
 +static DEFINE_PER_CPU(u8, reporting_keystroke);

Why send this twice?

And again, I don't think this is fixing anything, what is wrong with
this code?

confused,

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


[PATCH/RFC 3/6] staging: board: Add support for translating hwirq to virq numbers

2015-04-03 Thread Geert Uytterhoeven
As of commit 9a1091ef0017c40a (irqchip: gic: Support hierarchy irq
domain.), GIC IRQ numbers are virtual, breaking hardcoded hardware IRQ
numbers in platform device resources.

Add support for translating hardware IRQ numbers to virtual IRQ numbers,
and fixing up platform device resources with hardcoded IRQ numbers.

Add a copyright header, including the original author.

Signed-off-by: Geert Uytterhoeven geert+rene...@glider.be
---
 drivers/staging/board/board.c | 66 +++
 drivers/staging/board/board.h |  5 
 2 files changed, 71 insertions(+)

diff --git a/drivers/staging/board/board.c b/drivers/staging/board/board.c
index d5a6abc845191c93..b84ac2837a20bf06 100644
--- a/drivers/staging/board/board.c
+++ b/drivers/staging/board/board.c
@@ -1,10 +1,27 @@
+/*
+ * Copyright (C) 2014 Magnus Damm
+ * Copyright (C) 2015 Glider bvba
+ *
+ * This file is subject to the terms and conditions of the GNU General Public
+ * License.  See the file COPYING in the main directory of this archive
+ * for more details.
+ */
+
+#define pr_fmt(fmt)board_staging:   fmt
+
 #include linux/init.h
+#include linux/irq.h
 #include linux/device.h
 #include linux/kernel.h
 #include linux/of.h
 #include linux/of_address.h
+#include linux/of_irq.h
+
 #include board.h
 
+static struct device_node *irqc_node __initdata;
+static unsigned int irqc_base __initdata;
+
 static bool find_by_address(u64 base_address)
 {
struct device_node *dn = of_find_all_nodes(NULL);
@@ -38,3 +55,52 @@ bool __init board_staging_dt_node_available(const struct 
resource *resource,
 
return false; /* Nothing found */
 }
+
+int __init board_staging_setup_hwirq_xlate(const char *irqc_match,
+  unsigned int base)
+{
+   irqc_node = of_find_compatible_node(NULL, NULL, irqc_match);
+
+   WARN_ON(!irqc_node);
+   if (!irqc_node)
+   return -ENOENT;
+
+   irqc_base = base;
+   return 0;
+}
+
+static unsigned int __init xlate_hwirq(unsigned int hwirq)
+{
+   struct of_phandle_args irq_data;
+   unsigned int irq;
+
+   if (!irqc_node)
+   return hwirq;
+
+   irq_data.np = irqc_node;
+   irq_data.args_count = 3;
+   irq_data.args[0] = 0;
+   irq_data.args[1] = hwirq - irqc_base;
+   irq_data.args[2] = IRQ_TYPE_LEVEL_HIGH;
+
+   irq = irq_create_of_mapping(irq_data);
+   if (WARN_ON(!irq))
+   irq = hwirq;
+
+   return irq;
+}
+
+void __init board_staging_fixup_irq_resources(struct resource *res,
+ unsigned int nres)
+{
+   unsigned int i;
+
+   for (i = 0; i  nres; i++)
+   if (res[i].flags == IORESOURCE_IRQ) {
+   unsigned int hwirq = res[i].start;
+   unsigned int virq = xlate_hwirq(hwirq);
+
+   pr_debug(hwirq %u - virq %u\n, hwirq, virq);
+   res[i].start = virq;
+   }
+}
diff --git a/drivers/staging/board/board.h b/drivers/staging/board/board.h
index e9c914985d4acb36..4cedc3c46e287eb7 100644
--- a/drivers/staging/board/board.h
+++ b/drivers/staging/board/board.h
@@ -1,10 +1,15 @@
 #ifndef __BOARD_H__
 #define __BOARD_H__
+
 #include linux/init.h
 #include linux/of.h
 
+struct resource;
+
 bool board_staging_dt_node_available(const struct resource *resource,
 unsigned int num_resources);
+int board_staging_setup_hwirq_xlate(const char *irqc_match, unsigned int base);
+void board_staging_fixup_irq_resources(struct resource *res, unsigned int 
nres);
 
 #define board_staging(str, fn) \
 static int __init runtime_board_check(void)\
-- 
1.9.1

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


[PATCH/RFC 6/6] staging: board: armadillo800eva: Board staging for sh_mobile_lcdc_fb

2015-04-03 Thread Geert Uytterhoeven
Add staging board support for the r8a7740-based armadillo800eva board
and add platform devices to allow in-tree continuous development of the
drivers on the armadillo800eva board.

When DT bindings are ready for theses drivers then the platform devices
in the armadillo800eva staging board code can easily be removed. Until
then we use platform devices to continuously improve the driver and
integrate code.

Added platform devices:
  - sh_mobile_lcdc_fb for the on-board LCD.

Signed-off-by: Geert Uytterhoeven geert+rene...@glider.be
---
What other devices do we want to add?
---
 drivers/staging/board/Makefile  |   3 +-
 drivers/staging/board/armadillo800eva.c | 124 
 2 files changed, 126 insertions(+), 1 deletion(-)
 create mode 100644 drivers/staging/board/armadillo800eva.c

diff --git a/drivers/staging/board/Makefile b/drivers/staging/board/Makefile
index 65d39ecfad63bbf4..6842745feb9404f8 100644
--- a/drivers/staging/board/Makefile
+++ b/drivers/staging/board/Makefile
@@ -1,2 +1,3 @@
 obj-y  := board.o
-obj-$(CONFIG_ARCH_EMEV2)  += kzm9d.o
+obj-$(CONFIG_ARCH_EMEV2)   += kzm9d.o
+obj-$(CONFIG_ARCH_R8A7740) += armadillo800eva.o
diff --git a/drivers/staging/board/armadillo800eva.c 
b/drivers/staging/board/armadillo800eva.c
new file mode 100644
index ..f9cb645877f52c52
--- /dev/null
+++ b/drivers/staging/board/armadillo800eva.c
@@ -0,0 +1,124 @@
+/*
+ * Staging board support for Armadillo 800 eva.
+ * Enable not-yet-DT-capable devices here.
+ *
+ * Based on board-armadillo800eva.c
+ *
+ * Copyright (C) 2012 Renesas Solutions Corp.
+ * Copyright (C) 2012 Kuninori Morimoto kuninori.morimoto...@renesas.com
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ *
+ * 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/dma-mapping.h
+#include linux/fb.h
+#include linux/gpio.h
+#include linux/kernel.h
+#include linux/pinctrl/machine.h
+#include linux/platform_device.h
+#include linux/videodev2.h
+
+#include video/sh_mobile_lcdc.h
+
+#include board.h
+
+
+static struct fb_videomode lcdc0_mode = {
+   .name   = AMPIER/AM-800480,
+   .xres   = 800,
+   .yres   = 480,
+   .left_margin= 88,
+   .right_margin   = 40,
+   .hsync_len  = 128,
+   .upper_margin   = 20,
+   .lower_margin   = 5,
+   .vsync_len  = 5,
+   .sync   = 0,
+};
+
+static struct sh_mobile_lcdc_info lcdc0_info = {
+   .clock_source   = LCDC_CLK_BUS,
+   .ch[0] = {
+   .chan   = LCDC_CHAN_MAINLCD,
+   .fourcc = V4L2_PIX_FMT_RGB565,
+   .interface_type = RGB24,
+   .clock_divider  = 5,
+   .flags  = 0,
+   .lcd_modes  = lcdc0_mode,
+   .num_modes  = 1,
+   .panel_cfg = {
+   .width  = 111,
+   .height = 68,
+   },
+   },
+};
+
+static struct resource lcdc0_resources[] = {
+   [0] = {
+   .name   = LCD0,
+   .start  = 0xfe94,
+   .end= 0xfe943fff,
+   .flags  = IORESOURCE_MEM,
+   },
+   [1] = {
+   .start  = 177 + 32,
+   .flags  = IORESOURCE_IRQ,
+   },
+};
+
+static struct platform_device lcdc0_device = {
+   .name   = sh_mobile_lcdc_fb,
+   .num_resources  = ARRAY_SIZE(lcdc0_resources),
+   .resource   = lcdc0_resources,
+   .id = 0,
+   .dev= {
+   .platform_data  = lcdc0_info,
+   .coherent_dma_mask = DMA_BIT_MASK(32),
+   },
+};
+
+static const struct board_staging_clk lcdc0_clocks[] __initconst = {
+   { lcdc0, NULL, sh_mobile_lcdc_fb.0 },
+};
+
+static const struct pinctrl_map lcdc0_pinmaps[] __initconst = {
+   PIN_MAP_MUX_GROUP_DEFAULT(sh_mobile_lcdc_fb.0, e605.pfc,
+ lcd0_data24_0, lcd0),
+   PIN_MAP_MUX_GROUP_DEFAULT(sh_mobile_lcdc_fb.0, e605.pfc,
+ lcd0_lclk_1, lcd0),
+   PIN_MAP_MUX_GROUP_DEFAULT(sh_mobile_lcdc_fb.0, e605.pfc,
+ lcd0_sync, lcd0),
+};
+
+static const struct board_staging_gpio lcdc0_gpios[] __initconst = {
+   { 176, GPIOF_OUT_INIT_HIGH },   /* DBGMD/LCDC0/FSIA MUX */
+};
+
+static const struct board_staging_dev armadillo800eva_devices[] __initconst = {
+   {
+   .pdev   = lcdc0_device,
+   .clocks = lcdc0_clocks,
+   .nclocks= ARRAY_SIZE(lcdc0_clocks),
+

[PATCH/RFC 0/6] staging: board: armadillo800eva: Board staging for sh_mobile_lcdc_fb

2015-04-03 Thread Geert Uytterhoeven
Hi all,

This RFC patch series adds board staging support for r8a7740/armadillo.
For now this supports only the frame buffer device for the on-board LCD.
The goal is to complete the move to ARM multiplatform kernels for all
shmobile platforms, and drop the existing board files
(arch/arm/mach-shmobile/board-*).

The board staging area was introduced last year to allow continuous
upstream in-tree development and integration of platform devices. It
helps developers integrate devices as platform devices for device
drivers that only provide platform device bindings.  This in turn allows
for incremental development of both hardware feature support and DT
binding work in parallel.

This series consists of 4 parts:
  - Patch 1 re-enables compilation of the board staging area, which was
disabled after a compile breakage, but has been fixed in the mean
time,
  - Path 2 moves initialization of staging board code to an earlier
moment, as currently it happens after unused PM domains are powered
down,
  - Patches 3 and 4 (hopefully) fix the existing kzm9d board staging
code, which was presumably broken by commit 9a1091ef0017c40a
(irqchip: gic: Support hierarchy irq domain.),
  - Patches 5 and 6 add support for registering platform devices with
complex dependencies (clocks, pinctrl, gpios, PM domains), and add
armadillo board staging code for enabling a frame buffer on the
on-board LCD.

Questions:
  - Are there other devices from board-armadillo.c that work fine in
armadillo-legacy, and that we want to add?
I think this is the list of devices lacking DT support and/or
missing in DTS:
  - renesas_usbhs (does this work? the platform device is
instantiated conditionally, but the condition (gpio state) is
never true?)
  - sh-mobile-hdmi/sh_mobile_lcdc_fb.1 (this seems to be broken in
-legacy?)
  - sdhi1 (we do have sdhi0)
  - mmcif
  - soc-camera-pdrv/sh_mobile_ceu
  - ipmmu
  - sh-dma-engine (this will probably never get DT support)

  - What about support for other boards (kzm9g, bockw, marzen)?

This was tested on r8a7740/armadillo.
This was not tested on emev2/kzm9d, due to lack of hardware.

Thanks for your comments!

Geert Uytterhoeven (6):
  Revert staging: board: disable as it breaks the build
  [RFC] staging: board: Initialize staging board code earlier
  [RFC] staging: board: Add support for translating hwirq to virq numbers
  [RFC] staging: board: kzm9d: Translate hwirq numbers to virq numbers
  [RFC] staging: board: Add support for devices with complex dependencies
  [RFC] staging: board: armadillo800eva: Board staging for sh_mobile_lcdc_fb

 drivers/staging/board/Kconfig   |   1 -
 drivers/staging/board/Makefile  |   3 +-
 drivers/staging/board/armadillo800eva.c | 124 
 drivers/staging/board/board.c   | 142 
 drivers/staging/board/board.h   |  38 -
 drivers/staging/board/kzm9d.c   |  10 ++-
 6 files changed, 313 insertions(+), 5 deletions(-)
 create mode 100644 drivers/staging/board/armadillo800eva.c

-- 
1.9.1

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- ge...@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say programmer or something like that.
-- Linus Torvalds
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH/RFC 5/6] staging: board: Add support for devices with complex dependencies

2015-04-03 Thread Geert Uytterhoeven
Add support for easy registering of one ore more platform devices that
may:
  - need clocks that are described in DT,
  - need pin control configuration,
  - rely on a configured GPIO,
  - be part of a PM Domain.

All these dependencies are optional.

Signed-off-by: Geert Uytterhoeven geert+rene...@glider.be
---
 drivers/staging/board/board.c | 76 +++
 drivers/staging/board/board.h | 31 ++
 2 files changed, 107 insertions(+)

diff --git a/drivers/staging/board/board.c b/drivers/staging/board/board.c
index b84ac2837a20bf06..da2469e2d4262fac 100644
--- a/drivers/staging/board/board.c
+++ b/drivers/staging/board/board.c
@@ -9,6 +9,9 @@
 
 #define pr_fmt(fmt)board_staging:   fmt
 
+#include linux/clk.h
+#include linux/clkdev.h
+#include linux/gpio.h
 #include linux/init.h
 #include linux/irq.h
 #include linux/device.h
@@ -16,6 +19,9 @@
 #include linux/of.h
 #include linux/of_address.h
 #include linux/of_irq.h
+#include linux/pinctrl/machine.h
+#include linux/platform_device.h
+#include linux/pm_domain.h
 
 #include board.h
 
@@ -104,3 +110,73 @@ void __init board_staging_fixup_irq_resources(struct 
resource *res,
res[i].start = virq;
}
 }
+
+int __init board_staging_register_clock(const struct board_staging_clk *bsc)
+{
+   struct clk *clk;
+   int error;
+
+   pr_debug(Registering clock %s for con_id %s dev_id %s\n, bsc-clk,
+bsc-con_id, bsc-dev_id);
+   clk = clk_get(NULL, bsc-clk);
+   if (IS_ERR(clk)) {
+   error = PTR_ERR(clk);
+   pr_err(Failed to get clock %s (%d)\n, bsc-clk, error);
+   return error;
+   }
+
+   error = clk_register_clkdev(clk, bsc-con_id, bsc-dev_id);
+   if (error)
+   pr_err(Failed to register clock %s (%d)\n, bsc-clk, error);
+   return error;
+
+   clk_put(clk);
+   return 0;
+}
+
+int __init board_staging_register_device(const struct board_staging_dev *dev)
+{
+   struct platform_device *pdev = dev-pdev;
+   unsigned int i;
+   int error;
+
+   pr_debug(Trying to register device %s\n, pdev-name);
+   if (board_staging_dt_node_available(pdev-resource,
+   pdev-num_resources)) {
+   pr_warn(Skipping %s, already in DT\n, pdev-name);
+   return -EEXIST;
+   }
+
+   board_staging_fixup_irq_resources(pdev-resource, pdev-num_resources);
+
+   for (i = 0; i  dev-nclocks; i++)
+   board_staging_register_clock(dev-clocks[i]);
+
+   if (dev-npinmaps)
+   pinctrl_register_mappings(dev-pinmaps, dev-npinmaps);
+
+   for (i = 0; i  dev-ngpios; i++)
+   gpio_request_one(dev-gpios[i].gpio, dev-gpios[i].flags,
+pdev-name);
+
+   error = platform_device_register(pdev);
+   if (error) {
+   pr_err(Failed to register device %s (%d)\n, pdev-name,
+  error);
+   return error;
+   }
+
+   if (dev-domain)
+   __pm_genpd_name_add_device(dev-domain, pdev-dev, NULL);
+
+   return error;
+}
+
+void __init board_staging_register_devices(const struct board_staging_dev 
*devs,
+  unsigned int ndevs)
+{
+   unsigned int i;
+
+   for (i = 0; i  ndevs; i++)
+   board_staging_register_device(devs[i]);
+}
diff --git a/drivers/staging/board/board.h b/drivers/staging/board/board.h
index 4cedc3c46e287eb7..7aaa0f7d6fafb9e5 100644
--- a/drivers/staging/board/board.h
+++ b/drivers/staging/board/board.h
@@ -4,12 +4,43 @@
 #include linux/init.h
 #include linux/of.h
 
+struct board_staging_clk {
+   const char *clk;
+   const char *con_id;
+   const char *dev_id;
+};
+
+struct board_staging_gpio {
+   unsigned int gpio;
+   unsigned long flags;/* See GPIOF_* */
+};
+
+struct board_staging_dev {
+   /* Platform Device */
+   struct platform_device *pdev;
+   /* Clocks (optional) */
+   const struct board_staging_clk *clocks;
+   unsigned int nclocks;
+   /* Pin Control Maps (optional) */
+   const struct pinctrl_map *pinmaps;
+   unsigned int npinmaps;
+   /* GPIOs (optional) */
+   const struct board_staging_gpio *gpios;
+   unsigned int ngpios;
+   /* PM Domain (optional) */
+   const char *domain;
+};
+
 struct resource;
 
 bool board_staging_dt_node_available(const struct resource *resource,
 unsigned int num_resources);
 int board_staging_setup_hwirq_xlate(const char *irqc_match, unsigned int base);
 void board_staging_fixup_irq_resources(struct resource *res, unsigned int 
nres);
+int board_staging_register_clock(const struct board_staging_clk *bsc);
+int board_staging_register_device(const struct board_staging_dev *dev);
+void board_staging_register_devices(const struct board_staging_dev *devs,

Re: [PATCH] staging:rtl8192e: Change printk statements in rtllib_tx.c to use netdev_dev

2015-04-03 Thread Dan Carpenter

 @@ -582,7 +582,7 @@ int rtllib_xmit_inter(struct sk_buff *skb, struct 
 net_device *dev)
  IEEE_SOFTMAC_TX_QUEUE)) ||
  ((!ieee-softmac_data_hard_start_xmit 
  (ieee-softmac_features  IEEE_SOFTMAC_TX_QUEUE {
 - printk(KERN_WARNING %s: No xmit handler.\n,
 + netdev_info(ieee-dev, %s: No xmit handler.\n,


This should be netdev_warn().  There are a few other similar places.

regards,
dan carpenter

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


Re: [PATCH] staging:rtl8192e: Change printk statements in rtllib_tx.c to use netdev_dev

2015-04-03 Thread Greg KH
On Fri, Apr 03, 2015 at 11:49:57AM -0400, Nicholas Krause wrote:
 
 
 On April 3, 2015 5:19:55 AM EDT, Dan Carpenter dan.carpen...@oracle.com 
 wrote:
 
  @@ -582,7 +582,7 @@ int rtllib_xmit_inter(struct sk_buff *skb, struct
 net_device *dev)
IEEE_SOFTMAC_TX_QUEUE)) ||
((!ieee-softmac_data_hard_start_xmit 
(ieee-softmac_features  IEEE_SOFTMAC_TX_QUEUE {
  -  printk(KERN_WARNING %s: No xmit handler.\n,
  +  netdev_info(ieee-dev, %s: No xmit handler.\n,
 
 
 This should be netdev_warn().  There are a few other similar places.
 
 regards,
 dan carpenter
 My bad will send in a v2 fixing this. 

Please don't, I'm not going to be taking patches from you any _year_
soon.

sorry,

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


Re: [PATCH/RFC 5/6] staging: board: Add support for devices with complex dependencies

2015-04-03 Thread Russell King - ARM Linux
On Fri, Apr 03, 2015 at 03:57:27PM +0300, Dan Carpenter wrote:
 On Fri, Apr 03, 2015 at 02:42:02PM +0200, Geert Uytterhoeven wrote:
  +int __init board_staging_register_clock(const struct board_staging_clk 
  *bsc)
  +{
  +   struct clk *clk;
  +   int error;
  +
  +   pr_debug(Registering clock %s for con_id %s dev_id %s\n, bsc-clk,
  +bsc-con_id, bsc-dev_id);
  +   clk = clk_get(NULL, bsc-clk);
  +   if (IS_ERR(clk)) {
  +   error = PTR_ERR(clk);
  +   pr_err(Failed to get clock %s (%d)\n, bsc-clk, error);
  +   return error;
  +   }
  +
  +   error = clk_register_clkdev(clk, bsc-con_id, bsc-dev_id);
  +   if (error)
  +   pr_err(Failed to register clock %s (%d)\n, bsc-clk, error);
  +   return error;
 
 Missing curly braces.  Also it's weird that don't we need a clk_put()
 on the error patch as well as the success path?

What's also concerning is that this is an abuse of this.

clk_register_clkdev() is supposed to be used with clocks created with
the CCF functions, it's not for creating aliases.

We have clk_add_alias() which does *everything* that this function does,
only in a less buggy way.

-- 
FTTC broadband for 0.8mile line: currently at 10.5Mbps down 400kbps up
according to speedtest.net.
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] staging:rtl8192e: Change printk statements in rtllib_tx.c to use netdev_dev

2015-04-03 Thread Greg KH
On Fri, Apr 03, 2015 at 02:05:11PM -0400, Nicholas Krause wrote:
 
 
 On April 3, 2015 1:05:59 PM EDT, Greg KH gre...@linuxfoundation.org wrote:
 On Fri, Apr 03, 2015 at 11:49:57AM -0400, Nicholas Krause wrote:
  
  
  On April 3, 2015 5:19:55 AM EDT, Dan Carpenter
 dan.carpen...@oracle.com wrote:
  
   @@ -582,7 +582,7 @@ int rtllib_xmit_inter(struct sk_buff *skb,
 struct
  net_device *dev)
  IEEE_SOFTMAC_TX_QUEUE)) ||
  ((!ieee-softmac_data_hard_start_xmit 
  (ieee-softmac_features  IEEE_SOFTMAC_TX_QUEUE {
   -   printk(KERN_WARNING %s: No xmit handler.\n,
   +   netdev_info(ieee-dev, %s: No xmit handler.\n,
  
  
  This should be netdev_warn().  There are a few other similar places.
  
  regards,
  dan carpenter
  My bad will send in a v2 fixing this. 
 
 Please don't, I'm not going to be taking patches from you any _year_
 soon.
 
 sorry,
 
 greg k-h
 Very well then I guess you seem to not trust me no matter how hard I
 try.  Therefore I will avoid helping out in any subsystems you are a
 maintainer of. 

You have not tried at all.  You submit patches that don't even apply
(like this one), are incorrect, or wrong in some other way.

You activly take up the time and energy of people who are contributing
to the kernel, that is why you were banned from vger.kernel.org.  You
also, when offered a way to learn and redeem yourself, ignored it, and
did something else.

What would you do with someone like youself if you were in our shoes?

back into my kill-file you go...

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


[PATCH] Staging: rtl8188eu: Remove zero testing pointer typed value

2015-04-03 Thread Amitoj Kaur Chawla
Removes variable comparison with 0 by using !. 
Done using following coccinelle script.

@ disable is_zero,isnt_zero @
expression *E;
expression E1,f;
@@

E = f(...)
...
(
- E == 0
+ !E
|
- E != 0
+ E
|
- 0 == E
+ !E
|
- 0 != E
+ E
)
...
?E = E1

@ disable is_zero,isnt_zero @
expression *E;
@@

(
  E ==
- 0
+ NULL
|
  E !=
- 0
+ NULL
|
- 0
+ NULL
  == E
|
- 0
+ NULL
  != E
)

Signed-off-by: Amitoj Kaur Chawla amitoj1...@gmail.com
---
 drivers/staging/rtl8188eu/hal/odm.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/rtl8188eu/hal/odm.c 
b/drivers/staging/rtl8188eu/hal/odm.c
index 28b5e7b..bc2dca4 100644
--- a/drivers/staging/rtl8188eu/hal/odm.c
+++ b/drivers/staging/rtl8188eu/hal/odm.c
@@ -650,7 +650,7 @@ void odm_DIG(struct odm_dm_struct *pDM_Odm)
 
} else {
/* Recovery mechanism for IGI lower bound */
-   if (pDM_DigTable-Recover_cnt != 0) {
+   if (pDM_DigTable-Recover_cnt) {
pDM_DigTable-Recover_cnt--;
} else {
if (pDM_DigTable-LargeFAHit  3) {
@@ -851,7 +851,7 @@ void ODM_RF_Saving(struct odm_dm_struct *pDM_Odm, u8 
bForceInNormal)
Rssi_Up_bound = 50;
Rssi_Low_bound = 45;
}
-   if (pDM_PSTable-initialize == 0) {
+   if (!pDM_PSTable-initialize) {
pDM_PSTable-Reg874 = (phy_query_bb_reg(adapter, 0x874, 
bMaskDWord)0x1CC000)14;
pDM_PSTable-RegC70 = (phy_query_bb_reg(adapter, 0xc70, 
bMaskDWord)BIT3)3;
pDM_PSTable-Reg85C = (phy_query_bb_reg(adapter, 0x85c, 
bMaskDWord)0xFF00)24;
@@ -1180,7 +1180,7 @@ void odm_RSSIMonitorCheckCE(struct odm_dm_struct *pDM_Odm)
}
}
 
-   if (tmpEntryMaxPWDB != 0)   /*  If associated entry is found */
+   if (tmpEntryMaxPWDB)/*  If associated entry is found */
pdmpriv-EntryMaxUndecoratedSmoothedPWDB = tmpEntryMaxPWDB;
else
pdmpriv-EntryMaxUndecoratedSmoothedPWDB = 0;
-- 
1.9.1

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


Re: [PATCH] Staging: rtl8188eu: Remove zero testing pointer typed value

2015-04-03 Thread Dan Carpenter
On Fri, Apr 03, 2015 at 10:12:11PM +0530, Amitoj Kaur Chawla wrote:
 Removes variable comparison with 0 by using !. 

Sometimes testing for zero makes sense.  When you write code, you are
telling a story.  If you are talking about zero as a number then it
can make sense.  If it's zero as a boolean then it doesn't make sense.

Also strcmp() and similar should always be done as == 0,  0 or != 0
because that is the idiom:

if name != foo then

becomes:

if (strcmpt(name, foo) != 0) {

The != from the first is shifted in the second.

So I don't really think this approach is the right thing.  You have to
read the code and understand the story it is telling.  Then change it
if needed.

regards,
dan carpenter

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


Re: [PATCH/RFC 5/6] staging: board: Add support for devices with complex dependencies

2015-04-03 Thread Russell King - ARM Linux
On Fri, Apr 03, 2015 at 03:27:40PM +0200, Geert Uytterhoeven wrote:
 On Fri, Apr 3, 2015 at 2:57 PM, Dan Carpenter dan.carpen...@oracle.com 
 wrote:
  + error = clk_register_clkdev(clk, bsc-con_id, bsc-dev_id);
  + if (error)
  + pr_err(Failed to register clock %s (%d)\n, bsc-clk, 
  error);
  + return error;
 
  Missing curly braces.  Also it's weird that don't we need a clk_put()
  on the error patch as well as the success path?
 
 Thanks!
 
 So it worked only by accident: with the new per-user struct clk instances
 clk_put() must not be called if clk_register_clkdev() succeeded.

Yes, that's because the per-user struct clk messed quite a lot of things
up - the patches were /not/ well tested before they went in.

That's no excuse to work around the breakage they caused though.

That said, I never did post the work I did earlier this month to fix the
problems in clkdev which those patches caused... so, I guess it's time
to post them and rush them in for the 4.1 merge window...  (frankly, the
per-user struct clk patches should've been reverted.)

-- 
FTTC broadband for 0.8mile line: currently at 10.5Mbps down 400kbps up
according to speedtest.net.
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] staging:rtl8192e: Change printk statements in rtllib_tx.c to use netdev_dev

2015-04-03 Thread Nicholas Krause


On April 3, 2015 1:05:59 PM EDT, Greg KH gre...@linuxfoundation.org wrote:
On Fri, Apr 03, 2015 at 11:49:57AM -0400, Nicholas Krause wrote:
 
 
 On April 3, 2015 5:19:55 AM EDT, Dan Carpenter
dan.carpen...@oracle.com wrote:
 
  @@ -582,7 +582,7 @@ int rtllib_xmit_inter(struct sk_buff *skb,
struct
 net_device *dev)
   IEEE_SOFTMAC_TX_QUEUE)) ||
   ((!ieee-softmac_data_hard_start_xmit 
   (ieee-softmac_features  IEEE_SOFTMAC_TX_QUEUE {
  - printk(KERN_WARNING %s: No xmit handler.\n,
  + netdev_info(ieee-dev, %s: No xmit handler.\n,
 
 
 This should be netdev_warn().  There are a few other similar places.
 
 regards,
 dan carpenter
 My bad will send in a v2 fixing this. 

Please don't, I'm not going to be taking patches from you any _year_
soon.

sorry,

greg k-h
Very well then I guess you seem to not trust me no matter how hard I try.  
Therefore I will avoid helping out in any subsystems you are a maintainer of. 
Nick 
-- 
Sent from my Android device with K-9 Mail. Please excuse my brevity.
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH/RFC 0/6] staging: board: armadillo800eva: Board staging for sh_mobile_lcdc_fb

2015-04-03 Thread Laurent Pinchart
Hello Geert,

Thank you for the patches.

On Friday 03 April 2015 14:41:57 Geert Uytterhoeven wrote:
   Hi all,
 
 This RFC patch series adds board staging support for r8a7740/armadillo.
 For now this supports only the frame buffer device for the on-board LCD.

I've started adding DT support to the shmob-lcdc driver, but I have no board 
to test it on. My Armadillo is gone, and KZM9G is unusable with DT + LCDC at 
the moment as the LCDC interrupt is connected to the legacy interrupt 
controller only, not the GIC. Would you be able to test a patch set ? And if 
you want to implement support for the KZM9G legacy interrupt controller in DT, 
please go for it :-)

 The goal is to complete the move to ARM multiplatform kernels for all
 shmobile platforms, and drop the existing board files
 (arch/arm/mach-shmobile/board-*).
 
 The board staging area was introduced last year to allow continuous
 upstream in-tree development and integration of platform devices. It
 helps developers integrate devices as platform devices for device
 drivers that only provide platform device bindings.  This in turn allows
 for incremental development of both hardware feature support and DT
 binding work in parallel.
 
 This series consists of 4 parts:
   - Patch 1 re-enables compilation of the board staging area, which was
 disabled after a compile breakage, but has been fixed in the mean
 time,
   - Path 2 moves initialization of staging board code to an earlier
 moment, as currently it happens after unused PM domains are powered
 down,
   - Patches 3 and 4 (hopefully) fix the existing kzm9d board staging
 code, which was presumably broken by commit 9a1091ef0017c40a
 (irqchip: gic: Support hierarchy irq domain.),
   - Patches 5 and 6 add support for registering platform devices with
 complex dependencies (clocks, pinctrl, gpios, PM domains), and add
 armadillo board staging code for enabling a frame buffer on the
 on-board LCD.
 
 Questions:
   - Are there other devices from board-armadillo.c that work fine in
 armadillo-legacy, and that we want to add?
 I think this is the list of devices lacking DT support and/or
 missing in DTS:
   - renesas_usbhs (does this work? the platform device is
   instantiated conditionally, but the condition (gpio state) is
   never true?)
   - sh-mobile-hdmi/sh_mobile_lcdc_fb.1 (this seems to be broken in
   -legacy?)

HDMI is broken in legacy, we can thus drop it.

   - sdhi1 (we do have sdhi0)
   - mmcif
   - soc-camera-pdrv/sh_mobile_ceu
   - ipmmu
   - sh-dma-engine (this will probably never get DT support)
 
   - What about support for other boards (kzm9g, bockw, marzen)?

At this point it becomes a budget question, we can certainly port them to DT, 
but it might not make sense to spend time on that. I'll let Magnus chime in.

 This was tested on r8a7740/armadillo.
 This was not tested on emev2/kzm9d, due to lack of hardware.
 
 Thanks for your comments!
 
 Geert Uytterhoeven (6):
   Revert staging: board: disable as it breaks the build
   [RFC] staging: board: Initialize staging board code earlier
   [RFC] staging: board: Add support for translating hwirq to virq numbers
   [RFC] staging: board: kzm9d: Translate hwirq numbers to virq numbers
   [RFC] staging: board: Add support for devices with complex dependencies
   [RFC] staging: board: armadillo800eva: Board staging for sh_mobile_lcdc_fb
 
  drivers/staging/board/Kconfig   |   1 -
  drivers/staging/board/Makefile  |   3 +-
  drivers/staging/board/armadillo800eva.c | 124 
  drivers/staging/board/board.c   | 142 +
  drivers/staging/board/board.h   |  38 -
  drivers/staging/board/kzm9d.c   |  10 ++-
  6 files changed, 313 insertions(+), 5 deletions(-)
  create mode 100644 drivers/staging/board/armadillo800eva.c

-- 
Regards,

Laurent Pinchart

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


Re: [PATCH] Staging: rtl8188eu: Remove zero testing pointer typed value

2015-04-03 Thread Joe Perches
On Fri, 2015-04-03 at 19:51 +0300, Dan Carpenter wrote:
 On Fri, Apr 03, 2015 at 10:12:11PM +0530, Amitoj Kaur Chawla wrote:
  Removes variable comparison with 0 by using !. 
 
 Sometimes testing for zero makes sense.
 When you write code, you are
 telling a story.  If you are talking about zero as a number then it
 can make sense.  If it's zero as a boolean then it doesn't make sense.

Very true.

 Also strcmp() and similar should always be done as == 0,  0 or != 0
 because that is the idiom:

Less true.

When testing for equality, !strcmp is very common.

There are ~2500 uses of !strcmp in the kernel tree vs
~1500 uses of strcmp() == or !=


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


Re: [PATCH] Staging: rtl8188eu: Remove zero testing pointer typed value

2015-04-03 Thread Amitoj Kaur Chawla
On Fri, Apr 3, 2015 at 10:21 PM, Dan Carpenter dan.carpen...@oracle.com wrote:

 On Fri, Apr 03, 2015 at 10:12:11PM +0530, Amitoj Kaur Chawla wrote:
  Removes variable comparison with 0 by using !.

 Sometimes testing for zero makes sense.  When you write code, you are
 telling a story.  If you are talking about zero as a number then it
 can make sense.  If it's zero as a boolean then it doesn't make sense.

 Also strcmp() and similar should always be done as == 0,  0 or != 0
 because that is the idiom:

 if name != foo then

 becomes:

 if (strcmpt(name, foo) != 0) {

 The != from the first is shifted in the second.

 So I don't really think this approach is the right thing.  You have to
 read the code and understand the story it is telling.  Then change it
 if needed.


Thank you for the advice! I will look into it!

-- 
Regards,

Amitoj Kaur Chawla
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] staging: lustre: replace kzalloc with copy_from_user with memdup_user

2015-04-03 Thread Drokin, Oleg
Hello!

On Apr 2, 2015, at 6:18 AM, Julia Lawall wrote:

 Julia, I wonder if you happen to have a bunch of other patches to get rid of 
 the rest of OBD_ALLOC and OBD_FREE stuff by any chance?
 I can generate them again, but I wasn't clear on what was wanted.  I would
 really prefer something where it is explicit at the call site that an
 assignment is taking place.  If we can have x = obd_alloc(...) and
 obd_free(x,...) (I don't have time to look up the exact arguments at the
 moment), then I can take care of that).  I still think it is too bad that
 this code won't benefit from rules written for more generic memory
 allocation functions, but if the extra debugging facility provided by
 these functions is useful, then I guess it is reasonable to keep it.

Like I mentioned sometime last year - it's now pretty easy to replace the 
memleak
detection with other in-kernel mechanisms some of which are in fact even better
than what we have. And considering our mechanisms are totally broken now by the 
mixup of
wrapped vs nonwrapped allocation/freeing - there's no point in holding to it 
remaining at all.
The only last bit of useful functionality left, I imagine, is the ability to 
redirect allocation
to regular kmalloc or to vmalloc based on the allocation size (there's kvfree 
already for the
freeing part of it).
Other than that the wrappers could go away at any time now, I think.

Bye,
Oleg
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] Staging: rtl8188eu: Remove zero testing pointer typed value

2015-04-03 Thread Dan Carpenter
On Fri, Apr 03, 2015 at 10:01:10AM -0700, Joe Perches wrote:
 On Fri, 2015-04-03 at 19:51 +0300, Dan Carpenter wrote:
  Also strcmp() and similar should always be done as == 0,  0 or != 0
  because that is the idiom:
 
 Less true.
 
 When testing for equality, !strcmp is very common.
 
 There are ~2500 uses of !strcmp in the kernel tree vs
 ~1500 uses of strcmp() == or !=

Bugs with reversed strcmp() tests are almost always caught in testing so
it's not an issue.  But == 0 is more correct.  ;)

1)  It's more clear when read in English.  if not strcmp then or
if strcmp NOT EQUAL zero.  In the second one I've emphasized the
NOT EQUAL because the strings are not eqaul.

2)  Also if works for the other compares too.

if (strcmp(x, y)  0)  -- means x is less than y.
if (strcmp(x, y) == 0) -- means x == y.

regards,
dan carpenter
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH/RFC 0/6] staging: board: armadillo800eva: Board staging for sh_mobile_lcdc_fb

2015-04-03 Thread Geert Uytterhoeven
Hi Laurent,

On Fri, Apr 3, 2015 at 6:24 PM, Laurent Pinchart
laurent.pinch...@ideasonboard.com wrote:
 On Friday 03 April 2015 14:41:57 Geert Uytterhoeven wrote:
 This RFC patch series adds board staging support for r8a7740/armadillo.
 For now this supports only the frame buffer device for the on-board LCD.

 I've started adding DT support to the shmob-lcdc driver, but I have no board
 to test it on. My Armadillo is gone, and KZM9G is unusable with DT + LCDC at
 the moment as the LCDC interrupt is connected to the legacy interrupt
 controller only, not the GIC. Would you be able to test a patch set ? And if

Sure, I can test your patches on Armadillo.

 you want to implement support for the KZM9G legacy interrupt controller in DT,
 please go for it :-)

Do we need the LCDC interrupt? ;-)

Anyway, the display of my kzm9g is broken, so I never had the joy of
seeing its marvellous graphics.

   - sh-mobile-hdmi/sh_mobile_lcdc_fb.1 (this seems to be broken in
   -legacy?)

 HDMI is broken in legacy, we can thus drop it.

In addition, clk-r8a7740 lacks support for the non-standard register layout of
HDMICKCR.

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- ge...@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say programmer or something like that.
-- Linus Torvalds
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] staging:rtl8192e: Change printk statements in rtllib_tx.c to use netdev_dev

2015-04-03 Thread Nicholas Krause


On April 3, 2015 2:30:01 PM EDT, Greg KH gre...@linuxfoundation.org wrote:
On Fri, Apr 03, 2015 at 02:05:11PM -0400, Nicholas Krause wrote:
 
 
 On April 3, 2015 1:05:59 PM EDT, Greg KH gre...@linuxfoundation.org
wrote:
 On Fri, Apr 03, 2015 at 11:49:57AM -0400, Nicholas Krause wrote:
  
  
  On April 3, 2015 5:19:55 AM EDT, Dan Carpenter
 dan.carpen...@oracle.com wrote:
  
   @@ -582,7 +582,7 @@ int rtllib_xmit_inter(struct sk_buff *skb,
 struct
  net_device *dev)
 IEEE_SOFTMAC_TX_QUEUE)) ||
 ((!ieee-softmac_data_hard_start_xmit 
 (ieee-softmac_features  IEEE_SOFTMAC_TX_QUEUE {
   -  printk(KERN_WARNING %s: No xmit handler.\n,
   +  netdev_info(ieee-dev, %s: No xmit handler.\n,
  
  
  This should be netdev_warn().  There are a few other similar
places.
  
  regards,
  dan carpenter
  My bad will send in a v2 fixing this. 
 
 Please don't, I'm not going to be taking patches from you any _year_
 soon.
 
 sorry,
 
 greg k-h
 Very well then I guess you seem to not trust me no matter how hard I
 try.  Therefore I will avoid helping out in any subsystems you are a
 maintainer of. 

You have not tried at all.  You submit patches that don't even apply
(like this one), are incorrect, or wrong in some other way.

You activly take up the time and energy of people who are contributing
to the kernel, that is why you were banned from vger.kernel.org.  You
also, when offered a way to learn and redeem yourself, ignored it, and
did something else.

What would you do with someone like youself if you were in our shoes?

back into my kill-file you go...

greg k-h
I checked this applied against Linus's and it did.  Was this suppose to be 
against another tree. 
Nick

-- 
Sent from my Android device with K-9 Mail. Please excuse my brevity.
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH] staging: fbtft: 80 characters per line in fb_ili9163.c

2015-04-03 Thread Andreas Theodosiou
This is a patch to the fb_ili9163.c file that inserts a line break in
line #92 to make the line fit into the 80 character limit.

Signed-off-by: Andreas Theodosiou andreas...@gmail.com
---
 drivers/staging/fbtft/fb_ili9163.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/fbtft/fb_ili9163.c 
b/drivers/staging/fbtft/fb_ili9163.c
index ed92a64..fc7568b 100644
--- a/drivers/staging/fbtft/fb_ili9163.c
+++ b/drivers/staging/fbtft/fb_ili9163.c
@@ -89,7 +89,8 @@
 
 /*
 This display:
-http://www.ebay.com/itm/Replace-Nokia-5110-LCD-1-44-Red-Serial-128X128-SPI-Color-TFT-LCD-Display-Module-/271422122271
+http://www.ebay.com/itm/Replace-Nokia-5110-LCD-1-44-Red-Serial-128X128-SPI-
+Color-TFT-LCD-Display-Module-/271422122271
 This particular display has a design error! The controller has 3 pins to
 configure to constrain the memory and resolution to a fixed dimension (in
 that case 128x128) but they leaved those pins configured for 128x160 so
-- 
2.3.5

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


Re: [PATCH] staging: fbtft: 80 characters per line in fb_ili9163.c

2015-04-03 Thread Giedrius Statkevičius
On Sat, 4 Apr 2015, Andreas Theodosiou wrote:

 This is a patch to the fb_ili9163.c file that inserts a line break in
 line #92 to make the line fit into the 80 character limit.
 
 Signed-off-by: Andreas Theodosiou andreas...@gmail.com
 ---
  drivers/staging/fbtft/fb_ili9163.c | 3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)
 
 diff --git a/drivers/staging/fbtft/fb_ili9163.c 
 b/drivers/staging/fbtft/fb_ili9163.c
 index ed92a64..fc7568b 100644
 --- a/drivers/staging/fbtft/fb_ili9163.c
 +++ b/drivers/staging/fbtft/fb_ili9163.c
 @@ -89,7 +89,8 @@
  
  /*
  This display:
 -http://www.ebay.com/itm/Replace-Nokia-5110-LCD-1-44-Red-Serial-128X128-SPI-Color-TFT-LCD-Display-Module-/271422122271
 +http://www.ebay.com/itm/Replace-Nokia-5110-LCD-1-44-Red-Serial-128X128-SPI-
 +Color-TFT-LCD-Display-Module-/271422122271

With this change the user won't be able to just simply click on the url and have
it open for him. Thus I don't think this is a good change. Sometimes in the
kernel people leave lines over 80 characters to make the code more grep-able,
sometimes it's just more clear when it's over 80 characters or, probably, in
cases like this.

Su pagarba / Regards,
Giedrius
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] staging: fbtft: 80 characters per line in fb_ili9163.c

2015-04-03 Thread Joe Perches
On Sat, 2015-04-04 at 03:23 +0300, Andreas Theodosiou wrote:
 This is a patch to the fb_ili9163.c file that inserts a line break in
 line #92 to make the line fit into the 80 character limit.
[]
 diff --git a/drivers/staging/fbtft/fb_ili9163.c 
 b/drivers/staging/fbtft/fb_ili9163.c
[]
 @@ -89,7 +89,8 @@
  
  /*
  This display:
 -http://www.ebay.com/itm/Replace-Nokia-5110-LCD-1-44-Red-Serial-128X128-SPI-Color-TFT-LCD-Display-Module-/271422122271
 +http://www.ebay.com/itm/Replace-Nokia-5110-LCD-1-44-Red-Serial-128X128-SPI-
 +Color-TFT-LCD-Display-Module-/271422122271

Please don't do this to links.

There are many real defects to fix and other code to improve.

This isn't one of those.

I doubt though that an ebay link is very long lasting.


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


[PATCH V3 0/2] Fix some issues of staging ion test driver

2015-04-03 Thread Phong Tran
Hi Greg,

I resend 2 patches
(1) add the remove() platform driver callback to
deregister the misc device
(2) unregister platform device when driver is unloaded

Changes from v2:
Remove the extra space of patch (1)

Changes from v1:
Imporve the coding style

Phong Tran (2):
  (1) staging: android: ion_test: unregister the misc device
  (2) staging: android: ion_test: unregister the platform device

 drivers/staging/android/ion/ion_test.c | 20 +++-
 1 file changed, 19 insertions(+), 1 deletion(-)

-- 
2.1.0

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


Re: [PATCH/RFC 5/6] staging: board: Add support for devices with complex dependencies

2015-04-03 Thread Geert Uytterhoeven
On Fri, Apr 3, 2015 at 2:57 PM, Dan Carpenter dan.carpen...@oracle.com wrote:
 + error = clk_register_clkdev(clk, bsc-con_id, bsc-dev_id);
 + if (error)
 + pr_err(Failed to register clock %s (%d)\n, bsc-clk, error);
 + return error;

 Missing curly braces.  Also it's weird that don't we need a clk_put()
 on the error patch as well as the success path?

Thanks!

So it worked only by accident: with the new per-user struct clk instances
clk_put() must not be called if clk_register_clkdev() succeeded.

Will call clk_put() only if it failed.

 +
 + clk_put(clk);
 + return 0;

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- ge...@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say programmer or something like that.
-- Linus Torvalds
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] Staging: rtl8188eu: Replaced kzalloc and memcpy combination with kmemdup

2015-04-03 Thread gre...@linuxfoundation.org
On Mon, Mar 30, 2015 at 03:11:25PM +, Dhere, Chaitanya (C.) wrote:
 This change was detected with the help of coccinelle tool.
 It performs the same function as kzalloc amd memcpy.
 
 Signed-off-by: Chaitanya Dhere cvija...@visteon.com

Your From: line and this line don't match :(

 ---
  drivers/staging/rtl8188eu/core/rtw_mlme_ext.c | 5 ++---
  1 file changed, 2 insertions(+), 3 deletions(-)
 
 diff --git a/drivers/staging/rtl8188eu/core/rtw_mlme_ext.c 
 b/drivers/staging/rtl8188eu/core/rtw_mlme_ext.c
 index 86d955f..07ae6cf 100644
 --- a/drivers/staging/rtl8188eu/core/rtw_mlme_ext.c
 +++ b/drivers/staging/rtl8188eu/core/rtw_mlme_ext.c
 @@ -5431,15 +5431,14 @@ u8 set_tx_beacon_cmd(struct adapter *padapter)
   goto exit;
   }
  
 - ptxBeacon_parm = kzalloc(sizeof(struct wlan_bssid_ex), GFP_KERNEL);
 + ptxBeacon_parm = kmemdup((pmlmeinfo-network),
 +  sizeof(struct wlan_bssid_ex), GFP_KERNEL);
   if (ptxBeacon_parm == NULL) {
   kfree(ph2c);
   res = _FAIL;
   goto exit;
   }
  
 - memcpy(ptxBeacon_parm, (pmlmeinfo-network), sizeof(struct 
 wlan_bssid_ex));
 -
   len_diff = update_hidden_ssid(ptxBeacon_parm-IEs+_BEACON_IE_OFFSET_,
 
 ptxBeacon_parm-IELength-_BEACON_IE_OFFSET_,
 pmlmeinfo-hidden_ssid_mode);
 -- 
 1.9.1

This patch fails to apply for some odd reason, the patch seems
corrupted.  Please look into your email client settings and try it
again.

thanks,

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


[PATCH V3 2/2] staging: android: ion_test: unregister the platform device

2015-04-03 Thread Phong Tran
The driver has to unregister from platform device when it's unloaded

Signed-off-by: Phong Tran tranmanph...@gmail.com
---
 drivers/staging/android/ion/ion_test.c | 8 +++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/android/ion/ion_test.c 
b/drivers/staging/android/ion/ion_test.c
index 052d5e2..7d6e6b6 100644
--- a/drivers/staging/android/ion/ion_test.c
+++ b/drivers/staging/android/ion/ion_test.c
@@ -272,6 +272,7 @@ static int ion_test_remove(struct platform_device *pdev)
return misc_deregister(testdev-misc);
 }
 
+static struct platform_device *ion_test_pdev;
 static struct platform_driver ion_test_platform_driver = {
.remove = ion_test_remove,
.driver = {
@@ -281,13 +282,18 @@ static struct platform_driver ion_test_platform_driver = {
 
 static int __init ion_test_init(void)
 {
-   platform_device_register_simple(ion-test, -1, NULL, 0);
+   ion_test_pdev = platform_device_register_simple(ion-test,
+   -1, NULL, 0);
+   if (!ion_test_pdev)
+   return -ENODEV;
+
return platform_driver_probe(ion_test_platform_driver, ion_test_probe);
 }
 
 static void __exit ion_test_exit(void)
 {
platform_driver_unregister(ion_test_platform_driver);
+   platform_device_unregister(ion_test_pdev);
 }
 
 module_init(ion_test_init);
-- 
2.1.0

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


[PATCH V3 1/2] staging: android: ion_test: unregister the misc device

2015-04-03 Thread Phong Tran
Add the remove() method for deregister from misc device
when it's unloaded.

Signed-off-by: Phong Tran tranmanph...@gmail.com
---
 drivers/staging/android/ion/ion_test.c | 12 
 1 file changed, 12 insertions(+)

diff --git a/drivers/staging/android/ion/ion_test.c 
b/drivers/staging/android/ion/ion_test.c
index 3bc461c..052d5e2 100644
--- a/drivers/staging/android/ion/ion_test.c
+++ b/drivers/staging/android/ion/ion_test.c
@@ -261,7 +261,19 @@ static int __init ion_test_probe(struct platform_device 
*pdev)
return 0;
 }
 
+static int ion_test_remove(struct platform_device *pdev)
+{
+   struct ion_test_device *testdev;
+
+   testdev = platform_get_drvdata(pdev);
+   if (!testdev)
+   return -ENODATA;
+
+   return misc_deregister(testdev-misc);
+}
+
 static struct platform_driver ion_test_platform_driver = {
+   .remove = ion_test_remove,
.driver = {
.name = ion-test,
},
-- 
2.1.0

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