Re: On Lindent shortcomings and massive style fixing

2015-12-28 Thread Mauro Carvalho Chehab
Em Mon, 28 Dec 2015 07:33:32 -0800
Greg KH  escreveu:

> On Mon, Dec 28, 2015 at 04:33:27PM +0200, Andrey Utkin wrote:
> > After some iterations of checkpatch.pl, on a new developed driver
> > (tw5864), now I have the following:
> > 
> >  $ grep 'WARNING\|ERROR' /src/checkpatch.tw5864 | sort | uniq -c
> >  31 ERROR: do not use C99 // comments
> > 147 WARNING: Block comments use a trailing */ on a separate line
> > 144 WARNING: Block comments use * on subsequent lines
> > 435 WARNING: line over 80 characters
> > 
> > At this point, Lindent was already used, and checkpatch.pl warnings
> > introduced by Lindent itself were fixed. Usage of "indent
> > --linux-style" (which behaves differently BTW) doesn't help anymore,
> > too.
> > 
> > Could anybody please advise how to sort out these issues
> > automatically, because they look like perfectly solvable in automated
> > fashion. Of course manual work would result in more niceness, but I am
> > not eager to go through hundreds of place of code just to fix "over 80
> > characters" issues now.
> 
> Shouldn't take very long to do so, all of the above can be fixed in less
> than a day's worth of work manually.  Or you can use indent to fix up
> the line length issues, but watch out for the results, sometimes it's
> better to refactor the code than to just blindly accept the output of
> that tool.

Yeah, on my experience, letting indent to break long lines end do be
a disaster with require more time to manually fix the driver, than using
some editor that shows the 80 cols break (like kate) and fix the lines
manually. IMHO, there are two problems by letting indent breaking long
lines:

1) indent would break strings on printks. This is something that we don't
want to break strings on multiple lines in the Kernel;

2) It doesn't actually solve the problem of having too complex loops,
with is why the 80 columns warning is meant to warn. Worse than that,
if a piece of code is inside more than 4 or 5 indentation levels, the
resulting code of using indent for 80-cols line break is a total crap.

That's said, on a quick look at the driver, it seems that the 80-cols
violations are mostly (if not all) on the comments, like:

int i_poc_lsb = (frame_seqno_in_gop << 1); /* why multiplied by two? 
TODO try without multiplication */

and

#define TW5864_UNDEF_REG_0x0224 0x0224  /* Undeclared in spec (or not yet added 
to tw5864-reg.h) but used */
#define TW5864_UNDEF_REG_0x4014 0x4014  /* Undeclared in spec (or not yet added 
to tw5864-reg.h) but used */
#define TW5864_UNDEF_REG_0xA800 0xA800  /* Undeclared in spec (or not yet added 
to tw5864-reg.h) but used */

Btw, the content of tw5864-reg-undefined.h is weird... Why not just
add the stuff there at tw5864-reg.h and remove the comments for all
defines there?

Also, Lindent already did some crappy 80-cols like breaks, like:

static int pci_i2c_multi_read(struct tw5864_dev *dev, u8 devid, u8 devfn, u8 
*buf,
   u32 count)

(count is misaligned with the open parenthesis)

and:
val =
(1 << 24) + ((devid & 0xfe) << 16) + (buf[i * 2 + 0] << 8) +
buf[i * 2 + 1];

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


RE: [PATCH RESEND v2 1/1] fix a dead loop when in heavy low memory

