Re: [PATCH] staging: vt6655: wpactl.c: Fix sparse warnings

2014-08-08 Thread Martin Berglund
On Thu, Aug 07, 2014 at 07:18:13PM -0700, Greg Kroah-Hartman wrote:
> On Thu, Aug 07, 2014 at 11:08:34PM +0100, Martin Berglund wrote:
> > Add missing __user macro casting in the function wpa_set_keys.
> > This is okay since the function handles the possibility of
> > param->u.wpa_key.key and param->u.wpa_key.seq pointing to
> > kernelspace using a flag, fcpfkernel.
> > 
> > Signed-off-by: Martin Berglund 
> > ---
> > This was submitted as part of Eudyptula challenge task 16
> > 
> >  drivers/staging/vt6655/wpactl.c |8 ++--
> >  1 file changed, 6 insertions(+), 2 deletions(-)
> > 
> > diff --git a/drivers/staging/vt6655/wpactl.c 
> > b/drivers/staging/vt6655/wpactl.c
> > index 5f454ca..d75dd79 100644
> > --- a/drivers/staging/vt6655/wpactl.c
> > +++ b/drivers/staging/vt6655/wpactl.c
> > @@ -224,7 +224,9 @@ int wpa_set_keys(PSDevice pDevice, void *ctx,
> > } else {
> > spin_unlock_irq(&pDevice->lock);
> > if (param->u.wpa_key.key &&
> > -   copy_from_user(&abyKey[0], param->u.wpa_key.key, 
> > param->u.wpa_key.key_len)) {
> > +   copy_from_user(&abyKey[0],
> > +  (void __user *)param->u.wpa_key.key,
> 
> Would it be better to mark this pointer as __user in the structure
> itself?  Or is it also used as a kernel structure in other places?
> 
> thanks,
> 
> greg k-h

Yes, the structure is used as a kernel structure in some other places. 
Even this function is sometimes called with the pointers in the
structure pointing to kernel memory. However, that is correctly
handled with a flag also sent to the function.

As a side note: there are some uses of memcpy in this file that
might be good to switch to copy_from/to_user but it's not as clear
to me if these pointers never can point to kernel memory (because of
the mixing of the two). For example all copying of ssid and bssid.

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


RE: [PATCH] Hyperv: Trigger DHCP renew after host hibernation

2014-08-08 Thread Dexuan Cui
> From: Greg KH [mailto:gre...@linuxfoundation.org]
> Sent: Friday, August 8, 2014 11:32 AM
> > Hi Richard and all,
> >
> > IMO the most feasible and need-the-least-change solution may be:
> > the hyperv network VSC driver passes the event
> > RNDIS_STATUS_NETWORK_CHANGE to the udev daemon?
> >
> > In this way, every distro only needs to add a udev rule, which should
> > be simple.
> 
> No, don't do that, again, act like any other network device, drop the
> link and bring it up when it comes back.
> 
> greg k-h

Hi Greg,
Thanks for the comment!

Do you mean tearing down the net device and re-creating it (by
register_netdev() and unregister_netdev)?

Sorry, I'm new to network drivers. I'll have to try this to see if this
works or not, though I suppose it would work.

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


Re: [PATCH 1/2] staging: iio: Fix vendor name typo in isl290[12]8.c

2014-08-08 Thread Jonathan Cameron
On 27/07/14 18:56, Masanari Iida wrote:
> This patch fix vendor name typo in isl29018.c and isl29028.c
> The company name Intersil should be isl, instead of isil.
> 
> Signed-off-by: Masanari Iida 
Hi Masanari,

This dropped by the wayside because it wasn't cc'd to linux-...@vger.kernel.org

Also, we probably need to maintain compatability with the incorrect binding
so just add another entry with it fixed rather than also removing the wrong one.

J
> ---
>  drivers/staging/iio/light/isl29018.c | 2 +-
>  drivers/staging/iio/light/isl29028.c | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/staging/iio/light/isl29018.c 
> b/drivers/staging/iio/light/isl29018.c
> index 3660a43..4319d60 100644
> --- a/drivers/staging/iio/light/isl29018.c
> +++ b/drivers/staging/iio/light/isl29018.c
> @@ -640,7 +640,7 @@ static const struct i2c_device_id isl29018_id[] = {
>  MODULE_DEVICE_TABLE(i2c, isl29018_id);
>  
>  static const struct of_device_id isl29018_of_match[] = {
> - { .compatible = "isil,isl29018", },
> + { .compatible = "isl,isl29018", },
>   { },
>  };
>  MODULE_DEVICE_TABLE(of, isl29018_of_match);
> diff --git a/drivers/staging/iio/light/isl29028.c 
> b/drivers/staging/iio/light/isl29028.c
> index 6014625..8bbc3ca 100644
> --- a/drivers/staging/iio/light/isl29028.c
> +++ b/drivers/staging/iio/light/isl29028.c
> @@ -537,7 +537,7 @@ static const struct i2c_device_id isl29028_id[] = {
>  MODULE_DEVICE_TABLE(i2c, isl29028_id);
>  
>  static const struct of_device_id isl29028_of_match[] = {
> - { .compatible = "isil,isl29028", },
> + { .compatible = "isl,isl29028", },
>   { },
>  };
>  MODULE_DEVICE_TABLE(of, isl29028_of_match);
> 
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH 2/2] Documentation: bindings: Add ISL29018 and ISL29028 in trivial-devices.txt

2014-08-08 Thread Jonathan Cameron
On 27/07/14 18:56, Masanari Iida wrote:
> This patch add entries for ISL29018 and ISL29028 into trivial-devices.txt.
> This patch fix following error.
> 
> ./isl29018.c:643: WARNING: DT compatible string "isl,isl29018"
> appears un-documented -- check Documentation/devicetree/bindings/
> 
> ./isl29028.c:540: WARNING: DT compatible string "isil,isl29028"
>  appears un-documented -- check Documentation/devicetree/bindings/
> 
> Signed-off-by: Masanari Iida 
Both of these, as device tree patches should also be cc'd to the device tree 
list
and maintainers (see MAINTAINERS) as well as to linux-iio.

Technically they have to have an Ack from a device tree maintainer or
sit on that list for 3 weeks at which point I get to take them if I like...

> ---
>  Documentation/devicetree/bindings/i2c/trivial-devices.txt | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/Documentation/devicetree/bindings/i2c/trivial-devices.txt 
> b/Documentation/devicetree/bindings/i2c/trivial-devices.txt
> index 6af570e..8efdc09 100644
> --- a/Documentation/devicetree/bindings/i2c/trivial-devices.txt
> +++ b/Documentation/devicetree/bindings/i2c/trivial-devices.txt
> @@ -57,6 +57,8 @@ gmt,g751G751: Digital Temperature Sensor and 
> Thermal Watchdog with Two-Wire In
>  infineon,slb9635tt   Infineon SLB9635 (Soft-) I2C TPM (old protocol, max 
> 100khz)
>  infineon,slb9645tt   Infineon SLB9645 I2C TPM (new protocol, max 400khz)
>  isl,isl12057 Intersil ISL12057 I2C RTC Chip
> +isl,isl29018 Intersil ISL29018 I2C Digital Ambient Light and 
> Proximity Sensor
> +isl,isl29028 Intersil ISL29028 I2C Low Power Ambient Light and 
> Proximity Sensor
>  maxim,ds1050 5 Bit Programmable, Pulse-Width Modulator
>  maxim,max1237Low-Power, 4-/12-Channel, 2-Wire Serial, 12-Bit 
> ADCs
>  maxim,max66259-Bit/12-Bit Temperature Sensors with 
> I²C-Compatible Serial Interface
> 
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCHv2 2/2] Staging: rtl8188eu: Removed unnecessarry code.

2014-08-08 Thread Dan Carpenter
On Thu, Aug 07, 2014 at 11:37:51PM +0200, Adrian Remonda wrote:
> This patch clear some code that was not doing any help.
> Pointed out by Larry.Finger
> 

The patch is fine but the changelog doesn't inpsire confidence.  It
should say:

This patch removes some unneeded code.
1) kzalloc() allocates 4 extra bytes so that we can align the return
   value.  But actually the return value is already aligned so we can
   remove the + 4 and the call to N_BYTE_ALIGMENT().
2) The memset() isn't needed because kzalloc() zeroes the allocation.

Suggested-by: Larry Finger 

regards,
dan carpenter

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


Re: [PATCH] Staging: rtl8188eu: Lines over 80 characters fixed.

2014-08-08 Thread Dan Carpenter
On Thu, Aug 07, 2014 at 11:45:32PM +0200, AdrianRemonda wrote:
> I have resent the changes now. Is this ok? Or should I wait until the merge
> window is close?

Just send your patches.  They will sit in Greg's inbox for a couple
weeks, but that's ok.

> Also N_BYTE_ALIGNMENT is being used by several files in the 8188, should
> I remove this macro?

kmalloc() returns properly aligned pointers.

Look at how N_BYTE_ALIGNMENT() is used and judge each time if it is
needed.

regards,
dan carpenter

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


Fix the Signature 答复: [PATCH] drivers: android: fix watermark when cma enabled

2014-08-08 Thread Zengtao (B)
From: Zeng Tao 

Date: Tue, 5 Aug 2014 17:58:10 +0800
Subject: [PATCH] drivers: android: fix watermark when cma enabled

when cma is enabled, the watermark caculation will
include the cma pages, while it can't use cma pages.
this will cause oom while lowmemory killer don't work.

Signed-off-by: Zeng Tao 
---
 drivers/staging/android/lowmemorykiller.c |4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/drivers/staging/android/lowmemorykiller.c 
b/drivers/staging/android/lowmemorykiller.c
index 12f0a13..12cfd4f 100644
--- a/drivers/staging/android/lowmemorykiller.c
+++ b/drivers/staging/android/lowmemorykiller.c
@@ -74,7 +74,9 @@ static int lowmem_shrink(struct shrinker *s, struct 
shrink_control *sc)
int selected_tasksize = 0;
int selected_oom_score_adj;
int array_size = ARRAY_SIZE(lowmem_adj);
-   int other_free = global_page_state(NR_FREE_PAGES) - totalreserve_pages;
+   int other_free = global_page_state(NR_FREE_PAGES) -
+   global_page_state(NR_FREE_CMA_PAGES) -
+   totalreserve_pages;
int other_file = global_page_state(NR_FILE_PAGES) -
global_page_state(NR_SHMEM);

--
1.7.0.4

-邮件原件-
发件人: Dan Carpenter [mailto:dan.carpen...@oracle.com] 
发送时间: 2014年8月5日 18:36
收件人: Zengtao (B)
抄送: de...@driverdev.osuosl.org; gre...@linuxfoundation.org
主题: Re: [PATCH] drivers: android: fix watermark when cma enabled

On Tue, Aug 05, 2014 at 09:43:48AM +, Zengtao (B) wrote:
> From: zengtao 

This is for when you are sending patches on behalf of someone else.
Just fix your from header.  Use your real name.  Zeng Tao?

> 
> when cma is enabled, the watermark caculation will
> include the cma pages, while it can't use cma pages.
> this will cause oom while lowmemory killer don't work.
> 
> Signed-off-by: zengtao 

Real name again.

regards,
dan carpenter

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


[PATCH 9/14] imx-drm: imx-drm-core: delete unneeded test before of_node_put

2014-08-08 Thread Julia Lawall
From: Julia Lawall 

Of_node_put supports NULL as its argument, so the initial test is not
necessary.

Suggested by Uwe Kleine-König.

The semantic patch that fixes this problem is as follows:
(http://coccinelle.lip6.fr/)

// 
@@
expression e;
@@

-if (e)
   of_node_put(e);
// 

Signed-off-by: Julia Lawall 

---
 drivers/staging/imx-drm/imx-drm-core.c |3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/staging/imx-drm/imx-drm-core.c 
b/drivers/staging/imx-drm/imx-drm-core.c
index 6b22106..1852300 100644
--- a/drivers/staging/imx-drm/imx-drm-core.c
+++ b/drivers/staging/imx-drm/imx-drm-core.c
@@ -471,8 +471,7 @@ int imx_drm_encoder_parse_of(struct drm_device *drm,
crtc_mask |= mask;
}
 
-   if (ep)
-   of_node_put(ep);
+   of_node_put(ep);
if (i == 0)
return -ENOENT;
 

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


[PATCH] Staging:bcm:verndorspecificficextn.c: fixed five styling issues

2014-08-08 Thread Panos Vlachos
Fixed the following styling issues:
vendorspecificextn.c:14: WARNING: line over 80 characters
vendorspecificextn.c:64: WARNING: line over 80 characters
vendorspecificextn.c:91: WARNING: line over 80 characters
vendorspecificextn.c:115: WARNING: line over 80 characters
vendorspecificextn.c:138: WARNING: line over 80 characters

Signed-off-by: Panagiotis Vlachos 
---
 drivers/staging/bcm/vendorspecificextn.c |   15 ++-
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/bcm/vendorspecificextn.c 
b/drivers/staging/bcm/vendorspecificextn.c
index 2c57a16..ddb9f30 100644
--- a/drivers/staging/bcm/vendorspecificextn.c
+++ b/drivers/staging/bcm/vendorspecificextn.c
@@ -11,7 +11,8 @@
  * STATUS_SUCCESS/STATUS_FAILURE
  *
  */
-INT vendorextnGetSectionInfo(PVOID  pContext, struct bcm_flash2x_vendor_info 
*pVendorInfo)
+INT vendorextnGetSectionInfo(PVOID  pContext,
+   struct bcm_flash2x_vendor_info *pVendorInfo)
 {
return STATUS_FAILURE;
 }
@@ -61,7 +62,8 @@ INT vendorextnExit(struct bcm_mini_adapter *Adapter)
  * arg -input parameter sent by vendor
  *
  * Returns:
- * CONTINUE_COMMON_PATH in case it is not meant to be processed by 
vendor ioctls
+ * CONTINUE_COMMON_PATH in case it is not meant to be processed by
+ * vendor ioctls
  * STATUS_SUCCESS/STATUS_FAILURE as per the IOCTL return value
  */
 
@@ -88,7 +90,8 @@ INT vendorextnIoctl(struct bcm_mini_adapter *Adapter, UINT 
cmd, ULONG arg)
  * STATUS_SUCCESS/STATUS_FAILURE
  */
 
-INT vendorextnReadSection(PVOID  pContext, PUCHAR pBuffer, enum 
bcm_flash2x_section_val SectionVal,
+INT vendorextnReadSection(PVOID  pContext, PUCHAR pBuffer,
+   enum bcm_flash2x_section_val SectionVal,
UINT offset, UINT numOfBytes)
 {
return STATUS_FAILURE;
@@ -112,7 +115,8 @@ INT vendorextnReadSection(PVOID  pContext, PUCHAR pBuffer, 
enum bcm_flash2x_sect
  * Returns:
  * STATUS_SUCCESS/STATUS_FAILURE
  */
-INT vendorextnWriteSection(PVOID  pContext, PUCHAR pBuffer, enum 
bcm_flash2x_section_val SectionVal,
+INT vendorextnWriteSection(PVOID  pContext, PUCHAR pBuffer,
+   enum bcm_flash2x_section_val SectionVal,
UINT offset, UINT numOfBytes, bool bVerify)
 {
return STATUS_FAILURE;
@@ -135,7 +139,8 @@ INT vendorextnWriteSection(PVOID  pContext, PUCHAR pBuffer, 
enum bcm_flash2x_sec
  * Returns:
  * STATUS_SUCCESS/STATUS_FAILURE
  */
-INT vendorextnWriteSectionWithoutErase(PVOID  pContext, PUCHAR pBuffer, enum 
bcm_flash2x_section_val SectionVal,
+INT vendorextnWriteSectionWithoutErase(PVOID  pContext,
+   PUCHAR pBuffer, enum bcm_flash2x_section_val SectionVal,
UINT offset, UINT numOfBytes)
 {
return STATUS_FAILURE;
-- 
1.7.10.4

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


Re: [PATCH] Staging:bcm:verndorspecificficextn.c: fixed five styling issues

2014-08-08 Thread Dan Carpenter
On Fri, Aug 08, 2014 at 03:48:12PM +0300, Panos Vlachos wrote:
> -INT vendorextnReadSection(PVOID  pContext, PUCHAR pBuffer, enum 
> bcm_flash2x_section_val SectionVal,
> +INT vendorextnReadSection(PVOID  pContext, PUCHAR pBuffer,
> + enum bcm_flash2x_section_val SectionVal,
>   UINT offset, UINT numOfBytes)
^^  ^^

These are not lined up at all.

regards,
dan carpenter

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


Re: [PATCH] Hyperv: Trigger DHCP renew after host hibernation

2014-08-08 Thread Greg KH
On Fri, Aug 08, 2014 at 08:11:20AM +, Dexuan Cui wrote:
> > From: Greg KH [mailto:gre...@linuxfoundation.org]
> > Sent: Friday, August 8, 2014 11:32 AM
> > > Hi Richard and all,
> > >
> > > IMO the most feasible and need-the-least-change solution may be:
> > > the hyperv network VSC driver passes the event
> > > RNDIS_STATUS_NETWORK_CHANGE to the udev daemon?
> > >
> > > In this way, every distro only needs to add a udev rule, which should
> > > be simple.
> > 
> > No, don't do that, again, act like any other network device, drop the
> > link and bring it up when it comes back.
> > 
> > greg k-h
> 
> Hi Greg,
> Thanks for the comment!
> 
> Do you mean tearing down the net device and re-creating it (by
> register_netdev() and unregister_netdev)?

No, don't you have link-detect for your network device?  Toggle that, I
thought patches to do this were posted a while ago...

But if you really want to tear the whole network device down and then
back up again, sure, that would also work.

good luck,

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


Re: [PATCH] staging: vt6655: wpactl.c: Fix sparse warnings

2014-08-08 Thread Greg Kroah-Hartman
On Fri, Aug 08, 2014 at 09:07:55AM +0200, Martin Berglund wrote:
> On Thu, Aug 07, 2014 at 07:18:13PM -0700, Greg Kroah-Hartman wrote:
> > On Thu, Aug 07, 2014 at 11:08:34PM +0100, Martin Berglund wrote:
> > > Add missing __user macro casting in the function wpa_set_keys.
> > > This is okay since the function handles the possibility of
> > > param->u.wpa_key.key and param->u.wpa_key.seq pointing to
> > > kernelspace using a flag, fcpfkernel.
> > > 
> > > Signed-off-by: Martin Berglund 
> > > ---
> > > This was submitted as part of Eudyptula challenge task 16
> > > 
> > >  drivers/staging/vt6655/wpactl.c |8 ++--
> > >  1 file changed, 6 insertions(+), 2 deletions(-)
> > > 
> > > diff --git a/drivers/staging/vt6655/wpactl.c 
> > > b/drivers/staging/vt6655/wpactl.c
> > > index 5f454ca..d75dd79 100644
> > > --- a/drivers/staging/vt6655/wpactl.c
> > > +++ b/drivers/staging/vt6655/wpactl.c
> > > @@ -224,7 +224,9 @@ int wpa_set_keys(PSDevice pDevice, void *ctx,
> > >   } else {
> > >   spin_unlock_irq(&pDevice->lock);
> > >   if (param->u.wpa_key.key &&
> > > - copy_from_user(&abyKey[0], param->u.wpa_key.key, 
> > > param->u.wpa_key.key_len)) {
> > > + copy_from_user(&abyKey[0],
> > > +(void __user *)param->u.wpa_key.key,
> > 
> > Would it be better to mark this pointer as __user in the structure
> > itself?  Or is it also used as a kernel structure in other places?
> > 
> > thanks,
> > 
> > greg k-h
> 
> Yes, the structure is used as a kernel structure in some other places. 
> Even this function is sometimes called with the pointers in the
> structure pointing to kernel memory. However, that is correctly
> handled with a flag also sent to the function.

Ugh, that's a mess.  And should be cleaned up...

> As a side note: there are some uses of memcpy in this file that
> might be good to switch to copy_from/to_user but it's not as clear
> to me if these pointers never can point to kernel memory (because of
> the mixing of the two). For example all copying of ssid and bssid.

That also is not good, if memcpy is used for userspace memory pointers,
bad things can happen on some machines...

Look at how this was fixed up in the other staging vt* driver, odds are
you can do the same thing here, right?

thanks,

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


[PATCH] drivers: staging: lustre: fix sparse warnings / delete unused function

2014-08-08 Thread Benedict Boerger
drivers: staging: lustre: fix sparse warning: symbol XYZ was
not declared. Should it be static?

This was done by declaring them static. This could be done because the functions
were used only in this file.

Deleted the function lnet_print_text_bufs because it were unused.

Compiled without an error.
Done to complete a eudyptula task.

Signed-off-by: Benedict Boerger 
---
 drivers/staging/lustre/lnet/lnet/config.c | 57 ---
 1 file changed, 21 insertions(+), 36 deletions(-)

diff --git a/drivers/staging/lustre/lnet/lnet/config.c 
b/drivers/staging/lustre/lnet/lnet/config.c
index 7c8b947..ede664b 100644
--- a/drivers/staging/lustre/lnet/lnet/config.c
+++ b/drivers/staging/lustre/lnet/lnet/config.c
@@ -47,7 +47,7 @@ static int lnet_tbnob;/* track text 
buf allocation */
 #define LNET_MAX_TEXTBUF_NOB (64<<10)  /* bound allocation */
 #define LNET_SINGLE_TEXTBUF_NOB  (4<<10)
 
-void
+static void
 lnet_syntax(char *name, char *str, int offset, int width)
 {
static char dots[LNET_SINGLE_TEXTBUF_NOB];
@@ -64,7 +64,7 @@ lnet_syntax(char *name, char *str, int offset, int width)
(width < 1) ? 0 : width - 1, dashes);
 }
 
-int
+static int
 lnet_issep(char c)
 {
switch (c) {
@@ -77,7 +77,7 @@ lnet_issep(char c)
}
 }
 
-int
+static int
 lnet_net_unique(__u32 net, struct list_head *nilist)
 {
struct list_head   *tmp;
@@ -108,7 +108,7 @@ lnet_ni_free(struct lnet_ni *ni)
LIBCFS_FREE(ni, sizeof(*ni));
 }
 
-lnet_ni_t *
+static lnet_ni_t *
 lnet_ni_alloc(__u32 net, struct cfs_expr_list *el, struct list_head *nilist)
 {
struct lnet_tx_queue*tq;
@@ -365,7 +365,7 @@ lnet_parse_networks(struct list_head *nilist, char 
*networks)
return -EINVAL;
 }
 
-lnet_text_buf_t *
+static lnet_text_buf_t *
 lnet_new_text_buf(int str_len)
 {
lnet_text_buf_t *ltb;
@@ -394,14 +394,14 @@ lnet_new_text_buf(int str_len)
return ltb;
 }
 
-void
+static void
 lnet_free_text_buf(lnet_text_buf_t *ltb)
 {
lnet_tbnob -= ltb->ltb_size;
LIBCFS_FREE(ltb, ltb->ltb_size);
 }
 
-void
+static void
 lnet_free_text_bufs(struct list_head *tbs)
 {
lnet_text_buf_t  *ltb;
@@ -414,22 +414,7 @@ lnet_free_text_bufs(struct list_head *tbs)
}
 }
 
-void
-lnet_print_text_bufs(struct list_head *tbs)
-{
-   struct list_head*tmp;
-   lnet_text_buf_t   *ltb;
-
-   list_for_each(tmp, tbs) {
-   ltb = list_entry(tmp, lnet_text_buf_t, ltb_list);
-
-   CDEBUG(D_WARNING, "%s\n", ltb->ltb_text);
-   }
-
-   CDEBUG(D_WARNING, "%d allocated\n", lnet_tbnob);
-}
-
-int
+static int
 lnet_str2tbs_sep(struct list_head *tbs, char *str)
 {
struct list_headpending;
@@ -487,7 +472,7 @@ lnet_str2tbs_sep(struct list_head *tbs, char *str)
return 0;
 }
 
-int
+static int
 lnet_expand1tb(struct list_head *list,
   char *str, char *sep1, char *sep2,
   char *item, int itemlen)
@@ -512,7 +497,7 @@ lnet_expand1tb(struct list_head *list,
return 0;
 }
 
-int
+static int
 lnet_str2tbs_expand(struct list_head *tbs, char *str)
 {
char  num[16];
@@ -592,7 +577,7 @@ lnet_str2tbs_expand(struct list_head *tbs, char *str)
return -1;
 }
 
-int
+static int
 lnet_parse_hops(char *str, unsigned int *hops)
 {
int len = strlen(str);
@@ -605,7 +590,7 @@ lnet_parse_hops(char *str, unsigned int *hops)
 
 #define LNET_PRIORITY_SEPARATOR (':')
 
-int
+static int
 lnet_parse_priority(char *str, unsigned int *priority, char **token)
 {
int   nob;
@@ -635,7 +620,7 @@ lnet_parse_priority(char *str, unsigned int *priority, char 
**token)
return 0;
 }
 
-int
+static int
 lnet_parse_route(char *str, int *im_a_router)
 {
/* static scratch buffer OK (single threaded) */
@@ -778,7 +763,7 @@ lnet_parse_route(char *str, int *im_a_router)
return myrc;
 }
 
-int
+static int
 lnet_parse_route_tbs(struct list_head *tbs, int *im_a_router)
 {
lnet_text_buf_t   *ltb;
@@ -819,7 +804,7 @@ lnet_parse_routes(char *routes, int *im_a_router)
return rc;
 }
 
-int
+static int
 lnet_match_network_token(char *token, int len, __u32 *ipaddrs, int nip)
 {
LIST_HEAD(list);
@@ -838,7 +823,7 @@ lnet_match_network_token(char *token, int len, __u32 
*ipaddrs, int nip)
return rc;
 }
 
-int
+static int
 lnet_match_network_tokens(char *net_entry, __u32 *ipaddrs, int nip)
 {
static char tokens[LNET_SINGLE_TEXTBUF_NOB];
@@ -895,7 +880,7 @@ lnet_match_network_tokens(char *net_entry, __u32 *ipaddrs, 
int nip)
return 1;
 }
 
-__u32
+static __u32
 lnet_netspec2net(char *netspec)
 {
char   *bracket = strchr(netspec, '(');
@@ -912,7 +897,7 @@ lnet_netspec2net(char *netspec)
return net;
 }
 
-int
+static int
 lnet_splitnets(char *source, struct list_head *nets)
 {
intoffset = 0;
@@ -992,7 +977,7 @@ lnet_splitnets(char *

Re: [PATCH] Hyperv: Trigger DHCP renew after host hibernation

2014-08-08 Thread Stephen Hemminger
On Fri, 8 Aug 2014 06:45:49 -0700
Greg KH  wrote:

> On Fri, Aug 08, 2014 at 08:11:20AM +, Dexuan Cui wrote:
> > > From: Greg KH [mailto:gre...@linuxfoundation.org]
> > > Sent: Friday, August 8, 2014 11:32 AM
> > > > Hi Richard and all,
> > > >
> > > > IMO the most feasible and need-the-least-change solution may be:
> > > > the hyperv network VSC driver passes the event
> > > > RNDIS_STATUS_NETWORK_CHANGE to the udev daemon?
> > > >
> > > > In this way, every distro only needs to add a udev rule, which should
> > > > be simple.
> > > 
> > > No, don't do that, again, act like any other network device, drop the
> > > link and bring it up when it comes back.
> > > 
> > > greg k-h
> > 
> > Hi Greg,
> > Thanks for the comment!
> > 
> > Do you mean tearing down the net device and re-creating it (by
> > register_netdev() and unregister_netdev)?
> 
> No, don't you have link-detect for your network device?  Toggle that, I
> thought patches to do this were posted a while ago...
> 
> But if you really want to tear the whole network device down and then
> back up again, sure, that would also work.
> 
> good luck,
> 
> greg k-h
> --
> To unsubscribe from this list: send the line "unsubscribe netdev" in
> the body of a message to majord...@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html


Call netif_carrier_off then netif_carrier_on to toggle the link detect
state of netdevice.
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH] staging: vt6655: iowpa.h: Fix sparse warnings

2014-08-08 Thread Martin Berglund
This resolves a sparse address space warning in wpactl.c

Signed-off-by: Martin Berglund 
---
 drivers/staging/vt6655/iowpa.h |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/vt6655/iowpa.h b/drivers/staging/vt6655/iowpa.h
index 772bc4c..fe4b22e 100644
--- a/drivers/staging/vt6655/iowpa.h
+++ b/drivers/staging/vt6655/iowpa.h
@@ -75,7 +75,7 @@ struct viawget_wpa_param {
u8 bssid[6];
u8 ssid[32];
u8 ssid_len;
-   u8 *wpa_ie;
+   u8 __user *wpa_ie;
u16 wpa_ie_len;
int pairwise_suite;
int group_suite;
@@ -102,7 +102,7 @@ struct viawget_wpa_param {
 
struct {
u16 scan_count;
-   u8 *buf;
+   u8 __user *buf;
} scan_results;
 
} u;
-- 
1.7.10.4

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


Re: [PATCH] staging: vt6655: wpactl.c: Fix sparse warnings

2014-08-08 Thread Martin Berglund
On Fri, Aug 08, 2014 at 06:47:25AM -0700, Greg Kroah-Hartman wrote:
> On Fri, Aug 08, 2014 at 09:07:55AM +0200, Martin Berglund wrote:
> > On Thu, Aug 07, 2014 at 07:18:13PM -0700, Greg Kroah-Hartman wrote:
> > > On Thu, Aug 07, 2014 at 11:08:34PM +0100, Martin Berglund wrote:
> > > > Add missing __user macro casting in the function wpa_set_keys.
> > > > This is okay since the function handles the possibility of
> > > > param->u.wpa_key.key and param->u.wpa_key.seq pointing to
> > > > kernelspace using a flag, fcpfkernel.
> > > > 
> > > > Signed-off-by: Martin Berglund 
> > > > ---
> > > > This was submitted as part of Eudyptula challenge task 16
> > > > 
> > > >  drivers/staging/vt6655/wpactl.c |8 ++--
> > > >  1 file changed, 6 insertions(+), 2 deletions(-)
> > > > 
> > > > diff --git a/drivers/staging/vt6655/wpactl.c 
> > > > b/drivers/staging/vt6655/wpactl.c
> > > > index 5f454ca..d75dd79 100644
> > > > --- a/drivers/staging/vt6655/wpactl.c
> > > > +++ b/drivers/staging/vt6655/wpactl.c
> > > > @@ -224,7 +224,9 @@ int wpa_set_keys(PSDevice pDevice, void *ctx,
> > > > } else {
> > > > spin_unlock_irq(&pDevice->lock);
> > > > if (param->u.wpa_key.key &&
> > > > -   copy_from_user(&abyKey[0], param->u.wpa_key.key, 
> > > > param->u.wpa_key.key_len)) {
> > > > +   copy_from_user(&abyKey[0],
> > > > +  (void __user *)param->u.wpa_key.key,
> > > 
> > > Would it be better to mark this pointer as __user in the structure
> > > itself?  Or is it also used as a kernel structure in other places?
> > > 
> > > thanks,
> > > 
> > > greg k-h
> > 
> > Yes, the structure is used as a kernel structure in some other places. 
> > Even this function is sometimes called with the pointers in the
> > structure pointing to kernel memory. However, that is correctly
> > handled with a flag also sent to the function.
> 
> Ugh, that's a mess.  And should be cleaned up...
> 
> > As a side note: there are some uses of memcpy in this file that
> > might be good to switch to copy_from/to_user but it's not as clear
> > to me if these pointers never can point to kernel memory (because of
> > the mixing of the two). For example all copying of ssid and bssid.
> 
> That also is not good, if memcpy is used for userspace memory pointers,
> bad things can happen on some machines...
> 
> Look at how this was fixed up in the other staging vt* driver, odds are
> you can do the same thing here, right?
> 
> thanks,
> 
> greg k-h

I've looked into this driver some more now. It's definitely messy but not 
as bad as I said in my previous mail. I could not find any instances where 
copy_to/from_user was needed (the pointers were actually copied arrays).

As to solving it the same way as vt6656 was solved, of some reason vt6656
has no function for ndo_do_ioctl, and therefore no need for the ioctl-part.

I just submitted a very similar patch to solve the last two address space
warnings in the vt6655 driver left after this patch.
https://lkml.org/lkml/2014/8/8/960

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


[PATCH 2/7] staging: dgap: remove redundant declarations.

2014-08-08 Thread Daeseok Youn
These are already defined in dgap.h.

Signed-off-by: Daeseok Youn 
---
 drivers/staging/dgap/dgap.c |6 --
 1 files changed, 0 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/dgap/dgap.c b/drivers/staging/dgap/dgap.c
index 55c06c9..b1253c0 100644
--- a/drivers/staging/dgap/dgap.c
+++ b/drivers/staging/dgap/dgap.c
@@ -158,12 +158,6 @@ static void dgap_err(char *s);
 /*
  * Function prototypes from dgap_sysfs.h
  */
-struct board_t;
-struct channel_t;
-struct un_t;
-struct pci_driver;
-struct class_device;
-
 static void dgap_create_ports_sysfiles(struct board_t *bd);
 static void dgap_remove_ports_sysfiles(struct board_t *bd);
 
-- 
1.7.1

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


[PATCH 1/7] staging: dgap: remove useless variable

2014-08-08 Thread Daeseok Youn
dgap_major_serial_registered and dgap_major_transparent_print_registered
could be checked whether a board is initialized.
But it doesn't need to check that variables becasue dgap module
isn't calling the dgap_cleanup_tty() without initializing
for a board completely.

Signed-off-by: Daeseok Youn 
---
 drivers/staging/dgap/dgap.c |   48 +-
 drivers/staging/dgap/dgap.h |3 --
 2 files changed, 20 insertions(+), 31 deletions(-)

diff --git a/drivers/staging/dgap/dgap.c b/drivers/staging/dgap/dgap.c
index ac12e99..55c06c9 100644
--- a/drivers/staging/dgap/dgap.c
+++ b/drivers/staging/dgap/dgap.c
@@ -1320,11 +1320,9 @@ static int dgap_tty_register(struct board_t *brd)
if (rc < 0)
goto unregister_serial_drv;
 
-   brd->dgap_major_serial_registered = TRUE;
dgap_boards_by_major[brd->serial_driver->major] = brd;
brd->dgap_serial_major = brd->serial_driver->major;
 
-   brd->dgap_major_transparent_print_registered = TRUE;
dgap_boards_by_major[brd->print_driver->major] = brd;
brd->dgap_transparent_print_major = brd->print_driver->major;
 
@@ -1544,35 +1542,29 @@ static void dgap_cleanup_tty(struct board_t *brd)
struct device *dev;
int i;
 
-   if (brd->dgap_major_serial_registered) {
-   dgap_boards_by_major[brd->serial_driver->major] = NULL;
-   brd->dgap_serial_major = 0;
-   for (i = 0; i < brd->nasync; i++) {
-   tty_port_destroy(&brd->serial_ports[i]);
-   dev = brd->channels[i]->ch_tun.un_sysfs;
-   dgap_remove_tty_sysfs(dev);
-   tty_unregister_device(brd->serial_driver, i);
-   }
-   tty_unregister_driver(brd->serial_driver);
-   put_tty_driver(brd->serial_driver);
-   kfree(brd->serial_ports);
-   brd->dgap_major_serial_registered = FALSE;
-   }
-
-   if (brd->dgap_major_transparent_print_registered) {
-   dgap_boards_by_major[brd->print_driver->major] = NULL;
-   brd->dgap_transparent_print_major = 0;
-   for (i = 0; i < brd->nasync; i++) {
-   tty_port_destroy(&brd->printer_ports[i]);
-   dev = brd->channels[i]->ch_pun.un_sysfs;
-   dgap_remove_tty_sysfs(dev);
-   tty_unregister_device(brd->print_driver, i);
-   }
-   tty_unregister_driver(brd->print_driver);
-   put_tty_driver(brd->print_driver);
-   kfree(brd->printer_ports);
-   brd->dgap_major_transparent_print_registered = FALSE;
+   dgap_boards_by_major[brd->serial_driver->major] = NULL;
+   brd->dgap_serial_major = 0;
+   for (i = 0; i < brd->nasync; i++) {
+   tty_port_destroy(&brd->serial_ports[i]);
+   dev = brd->channels[i]->ch_tun.un_sysfs;
+   dgap_remove_tty_sysfs(dev);
+   tty_unregister_device(brd->serial_driver, i);
+   }
+   tty_unregister_driver(brd->serial_driver);
+   put_tty_driver(brd->serial_driver);
+   kfree(brd->serial_ports);
+
+   dgap_boards_by_major[brd->print_driver->major] = NULL;
+   brd->dgap_transparent_print_major = 0;
+   for (i = 0; i < brd->nasync; i++) {
+   tty_port_destroy(&brd->printer_ports[i]);
+   dev = brd->channels[i]->ch_pun.un_sysfs;
+   dgap_remove_tty_sysfs(dev);
+   tty_unregister_device(brd->print_driver, i);
}
+   tty_unregister_driver(brd->print_driver);
+   put_tty_driver(brd->print_driver);
+   kfree(brd->printer_ports);
 }
 
 /*===
diff --git a/drivers/staging/dgap/dgap.h b/drivers/staging/dgap/dgap.h
index 9728d59..0482a4c 100644
--- a/drivers/staging/dgap/dgap.h
+++ b/drivers/staging/dgap/dgap.h
@@ -586,9 +586,6 @@ struct board_t {
struct tty_port *printer_ports;
charprint_name[200];
 
-   u32 dgap_major_serial_registered;
-   u32 dgap_major_transparent_print_registered;
-
u32 dgap_serial_major;
u32 dgap_transparent_print_major;
 
-- 
1.7.1

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


[PATCH 3/7] staging: dgap: cleanup duplicated warning message on dgap_tty_init()

2014-08-08 Thread Daeseok Youn
If true_count is not same with brd->nasync, warning messages are
printed. But it has duplicated messages within if statement.

Signed-off-by: Daeseok Youn 
---
 drivers/staging/dgap/dgap.c |   17 ++---
 1 files changed, 6 insertions(+), 11 deletions(-)

diff --git a/drivers/staging/dgap/dgap.c b/drivers/staging/dgap/dgap.c
index b1253c0..51f9ebc 100644
--- a/drivers/staging/dgap/dgap.c
+++ b/drivers/staging/dgap/dgap.c
@@ -1374,19 +1374,14 @@ static int dgap_tty_init(struct board_t *brd)
brd->nasync = brd->maxports;
 
if (true_count != brd->nasync) {
-   if ((brd->type == PPCM) && (true_count == 64)) {
-   pr_warn("dgap: %s configured for %d ports, has %d 
ports.\n",
-   brd->name, brd->nasync, true_count);
-   pr_warn("dgap: Please make SURE the EBI cable running 
from the card\n");
-   pr_warn("dgap: to each EM module is plugged into EBI 
IN!\n");
-   } else if ((brd->type == PPCM) && (true_count == 0)) {
-   pr_warn("dgap: %s configured for %d ports, has %d 
ports.\n",
-   brd->name, brd->nasync, true_count);
+   pr_warn("dgap: %s configured for %d ports, has %d ports.\n",
+   brd->name, brd->nasync, true_count);
+
+   if ((brd->type == PPCM) &&
+   (true_count == 64 || true_count == 0)) {
pr_warn("dgap: Please make SURE the EBI cable running 
from the card\n");
pr_warn("dgap: to each EM module is plugged into EBI 
IN!\n");
-   } else
-   pr_warn("dgap: %s configured for %d ports, has %d 
ports.\n",
-   brd->name, brd->nasync, true_count);
+   }
 
brd->nasync = true_count;
 
-- 
1.7.1

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


[PATCH 4/7] staging: dgap: Simplify set a board type from configration file

2014-08-08 Thread Daeseok Youn
Board types need to separate normal command like IO, MEM and so on.
And the board type will come after "board" string in config file normally.
(If it is not, dgap_gettok returns an error with zero)
After that, set a variable of a number which is matched with specific
a board number to "board.type". The dgap_gettok() returns that number so
just set to "board.type" and also "v_type" can be removed.

In case of boards of PCI type are set variables to zero. These can
be removed because "p" as cnode get memory from kzalloc so already
set to zero.

Signed-off-by: Daeseok Youn 
---
 drivers/staging/dgap/dgap.c |  109 ++
 drivers/staging/dgap/dgap.h |1 -
 2 files changed, 16 insertions(+), 94 deletions(-)

diff --git a/drivers/staging/dgap/dgap.c b/drivers/staging/dgap/dgap.c
index 51f9ebc..7fb54d1 100644
--- a/drivers/staging/dgap/dgap.c
+++ b/drivers/staging/dgap/dgap.c
@@ -399,10 +399,7 @@ struct toklist {
char *string;
 };
 
-static struct toklist dgap_tlist[] = {
-   { BEGIN,"config_begin" },
-   { END,  "config_end" },
-   { BOARD,"board" },
+static struct toklist dgap_brdtype[] = {
{ PCX,  "Digi_AccelePort_C/X_PCI" },
{ PEPC, "Digi_AccelePort_EPC/X_PCI" },
{ PPCM, "Digi_AccelePort_Xem_PCI" },
@@ -411,6 +408,13 @@ static struct toklist dgap_tlist[] = {
{ APORT8_920P,  "Digi_AccelePort_8r_920_PCI" },
{ PAPORT4,  "Digi_AccelePort_4r_PCI(EIA-232/RS-422)" },
{ PAPORT8,  "Digi_AccelePort_8r_PCI(EIA-232/RS-422)" },
+   { 0, NULL }
+};
+
+static struct toklist dgap_tlist[] = {
+   { BEGIN,"config_begin" },
+   { END,  "config_end" },
+   { BOARD,"board" },
{ IO,   "io" },
{ PCIINFO,  "pciinfo" },
{ LINE, "line" },
@@ -6382,6 +6386,8 @@ static int dgap_parsefile(char **in)
}
 
for (; ;) {
+   int board_type = 0;
+
rc = dgap_gettok(in);
if (rc == 0) {
dgap_err("unexpected EOF");
@@ -6412,88 +6418,13 @@ static int dgap_parsefile(char **in)
line = conc = NULL;
brd = p;
linecnt = -1;
-   break;
-
-   case APORT2_920P:   /* AccelePort_4 */
-   if (p->type != BNODE) {
-   dgap_err("unexpected Digi_2r_920 string");
-   return -1;
-   }
-   p->u.board.type = APORT2_920P;
-   p->u.board.v_type = 1;
-   break;
 
-   case APORT4_920P:   /* AccelePort_4 */
-   if (p->type != BNODE) {
-   dgap_err("unexpected Digi_4r_920 string");
+   board_type = dgap_gettok(in);
+   if (board_type == 0)
return -1;
-   }
-   p->u.board.type = APORT4_920P;
-   p->u.board.v_type = 1;
-   break;
 
-   case APORT8_920P:   /* AccelePort_8 */
-   if (p->type != BNODE) {
-   dgap_err("unexpected Digi_8r_920 string");
-   return -1;
-   }
-   p->u.board.type = APORT8_920P;
-   p->u.board.v_type = 1;
-   break;
+   p->u.board.type = board_type;
 
-   case PAPORT4:   /* AccelePort_4 PCI */
-   if (p->type != BNODE) {
-   dgap_err("unexpected Digi_4r(PCI) string");
-   return -1;
-   }
-   p->u.board.type = PAPORT4;
-   p->u.board.v_type = 1;
-   break;
-
-   case PAPORT8:   /* AccelePort_8 PCI */
-   if (p->type != BNODE) {
-   dgap_err("unexpected Digi_8r string");
-   return -1;
-   }
-   p->u.board.type = PAPORT8;
-   p->u.board.v_type = 1;
-   break;
-
-   case PCX:   /* PCI C/X */
-   if (p->type != BNODE) {
-   dgap_err("unexpected Digi_C/X_(PCI) string");
-   return -1;
-   }
-   p->u.board.type = PCX;
-   p->u.board.v_type = 1;
-   p->u.board.conc1 = 0;
-   p->u.board.conc2 = 0;
-   p->u.board.module1 = 0;
-   p->u.board.module2 = 0;
-   break;
-
-   case PEPC:  /* 

[PATCH 5/7] staging: dgap: Simplify to set a concentrator type

2014-08-08 Thread Daeseok Youn
It is same manner with setting a board type.
For example of config file for concentrator,
"conc ccon" or
"conc epcon"

After allocating a type of "CNODE" then set a type of concentrator.
So remove cases in swith statement, just get a token from string
and set to "conc.type". And also it doesn't need to "conc.v_type".

Signed-off-by: Daeseok Youn 
---
 drivers/staging/dgap/dgap.c |   26 +++---
 drivers/staging/dgap/dgap.h |1 -
 2 files changed, 7 insertions(+), 20 deletions(-)

diff --git a/drivers/staging/dgap/dgap.c b/drivers/staging/dgap/dgap.c
index 7fb54d1..1d27976 100644
--- a/drivers/staging/dgap/dgap.c
+++ b/drivers/staging/dgap/dgap.c
@@ -6387,6 +6387,7 @@ static int dgap_parsefile(char **in)
 
for (; ;) {
int board_type = 0;
+   int conc_type = 0;
 
rc = dgap_gettok(in);
if (rc == 0) {
@@ -6719,24 +6720,15 @@ static int dgap_parsefile(char **in)
else
brd->u.board.conc1++;
 
-   break;
-
-   case CX:/* c/x type concentrator */
-   if (p->type != CNODE) {
-   dgap_err("cx only valid for concentrators");
+   conc_type = dgap_gettok(in);
+   if (conc_type == 0 || conc_type != CX ||
+   conc_type != EPC) {
+   dgap_err("failed to set a type of 
concentratros");
return -1;
}
-   p->u.conc.type = CX;
-   p->u.conc.v_type = 1;
-   break;
 
-   case EPC:   /* epc type concentrator */
-   if (p->type != CNODE) {
-   dgap_err("cx only valid for concentrators");
-   return -1;
-   }
-   p->u.conc.type = EPC;
-   p->u.conc.v_type = 1;
+   p->u.conc.type = conc_type;
+
break;
 
case MOD:   /* EBI module */
@@ -7200,10 +7192,6 @@ static int dgap_checknode(struct cnode *p)
return 0;
 
case CNODE:
-   if (p->u.conc.v_type == 0) {
-   dgap_err("concentrator type not specified");
-   return 1;
-   }
if (p->u.conc.v_speed == 0) {
dgap_err("concentrator line speed not specified");
return 1;
diff --git a/drivers/staging/dgap/dgap.h b/drivers/staging/dgap/dgap.h
index c01aa28..800f407 100644
--- a/drivers/staging/dgap/dgap.h
+++ b/drivers/staging/dgap/dgap.h
@@ -1206,7 +1206,6 @@ struct cnode {
char  *id;
char  *idstr;
long  start;
-   char  v_type;
char  v_connect;
char  v_speed;
char  v_nport;
-- 
1.7.1

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


[PATCH 6/7] staging: dgap: Simplify to set a module type

2014-08-08 Thread Daeseok Youn
It is same manner with setting a board type.
After allocating a type of "MNODE", get a token value
set to "module.type".

Signed-off-by: Daeseok Youn 
---
 drivers/staging/dgap/dgap.c |   26 +++---
 drivers/staging/dgap/dgap.h |1 -
 2 files changed, 7 insertions(+), 20 deletions(-)

diff --git a/drivers/staging/dgap/dgap.c b/drivers/staging/dgap/dgap.c
index 1d27976..a54b8d4 100644
--- a/drivers/staging/dgap/dgap.c
+++ b/drivers/staging/dgap/dgap.c
@@ -6388,6 +6388,7 @@ static int dgap_parsefile(char **in)
for (; ;) {
int board_type = 0;
int conc_type = 0;
+   int module_type = 0;
 
rc = dgap_gettok(in);
if (rc == 0) {
@@ -6762,24 +6763,15 @@ static int dgap_parsefile(char **in)
else
brd->u.board.module1++;
 
-   break;
-
-   case PORTS: /* ports type EBI module */
-   if (p->type != MNODE) {
-   dgap_err("ports only valid for EBI modules");
+   module_type = dgap_gettok(in);
+   if (module_type == 0 || module_type != PORTS ||
+   module_type != MODEM) {
+   dgap_err("failed to set a type of module");
return -1;
}
-   p->u.module.type = PORTS;
-   p->u.module.v_type = 1;
-   break;
 
-   case MODEM: /* ports type EBI module */
-   if (p->type != MNODE) {
-   dgap_err("modem only valid for modem modules");
-   return -1;
-   }
-   p->u.module.type = MODEM;
-   p->u.module.v_type = 1;
+   p->u.module.type = module_type;
+
break;
 
case CABLE:
@@ -7207,10 +7199,6 @@ static int dgap_checknode(struct cnode *p)
return 0;
 
case MNODE:
-   if (p->u.module.v_type == 0) {
-   dgap_err("EBI module type not specified");
-   return 1;
-   }
if (p->u.module.v_nport == 0) {
dgap_err("number of ports on EBI module not specified");
return 1;
diff --git a/drivers/staging/dgap/dgap.h b/drivers/staging/dgap/dgap.h
index 800f407..52e1d64 100644
--- a/drivers/staging/dgap/dgap.h
+++ b/drivers/staging/dgap/dgap.h
@@ -1219,7 +1219,6 @@ struct cnode {
char *id;
char *idstr;
long start;
-   char v_type;
char v_nport;
char v_id;
char v_start;
-- 
1.7.1

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


[PATCH 7/7] staging: dgap: cleanup print messages for dgap driver

2014-08-08 Thread Daeseok Youn
* use dev_{warn,err} instead of pr_{warn,err}
* removes dgap_err() and just use pr_err(). pr_err() used in
dgap_parsefile() not dev_err() because if dgap_parsefile() is
failed, just one message is printed.
* removes "out of memory" messages.

Signed-off-by: Daeseok Youn 
---
 drivers/staging/dgap/dgap.c |  285 +++
 1 files changed, 126 insertions(+), 159 deletions(-)

diff --git a/drivers/staging/dgap/dgap.c b/drivers/staging/dgap/dgap.c
index a54b8d4..45f20b4 100644
--- a/drivers/staging/dgap/dgap.c
+++ b/drivers/staging/dgap/dgap.c
@@ -41,6 +41,8 @@
  */
 #undef DIGI_CONCENTRATORS_SUPPORTED
 
+#define pr_fmt(fmt) "dgap: " fmt
+
 #include 
 #include 
 #include 
@@ -153,7 +155,6 @@ static void dgap_firmware_reset_port(struct channel_t *ch);
 static int dgap_gettok(char **in);
 static char *dgap_getword(char **in);
 static int dgap_checknode(struct cnode *p);
-static void dgap_err(char *s);
 
 /*
  * Function prototypes from dgap_sysfs.h
@@ -877,7 +878,7 @@ static int dgap_firmware_load(struct pci_dev *pdev, int 
card_type,
ret = request_firmware(&fw, fw_info[card_type].conf_name,
 &pdev->dev);
if (ret) {
-   pr_err("dgap: config file %s not found\n",
+   dev_err(&pdev->dev, "config file %s not found\n",
fw_info[card_type].conf_name);
return ret;
}
@@ -922,7 +923,7 @@ static int dgap_firmware_load(struct pci_dev *pdev, int 
card_type,
dgap_find_config(PAPORT4, brd->pci_bus, brd->pci_slot);
 
if (!brd->bd_config) {
-   pr_err("dgap: No valid configuration found\n");
+   dev_err(&pdev->dev, "No valid configuration found\n");
return -EINVAL;
}
 
@@ -930,7 +931,7 @@ static int dgap_firmware_load(struct pci_dev *pdev, int 
card_type,
ret = request_firmware(&fw, fw_info[card_type].bios_name,
&pdev->dev);
if (ret) {
-   pr_err("dgap: bios file %s not found\n",
+   dev_err(&pdev->dev, "bios file %s not found\n",
fw_info[card_type].bios_name);
return ret;
}
@@ -947,7 +948,7 @@ static int dgap_firmware_load(struct pci_dev *pdev, int 
card_type,
ret = request_firmware(&fw, fw_info[card_type].fep_name,
&pdev->dev);
if (ret) {
-   pr_err("dgap: fep file %s not found\n",
+   dev_err(&pdev->dev, "dgap: fep file %s not found\n",
fw_info[card_type].fep_name);
return ret;
}
@@ -976,7 +977,7 @@ static int dgap_firmware_load(struct pci_dev *pdev, int 
card_type,
ret = request_firmware(&fw, fw_info[card_type].con_name,
&pdev->dev);
if (ret) {
-   pr_err("dgap: conc file %s not found\n",
+   dev_err(&pdev->dev, "conc file %s not found\n",
fw_info[card_type].con_name);
return ret;
}
@@ -1378,13 +1379,16 @@ static int dgap_tty_init(struct board_t *brd)
brd->nasync = brd->maxports;
 
if (true_count != brd->nasync) {
-   pr_warn("dgap: %s configured for %d ports, has %d ports.\n",
-   brd->name, brd->nasync, true_count);
+   dev_warn(&brd->pdev->dev,
+"%s configured for %d ports, has %d ports.\n",
+brd->name, brd->nasync, true_count);
 
if ((brd->type == PPCM) &&
(true_count == 64 || true_count == 0)) {
-   pr_warn("dgap: Please make SURE the EBI cable running 
from the card\n");
-   pr_warn("dgap: to each EM module is plugged into EBI 
IN!\n");
+   dev_warn(&brd->pdev->dev,
+"Please make SURE the EBI cable running from 
the card\n");
+   dev_warn(&brd->pdev->dev,
+"to each EM module is plugged into EBI IN!\n");
}
 
brd->nasync = true_count;
@@ -4204,7 +4208,7 @@ static int dgap_test_bios(struct board_t *brd)
/* Gave up on board after too long of time taken */
err1 = readw(addr + SEQUENCE);
err2 = readw(addr + ERROR);
-   pr_warn("dgap: %s failed diagnostics.  Error #(%x,%x).\n",
+   dev_warn(&brd->pdev->dev, "%s failed diagnostics.  Error #(%x,%x).\n",
brd->name, err1, err2);
brd->state = BOARD_FAILED;
brd->dpastatus = BD_NOBIOS;
@@ -4299,8 +4303,9 @@ static int dgap_test_fep(struct board_t *brd)
/*