2015-12-28 Thread Zhang, Tianfei
> However, it appears that the same process, dTi-lm, is still chosen for oom 
> kill
> because lowmem_deathpending_timeout has expired.
> 
> So this looks like a problem if the constantly chosen process cannot exit.
> It would have been helpful to have the stack of pid 27289 in the log to see
> where it was stuck.  But I think it may be unrelated to
> lowmem_deathpending_timeout itself.  We'd be better off selecting a
> different process to kill with something like this:
> 
> diff --git a/drivers/staging/android/lowmemorykiller.c
> b/drivers/staging/android/lowmemorykiller.c
> --- a/drivers/staging/android/lowmemorykiller.c
> +++ b/drivers/staging/android/lowmemorykiller.c
> @@ -128,11 +128,15 @@ static unsigned long lowmem_scan(struct shrinker
> *s, struct shrink_control *sc)
>   if (!p)
>   continue;
> 
> - if (test_tsk_thread_flag(p, TIF_MEMDIE) &&
> - time_before_eq(jiffies, lowmem_deathpending_timeout)) {
> - task_unlock(p);
> - rcu_read_unlock();
> - return 0;
> + if (test_tsk_thread_flag(p, TIF_MEMDIE)) {
> + if (time_before_eq(jiffies,
> +lowmem_deathpending_timeout)) {
> + task_unlock(p);
> + rcu_read_unlock();
> + return 0;
> + }
> + /* Need to select a different process to kill */
> + continue;
>   }
>   oom_score_adj = p->signal->oom_score_adj;
>   if (oom_score_adj < min_score_adj) {
> 
> But we need more information.  Please make sure that
> lowmem_debug_level is 1, try to get a complete kernel log, and if possible
> please try to capture the stack of the process that can't exit (use
> /proc//stack) before trying the above patch.

Hi Rientjes:
I re-test the monkey stress test on your patches, it seems better than current 
mainline code.

The kernel log is a little big, more than 10 MB. I send to you directly.

Best
tianfei





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


[PATCH RESEND] staging/slicoss: Use ethtool_ops instead of module_param.

2015-12-28 Thread Kevin Wern
ethtool_ops has attributes in sub struct ethtool_coalesce that
correspond to the parameters intagg_delay and dynamic_intagg. It is
preferable to set these properties with ethtool rather than
module_param, so create these attributes in adapter and set them using
ethtool_coalesce's rx_coalesce_usecs and rx_use_adaptive_coalesce.
(Outlined in TODO file)

Signed-off-by: Kevin Wern 
---

- Assigned net_dev->ethtool_ops pointer to slic_ethtool_ops.
- Fixed typo where slic_get_coalesce was used twice.

 drivers/staging/slicoss/slic.h|  2 ++
 drivers/staging/slicoss/slicoss.c | 41 +--
 2 files changed, 33 insertions(+), 10 deletions(-)

diff --git a/drivers/staging/slicoss/slic.h b/drivers/staging/slicoss/slic.h
index c95b3ab..cc0afee 100644
--- a/drivers/staging/slicoss/slic.h
+++ b/drivers/staging/slicoss/slic.h
@@ -478,6 +478,8 @@ struct adapter {
u32 max_isr_xmits;
u32 rcv_interrupt_yields;
u32 intagg_period;
+   u32 intagg_delay;
+   u32 dynamic_intagg;
struct inicpm_state*inicpm_info;
void *pinicpm_info;
struct slic_ifevents  if_events;
diff --git a/drivers/staging/slicoss/slicoss.c 
b/drivers/staging/slicoss/slicoss.c
index b23a2d1..c490b71 100644
--- a/drivers/staging/slicoss/slicoss.c
+++ b/drivers/staging/slicoss/slicoss.c
@@ -102,8 +102,7 @@ static char *slic_banner = "Alacritech SLIC Technology(tm) 
Server and Storage Ac
 static char *slic_proc_version = "2.0.351  2006/07/14 12:26:00";
 
 static struct base_driver slic_global = { {}, 0, 0, 0, 1, NULL, NULL };
-static int intagg_delay = 100;
-static u32 dynamic_intagg;
+#define DEFAULT_INTAGG_DELAY 100
 static unsigned int rcv_count;
 
 #define DRV_NAME  "slicoss"
@@ -119,17 +118,14 @@ MODULE_AUTHOR(DRV_AUTHOR);
 MODULE_DESCRIPTION(DRV_DESCRIPTION);
 MODULE_LICENSE("Dual BSD/GPL");
 
-module_param(dynamic_intagg, int, 0);
-MODULE_PARM_DESC(dynamic_intagg, "Dynamic Interrupt Aggregation Setting");
-module_param(intagg_delay, int, 0);
-MODULE_PARM_DESC(intagg_delay, "uSec Interrupt Aggregation Delay");
-
 static const struct pci_device_id slic_pci_tbl[] = {
{ PCI_DEVICE(PCI_VENDOR_ID_ALACRITECH, SLIC_1GB_DEVICE_ID) },
{ PCI_DEVICE(PCI_VENDOR_ID_ALACRITECH, SLIC_2GB_DEVICE_ID) },
{ 0 }
 };
 
+static struct ethtool_ops slic_ethtool_ops;
+
 MODULE_DEVICE_TABLE(pci, slic_pci_tbl);
 
 static inline void slic_reg32_write(void __iomem *reg, u32 value, bool flush)
@@ -2860,7 +2856,7 @@ static int slic_card_init(struct sliccard *card, struct 
adapter *adapter)
if (slic_global.dynamic_intagg)
slic_intagg_set(adapter, 0);
else
-   slic_intagg_set(adapter, intagg_delay);
+   slic_intagg_set(adapter, adapter->intagg_delay);
 
/*
 *  Initialize ping status to "ok"
@@ -2881,6 +2877,26 @@ card_init_err:
return status;
 }
 
+static int slic_get_coalesce(struct net_device *dev,
+struct ethtool_coalesce *coalesce)
+{
+   struct adapter *adapter = netdev_priv(dev);
+
+   adapter->intagg_delay = coalesce->rx_coalesce_usecs;
+   adapter->dynamic_intagg = coalesce->use_adaptive_rx_coalesce;
+   return 0;
+}
+
+static int slic_set_coalesce(struct net_device *dev,
+struct ethtool_coalesce *coalesce)
+{
+   struct adapter *adapter = netdev_priv(dev);
+
+   coalesce->rx_coalesce_usecs = adapter->intagg_delay;
+   coalesce->use_adaptive_rx_coalesce = adapter->dynamic_intagg;
+   return 0;
+}
+
 static void slic_init_driver(void)
 {
if (slic_first_init) {
@@ -3069,8 +3085,6 @@ static int slic_entry_probe(struct pci_dev *pcidev,
struct sliccard *card = NULL;
int pci_using_dac = 0;
 
-   slic_global.dynamic_intagg = dynamic_intagg;
-
err = pci_enable_device(pcidev);
 
if (err)
@@ -3112,12 +3126,14 @@ static int slic_entry_probe(struct pci_dev *pcidev,
goto err_out_exit_slic_probe;
}
 
+   netdev->ethtool_ops = &slic_ethtool_ops;
SET_NETDEV_DEV(netdev, &pcidev->dev);
 
pci_set_drvdata(pcidev, netdev);
adapter = netdev_priv(netdev);
adapter->netdev = netdev;
adapter->pcidev = pcidev;
+   slic_global.dynamic_intagg = adapter->dynamic_intagg;
if (pci_using_dac)
netdev->features |= NETIF_F_HIGHDMA;
 
@@ -3204,5 +3220,10 @@ static void __exit slic_module_cleanup(void)
pci_unregister_driver(&slic_driver);
 }
 
+static struct ethtool_ops slic_ethtool_ops = {
+   .get_coalesce = slic_get_coalesce,
+   .set_coalesce = slic_set_coalesce
+};
+
 module_init(slic_module_init);
 module_exit(slic_module_cleanup);
-- 
1.9.1

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


Re: [PATCH] staging: lustre: fix lock imbalance

2015-12-28 Thread kbuild test robot
[if your patch is applied to the wrong git tree, please drop us a note to help 
improving the system]
Hi Joshua,

[auto build test WARNING on staging/staging-testing]
[also build test WARNING on v4.4-rc6 next-20151223]

url:
https://github.com/0day-ci/linux/commits/Joshua-Clayton/staging-lustre-fix-lock-imbalance/20151227-131137
config: x86_64-allyesconfig (attached as .config)
reproduce:
# save the attached .config to linux build tree
make ARCH=x86_64 

All warnings (new ones prefixed by >>):

   drivers/staging/lustre/lustre/ptlrpc/nrs.c: In function 
'nrs_resource_put_safe':
>> drivers/staging/lustre/lustre/ptlrpc/nrs.c:485:21: warning: unused variable 
>> 'nrs' [-Wunused-variable]
 struct ptlrpc_nrs *nrs = NULL;
^

vim +/nrs +485 drivers/staging/lustre/lustre/ptlrpc/nrs.c

d7e09d039 Peng Tao 2013-05-02  469  nrs_policy_put(primary);
d7e09d039 Peng Tao 2013-05-02  470  }
d7e09d039 Peng Tao 2013-05-02  471  }
d7e09d039 Peng Tao 2013-05-02  472  
d7e09d039 Peng Tao 2013-05-02  473  /**
d7e09d039 Peng Tao 2013-05-02  474   * Releases references to resource 
hierarchies and policies, because they are no
d7e09d039 Peng Tao 2013-05-02  475   * longer required; used when request 
handling has been completed, or the
d7e09d039 Peng Tao 2013-05-02  476   * request is moving to the high priority 
NRS head.
d7e09d039 Peng Tao 2013-05-02  477   *
d7e09d039 Peng Tao 2013-05-02  478   * \param resp  the resource hierarchy 
that is being released
d7e09d039 Peng Tao 2013-05-02  479   *
d7e09d039 Peng Tao 2013-05-02  480   * \see ptlrpc_nrs_req_finalize()
d7e09d039 Peng Tao 2013-05-02  481   */
d7e09d039 Peng Tao 2013-05-02  482  static void nrs_resource_put_safe(struct 
ptlrpc_nrs_resource **resp)
d7e09d039 Peng Tao 2013-05-02  483  {
d7e09d039 Peng Tao 2013-05-02  484  struct ptlrpc_nrs_policy 
*pols[NRS_RES_MAX];
d7e09d039 Peng Tao 2013-05-02 @485  struct ptlrpc_nrs *nrs = NULL;
d7e09d039 Peng Tao 2013-05-02  486  int i;
d7e09d039 Peng Tao 2013-05-02  487  
d7e09d039 Peng Tao 2013-05-02  488  for (i = 0; i < NRS_RES_MAX; i++) {
d7e09d039 Peng Tao 2013-05-02  489  if (resp[i] != NULL) {
d7e09d039 Peng Tao 2013-05-02  490  pols[i] = 
resp[i]->res_policy;
d7e09d039 Peng Tao 2013-05-02  491  
nrs_resource_put(resp[i]);
d7e09d039 Peng Tao 2013-05-02  492  resp[i] = NULL;
d7e09d039 Peng Tao 2013-05-02  493  } else {

:: The code at line 485 was first introduced by commit
:: d7e09d0397e84eefbabfd9cb353221f3c6448d83 staging: add Lustre file system 
client support

:: TO: Peng Tao 
:: CC: Greg Kroah-Hartman 

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


.config.gz
Description: Binary data
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


RE: [PATCH RESEND v2 1/1] fix a dead loop when in heavy low memory

2015-12-28 Thread Zhang, Tianfei
> >
> > Signed-off-by: Figo Zhang 
> 
> As you ignored my instructions to you, I'm going to just ignore this patch,
> sorry.  Now discarded.
> 
I am no at intel kernel group (SSG OTC), I am at CCG CCE. I will involve the 
intel open source guys if they like to help.


Hi fengguang:

Would you like to help review or involve the related intel guys? This issue can 
reproduce on android devices, I think
This current upstream code maybe some problem. Your technical comments are 
welcome.

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


[PATCH 2/2] staging: wilc1000: wilc_parse_network_info refactoring

2015-12-28 Thread Ivan Safonov
1) Return value of this function does not used;
2) wilc_parse_network_info has no reasons to return an error;
3) kfree does not free memory if argument is NULL.

Signed-off-by: Ivan Safonov 
---
 drivers/staging/wilc1000/coreconfigurator.c | 27 +--
 drivers/staging/wilc1000/coreconfigurator.h |  2 +-
 2 files changed, 6 insertions(+), 23 deletions(-)

diff --git a/drivers/staging/wilc1000/coreconfigurator.c 
b/drivers/staging/wilc1000/coreconfigurator.c
index 2d4d3f1..a36918c 100644
--- a/drivers/staging/wilc1000/coreconfigurator.c
+++ b/drivers/staging/wilc1000/coreconfigurator.c
@@ -458,34 +458,17 @@ s32 wilc_parse_network_info(u8 *pu8MsgBuffer, 
tstrNetworkInfo **ppstrNetworkInfo
 
 /**
  *  @brief  Deallocates the parsed Network Info
- *  @details
  *  @param[in]  pstrNetworkInfo Network Info to be deallocated
- *  @return Error code indicating success/failure
- *  @note
  *  @authormabubakr
  *  @date  1 Mar 2012
- *  @version   1.0
  */
-s32 wilc_dealloc_network_info(tstrNetworkInfo *pstrNetworkInfo)
+void wilc_dealloc_network_info(tstrNetworkInfo *network_info)
 {
-   s32 s32Error = 0;
+   if (!network_info)
+   return;
 
-   if (pstrNetworkInfo) {
-   if (pstrNetworkInfo->pu8IEs) {
-   kfree(pstrNetworkInfo->pu8IEs);
-   pstrNetworkInfo->pu8IEs = NULL;
-   } else {
-   s32Error = -EFAULT;
-   }
-
-   kfree(pstrNetworkInfo);
-   pstrNetworkInfo = NULL;
-
-   } else {
-   s32Error = -EFAULT;
-   }
-
-   return s32Error;
+   kfree(network_info->pu8IEs);
+   kfree(network_info);
 }
 
 /**
diff --git a/drivers/staging/wilc1000/coreconfigurator.h 
b/drivers/staging/wilc1000/coreconfigurator.h
index fc43d04..8c28c6b 100644
--- a/drivers/staging/wilc1000/coreconfigurator.h
+++ b/drivers/staging/wilc1000/coreconfigurator.h
@@ -130,7 +130,7 @@ typedef struct {
 s32 wilc_send_config_pkt(struct wilc *wilc, u8 mode, struct wid *wids,
 u32 count, u32 drv);
 s32 wilc_parse_network_info(u8 *pu8MsgBuffer, tstrNetworkInfo 
**ppstrNetworkInfo);
-s32 wilc_dealloc_network_info(tstrNetworkInfo *pstrNetworkInfo);
+void wilc_dealloc_network_info(tstrNetworkInfo *network_info);
 
 s32 wilc_parse_assoc_resp_info(u8 *pu8Buffer, u32 u32BufferLen,
   tstrConnectRespInfo **ppstrConnectRespInfo);
-- 
2.4.10

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


Re: [PATCH v2 1/1] fix a dead loop when in heavy low memory

2015-12-28 Thread Harald Arnesen
Greg KH [2015-12-26 19:12]:

> I need a "full" name here, not a "short" name, sorry, before I can do
> anything with this patch.

I don't know if that is the case here, but:

You know, of course, that there are societies in this world  where only
one name is used?
-- 
Hilsen Harald
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 08/10] staging: fbtft: use to_platform_device()

2015-12-28 Thread Geliang Tang
Use to_platform_device() instead of open-coding it.

Signed-off-by: Geliang Tang 
---
 drivers/staging/fbtft/fbtft_device.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/fbtft/fbtft_device.c 
b/drivers/staging/fbtft/fbtft_device.c
index 071f79b..50d5735 100644
--- a/drivers/staging/fbtft/fbtft_device.c
+++ b/drivers/staging/fbtft/fbtft_device.c
@@ -1305,7 +1305,7 @@ static void pr_spi_devices(void)
 static int p_device_found(struct device *dev, void *data)
 {
struct platform_device
-   *pdev = container_of(dev, struct platform_device, dev);
+   *pdev = to_platform_device(dev);
 
if (strstr(pdev->name, "fb"))
dev_info(dev, "%s id=%d pdata? %s\n", pdev->name, pdev->id,
-- 
2.5.0


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


Re: [PATCH RESEND v2 1/1] fix a dead loop when in heavy low memory

2015-12-28 Thread Greg KH
On Sun, Dec 27, 2015 at 04:34:56PM +0800, Figo.zhang wrote:
> From: Figo 

This doesn't match your signed-off-by name :(

> Signed-off-by: Figo.zhang 


I doubt that you have a '.' in your name :(

Again, please consult the Intel Linux kernel group for how to do this
correctly, I will not accept the patch from you unless you have someone
from that group signed off on it as well.

Just slow down and get it right, don't waste everyone's time here
please.

thanks,

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


[PATCH 2/2] staging: wilc1000: wilc_parse_network_info refactoring

2015-12-28 Thread Ivan Safonov
1. Return value of this function does not used;
2. wilc_parse_network_info has no reasons to return an error;
3. kfree does not free memory if argument is NULL.

Signed-off-by: Ivan Safonov 
---
 drivers/staging/wilc1000/coreconfigurator.c | 27 +--
 drivers/staging/wilc1000/coreconfigurator.h |  2 +-
 2 files changed, 6 insertions(+), 23 deletions(-)

diff --git a/drivers/staging/wilc1000/coreconfigurator.c 
b/drivers/staging/wilc1000/coreconfigurator.c
index 2d4d3f1..a36918c 100644
--- a/drivers/staging/wilc1000/coreconfigurator.c
+++ b/drivers/staging/wilc1000/coreconfigurator.c
@@ -458,34 +458,17 @@ s32 wilc_parse_network_info(u8 *pu8MsgBuffer, 
tstrNetworkInfo **ppstrNetworkInfo
 
 /**
  *  @brief  Deallocates the parsed Network Info
- *  @details
  *  @param[in]  pstrNetworkInfo Network Info to be deallocated
- *  @return Error code indicating success/failure
- *  @note
  *  @authormabubakr
  *  @date  1 Mar 2012
- *  @version   1.0
  */
-s32 wilc_dealloc_network_info(tstrNetworkInfo *pstrNetworkInfo)
+void wilc_dealloc_network_info(tstrNetworkInfo *network_info)
 {
-   s32 s32Error = 0;
+   if (!network_info)
+   return;
 
-   if (pstrNetworkInfo) {
-   if (pstrNetworkInfo->pu8IEs) {
-   kfree(pstrNetworkInfo->pu8IEs);
-   pstrNetworkInfo->pu8IEs = NULL;
-   } else {
-   s32Error = -EFAULT;
-   }
-
-   kfree(pstrNetworkInfo);
-   pstrNetworkInfo = NULL;
-
-   } else {
-   s32Error = -EFAULT;
-   }
-
-   return s32Error;
+   kfree(network_info->pu8IEs);
+   kfree(network_info);
 }
 
 /**
diff --git a/drivers/staging/wilc1000/coreconfigurator.h 
b/drivers/staging/wilc1000/coreconfigurator.h
index fc43d04..8c28c6b 100644
--- a/drivers/staging/wilc1000/coreconfigurator.h
+++ b/drivers/staging/wilc1000/coreconfigurator.h
@@ -130,7 +130,7 @@ typedef struct {
 s32 wilc_send_config_pkt(struct wilc *wilc, u8 mode, struct wid *wids,
 u32 count, u32 drv);
 s32 wilc_parse_network_info(u8 *pu8MsgBuffer, tstrNetworkInfo 
**ppstrNetworkInfo);
-s32 wilc_dealloc_network_info(tstrNetworkInfo *pstrNetworkInfo);
+void wilc_dealloc_network_info(tstrNetworkInfo *network_info);
 
 s32 wilc_parse_assoc_resp_info(u8 *pu8Buffer, u32 u32BufferLen,
   tstrConnectRespInfo **ppstrConnectRespInfo);
-- 
2.4.10

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


[PATCH 0/2] Staging: panel: Fix checkpatch warnings

2015-12-28 Thread Ksenija Stanojevic
Fix checkpatch.pl warnings in panel.c

Signed-off-by: Ksenija Stanojevic 

Ksenija Stanojevic (2):
  Staging: panel: Fix line over 80 characters
  Staging: panel: Remove space

 drivers/staging/panel/panel.c | 8 +---
 1 file changed, 5 insertions(+), 3 deletions(-)

-- 
1.9.1

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


[PATCH 1/2] Staging: goldfish: Add space around that "+"

2015-12-28 Thread shraddha.6596
From: Shraddha Barke 

Fix checkpatch warning of adding space around + in accordance with
kernel coding style.

Signed-off-by: Shraddha Barke 
---
 drivers/staging/goldfish/goldfish_audio.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/goldfish/goldfish_audio.c 
b/drivers/staging/goldfish/goldfish_audio.c
index b0927e4..f1e1838 100644
--- a/drivers/staging/goldfish/goldfish_audio.c
+++ b/drivers/staging/goldfish/goldfish_audio.c
@@ -63,7 +63,7 @@ struct goldfish_audio {
 #define AUDIO_READ(data, addr) (readl(data->reg_base + addr))
 #define AUDIO_WRITE(data, addr, x) (writel(x, data->reg_base + addr))
 #define AUDIO_WRITE64(data, addr, addr2, x)\
-   (gf_write_dma_addr((x), data->reg_base + addr, data->reg_base+addr2))
+   (gf_write_dma_addr((x), data->reg_base + addr, data->reg_base + addr2))
 
 /*
  *  temporary variable used between goldfish_audio_probe() and
-- 
2.1.4

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


[PATCH 2/3] staging: rtl8192u: use to_delayed_work

2015-12-28 Thread Geliang Tang
Use to_delayed_work() instead of open-coding it.

Signed-off-by: Geliang Tang 
---
 drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c | 6 +++---
 drivers/staging/rtl8192u/r8192U_core.c | 3 +--
 drivers/staging/rtl8192u/r8192U_dm.c   | 4 ++--
 drivers/staging/rtl8192u/r819xU_phy.c  | 3 +--
 4 files changed, 7 insertions(+), 9 deletions(-)

diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c 
b/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c
index 38c3eb7..21ee410 100644
--- a/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c
+++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c
@@ -487,7 +487,7 @@ EXPORT_SYMBOL(ieee80211_softmac_scan_syncro);
 
 static void ieee80211_softmac_scan_wq(struct work_struct *work)
 {
-   struct delayed_work *dwork = container_of(work, struct delayed_work, 
work);
+   struct delayed_work *dwork = to_delayed_work(work);
struct ieee80211_device *ieee = container_of(dwork, struct 
ieee80211_device, softmac_scan_wq);
static short watchdog;
u8 channel_map[MAX_CHANNEL_NUMBER+1];
@@ -2330,7 +2330,7 @@ static void ieee80211_start_monitor_mode(struct 
ieee80211_device *ieee)
 static void ieee80211_start_ibss_wq(struct work_struct *work)
 {
 
-   struct delayed_work *dwork = container_of(work, struct delayed_work, 
work);
+   struct delayed_work *dwork = to_delayed_work(work);
struct ieee80211_device *ieee = container_of(dwork, struct 
ieee80211_device, start_ibss_wq);
/* iwconfig mode ad-hoc will schedule this and return
 * on the other hand this will block further iwconfig SET
@@ -2504,7 +2504,7 @@ EXPORT_SYMBOL(ieee80211_disassociate);
 
 static void ieee80211_associate_retry_wq(struct work_struct *work)
 {
-   struct delayed_work *dwork = container_of(work, struct delayed_work, 
work);
+   struct delayed_work *dwork = to_delayed_work(work);
struct ieee80211_device *ieee = container_of(dwork, struct 
ieee80211_device, associate_retry_wq);
unsigned long flags;
 
diff --git a/drivers/staging/rtl8192u/r8192U_core.c 
b/drivers/staging/rtl8192u/r8192U_core.c
index f4a4eae..5ac0893 100644
--- a/drivers/staging/rtl8192u/r8192U_core.c
+++ b/drivers/staging/rtl8192u/r8192U_core.c
@@ -3436,8 +3436,7 @@ static void rtl819x_update_rxcounts(struct r8192_priv 
*priv, u32 *TotalRxBcnNum,
 
 static void rtl819x_watchdog_wqcallback(struct work_struct *work)
 {
-   struct delayed_work *dwork = container_of(work,
- struct delayed_work, work);
+   struct delayed_work *dwork = to_delayed_work(work);
struct r8192_priv *priv = container_of(dwork,
   struct r8192_priv, watch_dog_wq);
struct net_device *dev = priv->ieee80211->dev;
diff --git a/drivers/staging/rtl8192u/r8192U_dm.c 
b/drivers/staging/rtl8192u/r8192U_dm.c
index 375ec96..9b58b1a 100644
--- a/drivers/staging/rtl8192u/r8192U_dm.c
+++ b/drivers/staging/rtl8192u/r8192U_dm.c
@@ -767,7 +767,7 @@ static void dm_TXPowerTrackingCallback_ThermalMeter(struct 
net_device *dev)
 
 void dm_txpower_trackingcallback(struct work_struct *work)
 {
-   struct delayed_work *dwork = container_of(work, struct delayed_work, 
work);
+   struct delayed_work *dwork = to_delayed_work(work);
struct r8192_priv *priv = container_of(dwork, struct r8192_priv, 
txpower_tracking_wq);
struct net_device *dev = priv->ieee80211->dev;
 
@@ -2412,7 +2412,7 @@ staticvoiddm_check_pbc_gpio(struct net_device 
*dev)
  *---*/
 void dm_rf_pathcheck_workitemcallback(struct work_struct *work)
 {
-   struct delayed_work *dwork = container_of(work, struct delayed_work, 
work);
+   struct delayed_work *dwork = to_delayed_work(work);
struct r8192_priv *priv = container_of(dwork, struct r8192_priv, 
rfpath_check_wq);
struct net_device *dev = priv->ieee80211->dev;
/*bool bactually_set = false;*/
diff --git a/drivers/staging/rtl8192u/r819xU_phy.c 
b/drivers/staging/rtl8192u/r819xU_phy.c
index f264d88..696df34 100644
--- a/drivers/staging/rtl8192u/r819xU_phy.c
+++ b/drivers/staging/rtl8192u/r819xU_phy.c
@@ -1683,8 +1683,7 @@ void InitialGain819xUsb(struct net_device *dev,   u8 
Operation)
 
 void InitialGainOperateWorkItemCallBack(struct work_struct *work)
 {
-   struct delayed_work *dwork = container_of(work, struct delayed_work,
- work);
+   struct delayed_work *dwork = to_delayed_work(work);
struct r8192_priv *priv = container_of(dwork, struct r8192_priv,
   initialgain_operate_wq);
struct net_device *dev = priv->ieee80211->dev;
-- 
2.5.0


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

[PATCH 2/2] staging: wilc1000: wilc_parse_network_info refactoring

2015-12-28 Thread Ivan Safonov
1) Return value of this function does not used;
2) wilc_parse_network_info has no reasons to return an error;
3) kfree does not free memory if argument is NULL.

Signed-off-by: Ivan Safonov 
---
 drivers/staging/wilc1000/coreconfigurator.c | 27 +--
 drivers/staging/wilc1000/coreconfigurator.h |  2 +-
 2 files changed, 6 insertions(+), 23 deletions(-)

diff --git a/drivers/staging/wilc1000/coreconfigurator.c 
b/drivers/staging/wilc1000/coreconfigurator.c
index 2d4d3f1..a36918c 100644
--- a/drivers/staging/wilc1000/coreconfigurator.c
+++ b/drivers/staging/wilc1000/coreconfigurator.c
@@ -458,34 +458,17 @@ s32 wilc_parse_network_info(u8 *pu8MsgBuffer, 
tstrNetworkInfo **ppstrNetworkInfo
 
 /**
  *  @brief  Deallocates the parsed Network Info
- *  @details
  *  @param[in]  pstrNetworkInfo Network Info to be deallocated
- *  @return Error code indicating success/failure
- *  @note
  *  @authormabubakr
  *  @date  1 Mar 2012
- *  @version   1.0
  */
-s32 wilc_dealloc_network_info(tstrNetworkInfo *pstrNetworkInfo)
+void wilc_dealloc_network_info(tstrNetworkInfo *network_info)
 {
-   s32 s32Error = 0;
+   if (!network_info)
+   return;
 
-   if (pstrNetworkInfo) {
-   if (pstrNetworkInfo->pu8IEs) {
-   kfree(pstrNetworkInfo->pu8IEs);
-   pstrNetworkInfo->pu8IEs = NULL;
-   } else {
-   s32Error = -EFAULT;
-   }
-
-   kfree(pstrNetworkInfo);
-   pstrNetworkInfo = NULL;
-
-   } else {
-   s32Error = -EFAULT;
-   }
-
-   return s32Error;
+   kfree(network_info->pu8IEs);
+   kfree(network_info);
 }
 
 /**
diff --git a/drivers/staging/wilc1000/coreconfigurator.h 
b/drivers/staging/wilc1000/coreconfigurator.h
index fc43d04..8c28c6b 100644
--- a/drivers/staging/wilc1000/coreconfigurator.h
+++ b/drivers/staging/wilc1000/coreconfigurator.h
@@ -130,7 +130,7 @@ typedef struct {
 s32 wilc_send_config_pkt(struct wilc *wilc, u8 mode, struct wid *wids,
 u32 count, u32 drv);
 s32 wilc_parse_network_info(u8 *pu8MsgBuffer, tstrNetworkInfo 
**ppstrNetworkInfo);
-s32 wilc_dealloc_network_info(tstrNetworkInfo *pstrNetworkInfo);
+void wilc_dealloc_network_info(tstrNetworkInfo *network_info);
 
 s32 wilc_parse_assoc_resp_info(u8 *pu8Buffer, u32 u32BufferLen,
   tstrConnectRespInfo **ppstrConnectRespInfo);
-- 
2.4.10

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


Cleaning dgnc driver

2015-12-28 Thread Salah Triki
Hi,

Is it useful to clean staging/dgnc, since it supports the same adapters
that those of serial/jsm ?

best regards,
salah triki
  
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 3/3] staging: rtl8192e: use to_delayed_work

2015-12-28 Thread Geliang Tang
Use to_delayed_work() instead of open-coding it.

Signed-off-by: Geliang Tang 
---
 drivers/staging/rtl8192e/rtllib.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/rtl8192e/rtllib.h 
b/drivers/staging/rtl8192e/rtllib.h
index 563ac12..d99240e 100644
--- a/drivers/staging/rtl8192e/rtllib.h
+++ b/drivers/staging/rtl8192e/rtllib.h
@@ -76,7 +76,7 @@
 
 #define container_of_work_rsl(x, y, z) container_of(x, y, z)
 #define container_of_dwork_rsl(x, y, z)\
-   container_of(container_of(x, struct delayed_work, work), y, z)
+   container_of(to_delayed_work(x), y, z)
 
 #define iwe_stream_add_event_rsl(info, start, stop, iwe, len)  \
iwe_stream_add_event(info, start, stop, iwe, len)
-- 
2.5.0


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


Cordial greeting

2015-12-28 Thread Zahra Robert



Cordial greeting message from Eva Zahra, I am seeking for your help,I will
be very glad if you do assist me to relocate a sum of (US$4 Million
Dollars)into your Bank account in your country for the benefit of both of
us i want to use this money for investment. I will give you more details
as you reply Yours Eva Zahra Robert

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


RE: [PATCH v2 1/1] fix a dead loop when in heavy low memory

2015-12-28 Thread Zhang, Tianfei
> > Android System UI hang when run heavy monkey stress test.
> 
> What changed from v1 of this patch?  Please describe that below the ---
> line.
V2,I just modify my comments.

> 
> >
> > Signed-off-by: Figo 
> 
> I need a "full" name here, not a "short" name, sorry, before I can do anything
> with this patch.

 my name? my Full name is Figo.zhang

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


[PATCH 2/2] Staging: goldfish: Remove explicit NULL comparison

2015-12-28 Thread shraddha.6596
From: Shraddha Barke 

Remove explicit NULL comparison and write it in its simpler form.

Signed-off-by: Shraddha Barke 
---
 drivers/staging/goldfish/goldfish_audio.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/goldfish/goldfish_audio.c 
b/drivers/staging/goldfish/goldfish_audio.c
index f1e1838..364fdcd 100644
--- a/drivers/staging/goldfish/goldfish_audio.c
+++ b/drivers/staging/goldfish/goldfish_audio.c
@@ -280,12 +280,12 @@ static int goldfish_audio_probe(struct platform_device 
*pdev)
platform_set_drvdata(pdev, data);
 
r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-   if (r == NULL) {
+   if (!r) {
dev_err(&pdev->dev, "platform_get_resource failed\n");
return -ENODEV;
}
data->reg_base = devm_ioremap(&pdev->dev, r->start, PAGE_SIZE);
-   if (data->reg_base == NULL)
+   if (!data->reg_base)
return -ENOMEM;
 
data->irq = platform_get_irq(pdev, 0);
@@ -295,7 +295,7 @@ static int goldfish_audio_probe(struct platform_device 
*pdev)
}
data->buffer_virt = dmam_alloc_coherent(&pdev->dev,
COMBINED_BUFFER_SIZE, &buf_addr, GFP_KERNEL);
-   if (data->buffer_virt == NULL) {
+   if (!data->buffer_virt) {
dev_err(&pdev->dev, "allocate buffer failed\n");
return -ENOMEM;
}
-- 
2.1.4

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


[PATCH 4/6] Staging: gdm72xx: Remove space after cast

2015-12-28 Thread shraddha.6596
From: Shraddha Barke 

Fix the checkpatch warning "No space is necessary after cast"

Signed-off-by: Shraddha Barke 
---
 drivers/staging/gdm72xx/netlink_k.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/gdm72xx/netlink_k.c 
b/drivers/staging/gdm72xx/netlink_k.c
index c8504b3..ee06bd15b 100644
--- a/drivers/staging/gdm72xx/netlink_k.c
+++ b/drivers/staging/gdm72xx/netlink_k.c
@@ -21,7 +21,7 @@
 #include "netlink_k.h"
 
 #if !defined(NLMSG_HDRLEN)
-#define NLMSG_HDRLEN((int) NLMSG_ALIGN(sizeof(struct nlmsghdr)))
+#define NLMSG_HDRLEN((int)NLMSG_ALIGN(sizeof(struct nlmsghdr)))
 #endif
 
 #define ND_MAX_GROUP   30
-- 
2.1.4

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


Cordial greeting

2015-12-28 Thread Zahra Robert



Cordial greeting message from Eva Zahra, I am seeking for your help,I will
be very glad if you do assist me to relocate a sum of (US$4 Million
Dollars)into your Bank account in your country for the benefit of both of
us i want to use this money for investment. I will give you more details
as you reply Yours Eva Zahra Robert

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


Re: Move panel driver out of staging?

2015-12-28 Thread Willy Tarreau
Hi Dan,

Thanks for your review, I'm adding a few extra comments below.

On Mon, Dec 28, 2015 at 06:27:36PM +0300, Dan Carpenter wrote:
> On Mon, Dec 28, 2015 at 12:32:39PM +0100, Ksenija Stanojevi?? wrote:
> > Hi Willy,
> > 
> > I'm helping Greg do a bit of cleanup in the staging tree, I noticed that
> > panel driver is maybe ready to be moved to drivers/misc. Are there any
> > TODO tasks left to do? I already sent checkpatch clean-up patches.
> > 
> 
> I feel like lcd_write_data() should take a u8 instead of an int.  Or
> possibly a char, I suppose.

Looks like so indeed.

> Could we tighten the checking in input_name2mask() a bit?
> 
> drivers/staging/panel/panel.c
>   2044  static int input_name2mask(const char *name, pmask_t *mask, pmask_t 
> *value,
>   2045 char *imask, char *omask)
>   2046  {
>   2047  static char sigtab[10] = "EeSsPpAaBb";
>   2048  char im, om;
> 
> Om is 8 bits (signed or not depending on the arch).
> 
>   2049  pmask_t m, v;

I don't know what pmask_t is but I think it should be an opportunity to get
rid of it if it's a scalar.

>   2050  
>   2051  om = 0ULL;
>   2052  im = 0ULL;
>   2053  m = 0ULL;
>   2054  v = 0ULL;

ULL is useless here BTW.

>   2055  while (*name) {
>   2056  int in, out, bit, neg;
>   2057  
>   2058  for (in = 0; (in < sizeof(sigtab)) && (sigtab[in] != 
> *name);
>   2059   in++)
>   2060  ;

The 80-chars limit makes this statement even more confusing than needed.
Possibly it should be broken into 3 different lines.

>   2061  
>   2062  if (in >= sizeof(sigtab))
>   2063  return 0;   /* input name not found */
>   2064  neg = (in & 1); /* odd (lower) names are negated */
>   2065  in >>= 1;
>   2066  im |= BIT(in);
>   2067  
>   2068  name++;
>   2069  if (isdigit(*name)) {
>   2070  out = *name - '0';
>   2071  om |= BIT(out);
> ^^
> out is 0-9 so it's too much for "om".  I don't know if this causes a
> problem, but let's remove the question by adding a check for illegal
> values.
>   if (*name >= '0' && *name <= '7') {

It's very old memories for me now but looking at this code I guess these
are the digits corresponding to the data bits of the parallel port. Thus
indeed such a control is needed to remove any doubt.

>   2072  } else if (*name == '-') {
>   2073  out = 8;
>   2074  } else {
>   2075  return 0;   /* unknown bit name */
>   2076  }
>   2077  
>   2078  bit = (out * 5) + in;
>   2079  
>   2080  m |= 1ULL << bit;
>   2081  if (!neg)
>   2082  v |= 1ULL << bit;

We can remove ULL here and there as well I guess.

>   2083  name++;
>   2084  }
>   2085  *mask = m;
>   2086  *value = v;
>   2087  if (imask)
>   2088  *imask |= im;
>   2089  if (imask)
>   2090  *imask |= im;
>   2091  if (omask)
>   2092  *omask |= om;
> 
> It's too much for omask also.

Yes, let's have om and friends be declared u8 to remove any confusion if
that describes the 8 bits of the data bus on the parallel port. It will
be much saner.

Ksenija, are you interested in trying to address this ?

Thanks!
Willy

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


Re: On Lindent shortcomings and massive style fixing

2015-12-28 Thread Greg KH
On Mon, Dec 28, 2015 at 04:33:27PM +0200, Andrey Utkin wrote:
> After some iterations of checkpatch.pl, on a new developed driver
> (tw5864), now I have the following:
> 
>  $ grep 'WARNING\|ERROR' /src/checkpatch.tw5864 | sort | uniq -c
>  31 ERROR: do not use C99 // comments
> 147 WARNING: Block comments use a trailing */ on a separate line
> 144 WARNING: Block comments use * on subsequent lines
> 435 WARNING: line over 80 characters
> 
> At this point, Lindent was already used, and checkpatch.pl warnings
> introduced by Lindent itself were fixed. Usage of "indent
> --linux-style" (which behaves differently BTW) doesn't help anymore,
> too.
> 
> Could anybody please advise how to sort out these issues
> automatically, because they look like perfectly solvable in automated
> fashion. Of course manual work would result in more niceness, but I am
> not eager to go through hundreds of place of code just to fix "over 80
> characters" issues now.

Shouldn't take very long to do so, all of the above can be fixed in less
than a day's worth of work manually.  Or you can use indent to fix up
the line length issues, but watch out for the results, sometimes it's
better to refactor the code than to just blindly accept the output of
that tool.

good luck!

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


Re: Move panel driver out of staging?

2015-12-28 Thread Dan Carpenter
On Mon, Dec 28, 2015 at 12:32:39PM +0100, Ksenija Stanojević wrote:
> Hi Willy,
> 
> I'm helping Greg do a bit of cleanup in the staging tree, I noticed that
> panel driver is maybe ready to be moved to drivers/misc. Are there any
> TODO tasks left to do? I already sent checkpatch clean-up patches.
> 

I feel like lcd_write_data() should take a u8 instead of an int.  Or
possibly a char, I suppose.

Could we tighten the checking in input_name2mask() a bit?

drivers/staging/panel/panel.c
  2044  static int input_name2mask(const char *name, pmask_t *mask, pmask_t 
*value,
  2045 char *imask, char *omask)
  2046  {
  2047  static char sigtab[10] = "EeSsPpAaBb";
  2048  char im, om;

Om is 8 bits (signed or not depending on the arch).

  2049  pmask_t m, v;
  2050  
  2051  om = 0ULL;
  2052  im = 0ULL;
  2053  m = 0ULL;
  2054  v = 0ULL;
  2055  while (*name) {
  2056  int in, out, bit, neg;
  2057  
  2058  for (in = 0; (in < sizeof(sigtab)) && (sigtab[in] != 
*name);
  2059   in++)
  2060  ;
  2061  
  2062  if (in >= sizeof(sigtab))
  2063  return 0;   /* input name not found */
  2064  neg = (in & 1); /* odd (lower) names are negated */
  2065  in >>= 1;
  2066  im |= BIT(in);
  2067  
  2068  name++;
  2069  if (isdigit(*name)) {
  2070  out = *name - '0';
  2071  om |= BIT(out);
^^
out is 0-9 so it's too much for "om".  I don't know if this causes a
problem, but let's remove the question by adding a check for illegal
values.
if (*name >= '0' && *name <= '7') {


  2072  } else if (*name == '-') {
  2073  out = 8;
  2074  } else {
  2075  return 0;   /* unknown bit name */
  2076  }
  2077  
  2078  bit = (out * 5) + in;
  2079  
  2080  m |= 1ULL << bit;
  2081  if (!neg)
  2082  v |= 1ULL << bit;
  2083  name++;
  2084  }
  2085  *mask = m;
  2086  *value = v;
  2087  if (imask)
  2088  *imask |= im;
  2089  if (imask)
  2090  *imask |= im;
  2091  if (omask)
  2092  *omask |= om;

It's too much for omask also.

  2093  return 1;
  2094  }

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


On Lindent shortcomings and massive style fixing

2015-12-28 Thread Andrey Utkin
After some iterations of checkpatch.pl, on a new developed driver
(tw5864), now I have the following:

 $ grep 'WARNING\|ERROR' /src/checkpatch.tw5864 | sort | uniq -c
 31 ERROR: do not use C99 // comments
147 WARNING: Block comments use a trailing */ on a separate line
144 WARNING: Block comments use * on subsequent lines
435 WARNING: line over 80 characters

At this point, Lindent was already used, and checkpatch.pl warnings
introduced by Lindent itself were fixed. Usage of "indent
--linux-style" (which behaves differently BTW) doesn't help anymore,
too.

Could anybody please advise how to sort out these issues
automatically, because they look like perfectly solvable in automated
fashion. Of course manual work would result in more niceness, but I am
not eager to go through hundreds of place of code just to fix "over 80
characters" issues now.

First one ("do not use C99 // comments") looks easy with regexps, but
the other are not.

Is there any known improvements or successors for Lindent? Or could we
get indent/Lindent improved if we collect some money for this task?

If anybody wants to look at actual code, here it is:
https://github.com/bluecherrydvr/linux.git , branch tw5864_stable,
drivers/staging/media/tw5864

Current output of "checkpatch.pl -f" for all source files in the
driver is here:
https://gist.github.com/andrey-utkin/12295148475e34ef948b

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


Re: Move panel driver out of staging?

2015-12-28 Thread Willy Tarreau
Hi Ksenija,

On Mon, Dec 28, 2015 at 12:32:39PM +0100, Ksenija Stanojevi?? wrote:
> Hi Willy,
> 
> I'm helping Greg do a bit of cleanup in the staging tree, I noticed that
> panel driver is maybe ready to be moved to drivers/misc.

I think so as well, we discussed this with Greg 6 months ago or so but none
of us had the time to re-check.

> Are there any TODO tasks left to do?

I think we're fine now.

> I already sent checkpatch clean-up patches.

I've seen them. Thanks for this. I believe the second one was also proposed
by someone else a week ago, but that's not a problem.

Thanks,
Willy

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


Re: [PATCH V4 2/4] scsi: storvsc: Properly support Fibre Channel devices

2015-12-28 Thread Hannes Reinecke

On 12/23/2015 10:15 PM, K. Y. Srinivasan wrote:

For FC devices managed by this driver, atttach the appropriate transport
template. This will allow us to create the appropriate sysfs files for
these devices. With this we can publish the wwn for both the port and the node.

Signed-off-by: K. Y. Srinivasan 
Reviewed-by: Long Li 
Tested-by: Alex Ng 
---
V2: Fixed error paths - Dan Carpenter 
V3: Fixed build issues reported by kbuild test robot 
V4: Handle configuration of SCSI_FC_ATTRS correctly (both module and 
built in)

  drivers/scsi/storvsc_drv.c |  181 ---
  1 files changed, 134 insertions(+), 47 deletions(-)

diff --git a/drivers/scsi/storvsc_drv.c b/drivers/scsi/storvsc_drv.c
index 00bb4bd..cfbb289 100644
--- a/drivers/scsi/storvsc_drv.c
+++ b/drivers/scsi/storvsc_drv.c
@@ -41,6 +41,7 @@
  #include 
  #include 
  #include 
+#include 

  /*
   * All wire protocol details (storage protocol between the guest and the host)
@@ -397,6 +398,9 @@ static int storvsc_timeout = 180;

  static int msft_blist_flags = BLIST_TRY_VPD_PAGES;

+#if IS_ENABLED(CONFIG_SCSI_FC_ATTRS)
+static struct scsi_transport_template *fc_transport_template;
+#endif

  static void storvsc_on_channel_callback(void *context);

@@ -456,6 +460,11 @@ struct storvsc_device {
/* Used for vsc/vsp channel reset process */
struct storvsc_cmd_request init_request;
struct storvsc_cmd_request reset_request;
+   /*
+* Currently active port and node names for FC devices.
+*/
+   u64 node_name;
+   u64 port_name;
  };

  struct hv_host_device {
@@ -695,7 +704,26 @@ static void  handle_multichannel_storage(struct hv_device 
*device, int max_chns)
vmbus_are_subchannels_present(device->channel);
  }

-static int storvsc_channel_init(struct hv_device *device)
+static void cache_wwn(struct storvsc_device *stor_device,
+ struct vstor_packet *vstor_packet)
+{
+   /*
+* Cache the currently active port and node ww names.
+*/
+   if (vstor_packet->wwn_packet.primary_active) {
+   stor_device->node_name =
+   wwn_to_u64(vstor_packet->wwn_packet.primary_node_wwn);
+   stor_device->port_name =
+   wwn_to_u64(vstor_packet->wwn_packet.primary_port_wwn);
+   } else {
+   stor_device->node_name =
+   wwn_to_u64(vstor_packet->wwn_packet.secondary_node_wwn);
+   stor_device->port_name =
+   wwn_to_u64(vstor_packet->wwn_packet.secondary_port_wwn);
+   }
+}
+
+static int storvsc_channel_init(struct hv_device *device, bool is_fc)
  {
struct storvsc_device *stor_device;
struct storvsc_cmd_request *request;
@@ -727,19 +755,15 @@ static int storvsc_channel_init(struct hv_device *device)
   VM_PKT_DATA_INBAND,
   VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED);
if (ret != 0)
-   goto cleanup;
+   return ret;

t = wait_for_completion_timeout(&request->wait_event, 5*HZ);
-   if (t == 0) {
-   ret = -ETIMEDOUT;
-   goto cleanup;
-   }
+   if (t == 0)
+   return -ETIMEDOUT;

if (vstor_packet->operation != VSTOR_OPERATION_COMPLETE_IO ||
-   vstor_packet->status != 0) {
-   ret = -EINVAL;
-   goto cleanup;
-   }
+   vstor_packet->status != 0)
+   return -EINVAL;


for (i = 0; i < ARRAY_SIZE(vmstor_protocols); i++) {
@@ -764,18 +788,14 @@ static int storvsc_channel_init(struct hv_device *device)
   VM_PKT_DATA_INBAND,
   VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED);
if (ret != 0)
-   goto cleanup;
+   return ret;

t = wait_for_completion_timeout(&request->wait_event, 5*HZ);
-   if (t == 0) {
-   ret = -ETIMEDOUT;
-   goto cleanup;
-   }
+   if (t == 0)
+   return -ETIMEDOUT;

-   if (vstor_packet->operation != VSTOR_OPERATION_COMPLETE_IO) {
-   ret = -EINVAL;
-   goto cleanup;
-   }
+   if (vstor_packet->operation != VSTOR_OPERATION_COMPLETE_IO)
+   return -EINVAL;

if (vstor_packet->status == 0) {
vmstor_proto_version =
@@ -791,10 +811,8 @@ static int storvsc_channel_init(struct hv_device *device)
}
}

-   if (vstor_packet->status != 0) {
-   ret = -EINVAL;
-   goto cleanup;
-   }
+   if (vstor_packet->status != 0)
+   return -EINVAL;


memset(vstor_packet, 0, sizeof(struct vstor_packet));
@@ -809,19 +827,15 @@ static int sto

Move panel driver out of staging?

2015-12-28 Thread Ksenija Stanojević
Hi Willy,

I'm helping Greg do a bit of cleanup in the staging tree, I noticed that
panel driver is maybe ready to be moved to drivers/misc. Are there any
TODO tasks left to do? I already sent checkpatch clean-up patches.

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


[PATCHv2] staging: most: replace multiple if..else with table lookup

2015-12-28 Thread Gujulan Elango, Hari Prasath (H.)
From: Hari Prasath Gujulan Elango 

Replace multiple if..else if..statements with simple table lookup in two
functions.

Signed-off-by: Hari Prasath Gujulan Elango 
---
 drivers/staging/most/mostcore/core.c | 41 +---
 1 file changed, 24 insertions(+), 17 deletions(-)

diff --git a/drivers/staging/most/mostcore/core.c 
b/drivers/staging/most/mostcore/core.c
index ed1ed25..fe6705a 100644
--- a/drivers/staging/most/mostcore/core.c
+++ b/drivers/staging/most/mostcore/core.c
@@ -82,6 +82,14 @@ struct most_inst_obj {
struct list_head list;
 };
 
+static const struct {
+   int most_ch_data_type;
+   char *name;
+} ch_data_type[] = { { MOST_CH_CONTROL, "control\n" },
+   { MOST_CH_ASYNC, "async\n" },
+   { MOST_CH_SYNC, "sync\n" },
+   { MOST_CH_ISOC_AVP, "isoc_avp\n"} };
+
 #define to_inst_obj(d) container_of(d, struct most_inst_obj, kobj)
 
 /**
@@ -414,14 +422,12 @@ static ssize_t show_set_datatype(struct most_c_obj *c,
 struct most_c_attr *attr,
 char *buf)
 {
-   if (c->cfg.data_type & MOST_CH_CONTROL)
-   return snprintf(buf, PAGE_SIZE, "control\n");
-   else if (c->cfg.data_type & MOST_CH_ASYNC)
-   return snprintf(buf, PAGE_SIZE, "async\n");
-   else if (c->cfg.data_type & MOST_CH_SYNC)
-   return snprintf(buf, PAGE_SIZE, "sync\n");
-   else if (c->cfg.data_type & MOST_CH_ISOC_AVP)
-   return snprintf(buf, PAGE_SIZE, "isoc_avp\n");
+   int i;
+
+   for (i = 0; i < ARRAY_SIZE(ch_data_type); i++) {
+   if (c->cfg.data_type & ch_data_type[i].most_ch_data_type)
+   return snprintf(buf, PAGE_SIZE, ch_data_type[i].name);
+   }
return snprintf(buf, PAGE_SIZE, "unconfigured\n");
 }
 
@@ -430,15 +436,16 @@ static ssize_t store_set_datatype(struct most_c_obj *c,
  const char *buf,
  size_t count)
 {
-   if (!strcmp(buf, "control\n")) {
-   c->cfg.data_type = MOST_CH_CONTROL;
-   } else if (!strcmp(buf, "async\n")) {
-   c->cfg.data_type = MOST_CH_ASYNC;
-   } else if (!strcmp(buf, "sync\n")) {
-   c->cfg.data_type = MOST_CH_SYNC;
-   } else if (!strcmp(buf, "isoc_avp\n")) {
-   c->cfg.data_type = MOST_CH_ISOC_AVP;
-   } else {
+   int i;
+
+   for (i = 0; i < ARRAY_SIZE(ch_data_type); i++) {
+   if (!strcmp(buf, ch_data_type[i].name)) {
+   c->cfg.data_type = ch_data_type[i].most_ch_data_type;
+   break;
+   }
+   }
+
+   if (i == ARRAY_SIZE(ch_data_type)) {
pr_info("WARN: invalid attribute settings\n");
return -EINVAL;
}
-- 
1.9.1
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel