Re: [PATCH] Staging:BCM:DDRInit.c:Renaming __FUNCTION__

2013-08-31 Thread Dan Carpenter
On Fri, Aug 30, 2013 at 06:49:16PM +0100, Paul McQuade wrote:
> >From c21d0da84c92d351f37b70c0d9c01a66fcb84e88 Mon Sep 17 00:00:00 2001
> From: Paul McQuade 
> Date: Thu, 15 Aug 2013 20:00:50 +0100
> Subject: [PATCH] Staging:BCM:DDRInit.c:Renaming __FUNCTION__
> 

Don't put these in the patch description.

> __Function__ gets renamed with __func__
> 

__FUNCTION__

You have some other changes as well like white space changes to
surrounding lines.  Put those in a separate patch.


>   retval = wrmalt(Adapter,(UINT)0x0f000830, 
> &uiResetValue, sizeof(uiResetValue));
>   if(retval < 0) {
> - BCM_DEBUG_PRINT(Adapter,CMHOST, WRM, 
> DBG_LVL_ALL, "%s:%d WRM failed\n", __FUNCTION__, __LINE__);
> + BCM_DEBUG_PRINT(Adapter, CMHOST, RDM, 
> DBG_LVL_ALL, "%s:%d RDM failed\n", __func__, __LINE__);
>   return retval;
>   }

Here you changed the WRM to RDM.  That can fall under the trivial and
closely related change but it needs to be mentioned in the changelog.
Except in this case the original message was correct and the new message
is wrong.  W stands for "write" and R stands for "read".

regards,
dan carpenter

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


Re: [PATCH 2/2] staging: dgap: Remove unnecessary version check

2013-08-31 Thread Sachin Kamat
On 31 August 2013 00:00, Greg KH  wrote:
> On Thu, Aug 29, 2013 at 03:36:55PM +0530, Sachin Kamat wrote:
>> Code should be for the kernel version it is merged in. Version
>> check is not necessary.
>>
>> Signed-off-by: Sachin Kamat 
>> ---
>> Compile tested only.
>> ---
>>  drivers/staging/dgap/dgap_driver.c  |4 
>>  drivers/staging/dgap/dgap_kcompat.h |   29 -
>>  2 files changed, 33 deletions(-)
>
> This patch doesn't apply either, what went wrong with these?

A patch similar to my first patch already got applied to your tree due
to which both these failed to apply.

>
> Care to refresh them and try again?

I have refreshed, split and resent the second patch (this one) based
on your latest staging-next.

-- 
With warm regards,
Sachin
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: staging: r8188eu: Add files for new driver - part 7

2013-08-31 Thread Larry Finger

On 08/29/2013 04:48 PM, Dan Carpenter wrote:

Hello Larry Finger,

The patch d6846af679e0: "staging: r8188eu: Add files for new driver -
part 7" from Aug 21, 2013, leads to the following Smatch warning:
"drivers/staging/rtl8188eu/core/rtw_xmit.c:1570
dequeue_one_xmitframe() info: ignoring unreachable code."

   1559  while (!rtw_end_of_queue_search(xmitframe_phead, 
xmitframe_plist)) {
   1560  pxmitframe = LIST_CONTAINOR(xmitframe_plist, struct 
xmit_frame, list);
   1561
   1562  xmitframe_plist = get_next(xmitframe_plist);
   1563
   1564  rtw_list_delete(&pxmitframe->list);
   1565
   1566  ptxservq->qcnt--;
   1567
   1568  break;
 ^
Is there supposed to be an if statement with this break?  This is a loop
that doesn't loop.

   1569
   1570  pxmitframe = NULL;
 ^
Is this bit important?

   1571  }
   1572
   1573  return pxmitframe;

regards,
dan carpenter


Dan,

Despite the unorthodox look of the code, I think it is doing the right thing. If 
there is an entry on the xmitframe queue, it extracts it, does some 
housekeeping, and returns a pointer to the entry. If the queue is empty, then it 
returns NULL.


There are other Realtek drivers that have the same structure, and I suspect a 
long-time error that has been propagated by copy and paste. I will contact the 
Realtek engineers to see what they say, but I think a patch that leads to the 
following pcode will be in order:


if (!rtw_end_of_queue_search())
pxmitframe = ...
rest of housekeeping
}
return pxmitframe

While awaiting their response, I will be testing this patch.

Thanks,

Larry

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


Re: [patch 2/2] staging: rtl8188eu: || vs && typo

2013-08-31 Thread Larry Finger

On 08/29/2013 04:46 PM, Dan Carpenter wrote:

Obviously it's impossible for ->KeyLength to be both 5 and 13.  I assume
that && was intended here.

Signed-off-by: Dan Carpenter 

diff --git a/drivers/staging/rtl8188eu/core/rtw_ioctl_set.c 
b/drivers/staging/rtl8188eu/core/rtw_ioctl_set.c
index 5fab477..193f641 100644
--- a/drivers/staging/rtl8188eu/core/rtw_ioctl_set.c
+++ b/drivers/staging/rtl8188eu/core/rtw_ioctl_set.c
@@ -743,7 +743,7 @@ _func_enter_;

/*  Check key length for WEP. For NDTEST, 2005.01.27, by 
rcnjko. */
if ((encryptionalgo == _WEP40_ || encryptionalgo == _WEP104_) &&
-   (key->KeyLength != 5 || key->KeyLength != 13)) {
+   (key->KeyLength != 5 && key->KeyLength != 13)) {
RT_TRACE(_module_rtl871x_ioctl_set_c_, _drv_err_, ("WEP 
KeyLength:0x%x != 5 or 13\n", key->KeyLength));
ret = _FAIL;
goto exit;


Acked-by: Larry Finger 

Thanks,

Larry


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


Re: [patch] staging: r8188eu: copying one byte too much

2013-08-31 Thread Larry Finger

On 08/29/2013 04:47 PM, Dan Carpenter wrote:

There is a copy and paste bug here so we copy 4 bytes instead of 3.

Signed-off-by: Dan Carpenter 

diff --git a/drivers/staging/rtl8188eu/core/rtw_wlan_util.c 
b/drivers/staging/rtl8188eu/core/rtw_wlan_util.c
index a43fc88..013ea48 100644
--- a/drivers/staging/rtl8188eu/core/rtw_wlan_util.c
+++ b/drivers/staging/rtl8188eu/core/rtw_wlan_util.c
@@ -1592,7 +1592,7 @@ void update_bmc_sta_support_rate(struct adapter 
*padapter, u32 mac_id)
/*  Only B, B/G, and B/G/N AP could use CCK rate */
memcpy((pmlmeinfo->FW_sta_info[mac_id].SupportedRates), 
rtw_basic_rate_cck, 4);
} else {
-   memcpy((pmlmeinfo->FW_sta_info[mac_id].SupportedRates), 
rtw_basic_rate_ofdm, 4);
+   memcpy((pmlmeinfo->FW_sta_info[mac_id].SupportedRates), 
rtw_basic_rate_ofdm, 3);
}
  }


Acked-by: Larry Finger 

Thanks,

Larry



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


[PATCH] staging: android/timed_output: Create 'enable' attribute automatically

2013-08-31 Thread Guenter Roeck
The 'enable' attribute is needed for all timed_output_class devices.
It can thus be created automatically when creating the timed_output device.
This simplifies the code and ensures that the attribute exists when the
udev event announcing device registration is generated.

Signed-off-by: Guenter Roeck 
---
Compile tested only.

 drivers/staging/android/timed_output.c |   54 +---
 1 file changed, 15 insertions(+), 39 deletions(-)

diff --git a/drivers/staging/android/timed_output.c 
b/drivers/staging/android/timed_output.c
index ee3a57f..99cdb8f 100644
--- a/drivers/staging/android/timed_output.c
+++ b/drivers/staging/android/timed_output.c
@@ -24,7 +24,6 @@
 
 #include "timed_output.h"
 
-static struct class *timed_output_class;
 static atomic_t device_count;
 
 static ssize_t enable_show(struct device *dev, struct device_attribute *attr,
@@ -51,71 +50,48 @@ static ssize_t enable_store(
return size;
 }
 
-static DEVICE_ATTR(enable, S_IRUGO | S_IWUSR, enable_show, enable_store);
+static struct device_attribute timed_output_attrs[] = {
+   __ATTR(enable, S_IRUGO | S_IWUSR, enable_show, enable_store),
+   { }
+};
 
-static int create_timed_output_class(void)
-{
-   if (!timed_output_class) {
-   timed_output_class = class_create(THIS_MODULE, "timed_output");
-   if (IS_ERR(timed_output_class))
-   return PTR_ERR(timed_output_class);
-   atomic_set(&device_count, 0);
-   }
-
-   return 0;
-}
+static struct class timed_output_class = {
+   .owner = THIS_MODULE,
+   .name = "timed_output",
+   .dev_attrs = timed_output_attrs,
+};
 
 int timed_output_dev_register(struct timed_output_dev *tdev)
 {
-   int ret;
-
if (!tdev || !tdev->name || !tdev->enable || !tdev->get_time)
return -EINVAL;
 
-   ret = create_timed_output_class();
-   if (ret < 0)
-   return ret;
-
+   tdev->state = 0;
tdev->index = atomic_inc_return(&device_count);
-   tdev->dev = device_create(timed_output_class, NULL,
-   MKDEV(0, tdev->index), NULL, "%s", tdev->name);
+   tdev->dev = device_create(&timed_output_class, NULL,
+   MKDEV(0, tdev->index), tdev, "%s", tdev->name);
if (IS_ERR(tdev->dev))
return PTR_ERR(tdev->dev);
 
-   ret = device_create_file(tdev->dev, &dev_attr_enable);
-   if (ret < 0)
-   goto err_create_file;
-
-   dev_set_drvdata(tdev->dev, tdev);
-   tdev->state = 0;
return 0;
-
-err_create_file:
-   device_destroy(timed_output_class, MKDEV(0, tdev->index));
-   pr_err("failed to register driver %s\n",
-   tdev->name);
-
-   return ret;
 }
 EXPORT_SYMBOL_GPL(timed_output_dev_register);
 
 void timed_output_dev_unregister(struct timed_output_dev *tdev)
 {
tdev->enable(tdev, 0);
-   device_remove_file(tdev->dev, &dev_attr_enable);
-   device_destroy(timed_output_class, MKDEV(0, tdev->index));
-   dev_set_drvdata(tdev->dev, NULL);
+   device_destroy(&timed_output_class, MKDEV(0, tdev->index));
 }
 EXPORT_SYMBOL_GPL(timed_output_dev_unregister);
 
 static int __init timed_output_init(void)
 {
-   return create_timed_output_class();
+   return class_register(&timed_output_class);
 }
 
 static void __exit timed_output_exit(void)
 {
-   class_destroy(timed_output_class);
+   class_unregister(&timed_output_class);
 }
 
 module_init(timed_output_init);
-- 
1.7.9.7

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


[PATCH v2] staging: android/timed_output: Create 'enable' attribute automatically

2013-08-31 Thread Guenter Roeck
The 'enable' attribute is needed for all timed_output_class devices.
It can thus be created automatically when creating the timed_output device.
This simplifies the code and ensures that the attribute exists when the
udev event announcing device registration is generated.

Signed-off-by: Guenter Roeck 
---
v2: I realized there was a reason to support creating the class from
timed_output_dev_register(), since it is not guaranteed that the driver
initialization function has been executed when it is called and the driver
is built into the kernel. Restore that code.

 drivers/staging/android/timed_output.c |   54 +++-
 1 file changed, 26 insertions(+), 28 deletions(-)

diff --git a/drivers/staging/android/timed_output.c 
b/drivers/staging/android/timed_output.c
index ee3a57f..79fcaa2 100644
--- a/drivers/staging/android/timed_output.c
+++ b/drivers/staging/android/timed_output.c
@@ -24,7 +24,7 @@
 
 #include "timed_output.h"
 
-static struct class *timed_output_class;
+static bool class_registered;
 static atomic_t device_count;
 
 static ssize_t enable_show(struct device *dev, struct device_attribute *attr,
@@ -51,15 +51,25 @@ static ssize_t enable_store(
return size;
 }
 
-static DEVICE_ATTR(enable, S_IRUGO | S_IWUSR, enable_show, enable_store);
+static struct device_attribute timed_output_attrs[] = {
+   __ATTR(enable, S_IRUGO | S_IWUSR, enable_show, enable_store),
+   { }
+};
 
-static int create_timed_output_class(void)
+static struct class timed_output_class = {
+   .owner = THIS_MODULE,
+   .name = "timed_output",
+   .dev_attrs = timed_output_attrs,
+};
+
+static int register_timed_output_class(void)
 {
-   if (!timed_output_class) {
-   timed_output_class = class_create(THIS_MODULE, "timed_output");
-   if (IS_ERR(timed_output_class))
-   return PTR_ERR(timed_output_class);
+   if (!class_registered) {
+   int ret = class_register(&timed_output_class);
+   if (ret)
+   return ret;
atomic_set(&device_count, 0);
+   class_registered = true;
}
 
return 0;
@@ -72,50 +82,38 @@ int timed_output_dev_register(struct timed_output_dev *tdev)
if (!tdev || !tdev->name || !tdev->enable || !tdev->get_time)
return -EINVAL;
 
-   ret = create_timed_output_class();
+   ret = register_timed_output_class();
if (ret < 0)
return ret;
 
+   tdev->state = 0;
tdev->index = atomic_inc_return(&device_count);
-   tdev->dev = device_create(timed_output_class, NULL,
-   MKDEV(0, tdev->index), NULL, "%s", tdev->name);
+   tdev->dev = device_create(&timed_output_class, NULL,
+ MKDEV(0, tdev->index), tdev, "%s",
+ tdev->name);
if (IS_ERR(tdev->dev))
return PTR_ERR(tdev->dev);
 
-   ret = device_create_file(tdev->dev, &dev_attr_enable);
-   if (ret < 0)
-   goto err_create_file;
-
-   dev_set_drvdata(tdev->dev, tdev);
-   tdev->state = 0;
return 0;
-
-err_create_file:
-   device_destroy(timed_output_class, MKDEV(0, tdev->index));
-   pr_err("failed to register driver %s\n",
-   tdev->name);
-
-   return ret;
 }
 EXPORT_SYMBOL_GPL(timed_output_dev_register);
 
 void timed_output_dev_unregister(struct timed_output_dev *tdev)
 {
tdev->enable(tdev, 0);
-   device_remove_file(tdev->dev, &dev_attr_enable);
-   device_destroy(timed_output_class, MKDEV(0, tdev->index));
-   dev_set_drvdata(tdev->dev, NULL);
+   device_destroy(&timed_output_class, MKDEV(0, tdev->index));
 }
 EXPORT_SYMBOL_GPL(timed_output_dev_unregister);
 
 static int __init timed_output_init(void)
 {
-   return create_timed_output_class();
+   return register_timed_output_class();
 }
 
 static void __exit timed_output_exit(void)
 {
-   class_destroy(timed_output_class);
+   class_unregister(&timed_output_class);
+   class_registered = false;
 }
 
 module_init(timed_output_init);
-- 
1.7.9.7

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


Re: staging: r8188eu: Add files for new driver - part 7

2013-08-31 Thread Dan Carpenter
On Sat, Aug 31, 2013 at 11:36:09AM -0500, Larry Finger wrote:
> On 08/29/2013 04:48 PM, Dan Carpenter wrote:
> >Hello Larry Finger,
> >
> >The patch d6846af679e0: "staging: r8188eu: Add files for new driver -
> >part 7" from Aug 21, 2013, leads to the following Smatch warning:
> >"drivers/staging/rtl8188eu/core/rtw_xmit.c:1570
> > dequeue_one_xmitframe() info: ignoring unreachable code."
> >
> >   1559  while (!rtw_end_of_queue_search(xmitframe_phead, 
> > xmitframe_plist)) {
> >   1560  pxmitframe = LIST_CONTAINOR(xmitframe_plist, struct 
> > xmit_frame, list);
> >   1561
> >   1562  xmitframe_plist = get_next(xmitframe_plist);
> >   1563
> >   1564  rtw_list_delete(&pxmitframe->list);
> >   1565
> >   1566  ptxservq->qcnt--;
> >   1567
> >   1568  break;
> > ^
> >Is there supposed to be an if statement with this break?  This is a loop
> >that doesn't loop.
> >
> >   1569
> >   1570  pxmitframe = NULL;
> > ^
> >Is this bit important?
> >
> >   1571  }
> >   1572
> >   1573  return pxmitframe;
> >
> >regards,
> >dan carpenter
> 
> Dan,
> 
> Despite the unorthodox look of the code, I think it is doing the
> right thing. If there is an entry on the xmitframe queue, it
> extracts it, does some housekeeping, and returns a pointer to the
> entry. If the queue is empty, then it returns NULL.
> 

True, while break loops are pretty common for getting the first element
in a list.  But the main point is the "pxmitframe = NULL;" line is
unreachable.

regards,
dan carpenter

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


Re: [PATCH] staging: android/timed_output: Create 'enable' attribute automatically

2013-08-31 Thread Dan Carpenter
On Sat, Aug 31, 2013 at 11:32:58AM -0700, Guenter Roeck wrote:
> The 'enable' attribute is needed for all timed_output_class devices.
> It can thus be created automatically when creating the timed_output device.
> This simplifies the code and ensures that the attribute exists when the
> udev event announcing device registration is generated.
> 
> Signed-off-by: Guenter Roeck 

This patch has a bug so it was replaced by a v2 patch in a later thread.

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


Hello

2013-08-31 Thread Donald Lawson
Hello,

I am Mr. Donald Lawson, of Lapeer, MI 48446 USA. I won $337 million in the 
Powerball Millions Lottery as introduced on Friday August 17th 2012 by Michigan 
Lottery Officials.

Please share in my joy and verify this by visiting: 
http://usnews.nbcnews.com/_news/2012/08/31/13591150-winner-of-337-million-powerball-jackpot-revealed-in-michigan?lite

After a long deliberation on what to do with my winnings, I finally have an 
approval from the Government to commence my 2013 charity foundation/projects, 
and to use the opportunity to disburse fraction of my winnings; to Good 
spirited individuals, Churches, Orphanages and Charities.

Under Individual category; your email address amongst other (9) Lucky ones was 
submitted to receive grant of $1,000,000 USD from my charity foundation.This 
was certified after careful balloting by Microsoft Data Base Email and Google 
Management Team.

To you, this message may sound unreal BUT it is a 100% genuine, giving you a 
once in a life time opportunity to get more established.

I anticipate your immediate response through my contact email below for 
comprehensive details on fund disbursement.

Best of luck,

Mr. Donald Lawson
Email: donaldlawson-char...@gmx.com
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] staging: dgnc: adds TODO

2013-08-31 Thread Lidza Louina
On Fri, Aug 30, 2013 at 2:28 PM, Greg KH  wrote:
> On Thu, Aug 29, 2013 at 07:00:37PM -0400, Lidza Louina wrote:
>> This patchs adds a TODO for the driver.
>>
>> Signed-off-by: Lidza Louina 
>> ---
>>  drivers/staging/dgnc/TODO | 17 +
>>  1 file changed, 17 insertions(+)
>>  create mode 100644 drivers/staging/dgnc/TODO
>
> That's great, thanks.  Can you also send a patch adding you to the
> MAINTAINERS file for this driver, and the other one, so that people
> using 'scripts/get_maintainer.pl' know to cc: you as well?

Yes, I can. =]
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 01/12] staging: dgnc: removes casting when using kzalloc

2013-08-31 Thread Lidza Louina
This patch removes casting that is used when kzalloc
is called. Casting isn't needed because kzalloc
returns a void pointer.

Signed-off-by: Lidza Louina 
---
 drivers/staging/dgnc/dgnc_driver.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/dgnc/dgnc_driver.c 
b/drivers/staging/dgnc/dgnc_driver.c
index f8c1e22..1e76f0c 100644
--- a/drivers/staging/dgnc/dgnc_driver.c
+++ b/drivers/staging/dgnc/dgnc_driver.c
@@ -499,7 +499,7 @@ static int dgnc_found_board(struct pci_dev *pdev, int id)
 
/* get the board structure and prep it */
brd = dgnc_Board[dgnc_NumBoards] =
-   (struct board_t *) kzalloc(sizeof(struct board_t), GFP_KERNEL);
+   kzalloc(sizeof(struct board_t), GFP_KERNEL);
if (!brd) {
APR(("memory allocation for board structure failed\n"));
return(-ENOMEM);
@@ -507,7 +507,7 @@ static int dgnc_found_board(struct pci_dev *pdev, int id)
 
/* make a temporary message buffer for the boot messages */
brd->msgbuf = brd->msgbuf_head =
-   (char *) kzalloc(sizeof(char) * 8192, GFP_KERNEL);
+   kzalloc(sizeof(char) * 8192, GFP_KERNEL);
if (!brd->msgbuf) {
kfree(brd);
APR(("memory allocation for board msgbuf failed\n"));
-- 
1.8.1.2

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


[PATCH 09/12] staging: dgnc: mgmt.c: checkpatch: removes parentheses around return statements

2013-08-31 Thread Lidza Louina
This patch removes this checkpatch warning:
ERROR: return is not a function, parentheses are not
required.

Signed-off-by: Lidza Louina 
---
 drivers/staging/dgnc/dgnc_mgmt.c | 22 +++---
 1 file changed, 11 insertions(+), 11 deletions(-)

diff --git a/drivers/staging/dgnc/dgnc_mgmt.c b/drivers/staging/dgnc/dgnc_mgmt.c
index dcab2a8..354458c 100644
--- a/drivers/staging/dgnc/dgnc_mgmt.c
+++ b/drivers/staging/dgnc/dgnc_mgmt.c
@@ -74,13 +74,13 @@ int dgnc_mgmt_open(struct inode *inode, struct file *file)
/* Only allow 1 open at a time on mgmt device */
if (dgnc_mgmt_in_use[minor]) {
DGNC_UNLOCK(dgnc_global_lock, lock_flags);
-   return (-EBUSY);
+   return -EBUSY;
}
dgnc_mgmt_in_use[minor]++;
}
else {
DGNC_UNLOCK(dgnc_global_lock, lock_flags);
-   return (-ENXIO);
+   return -ENXIO;
}
 
DGNC_UNLOCK(dgnc_global_lock, lock_flags);
@@ -154,7 +154,7 @@ long dgnc_mgmt_ioctl(struct file *file, unsigned int cmd, 
unsigned long arg)
ddi.dinfo_nboards, ddi.dinfo_version));
 
if (copy_to_user(uarg, &ddi, sizeof (ddi)))
-   return(-EFAULT);
+   return -EFAULT;
 
break;
}
@@ -166,13 +166,13 @@ long dgnc_mgmt_ioctl(struct file *file, unsigned int cmd, 
unsigned long arg)
struct digi_info di;
 
if (copy_from_user(&brd, uarg, sizeof(int))) {
-   return(-EFAULT);
+   return -EFAULT;
}
 
DPR_MGMT(("DIGI_GETBD asking about board: %d\n", brd));
 
if ((brd < 0) || (brd > dgnc_NumBoards) || (dgnc_NumBoards == 
0))
-   return (-ENODEV);
+   return -ENODEV;
 
memset(&di, 0, sizeof(di));
 
@@ -196,7 +196,7 @@ long dgnc_mgmt_ioctl(struct file *file, unsigned int cmd, 
unsigned long arg)
di.info_bdtype, di.info_bdstate, di.info_nports, 
di.info_physsize));
 
if (copy_to_user(uarg, &di, sizeof (di)))
-   return (-EFAULT);
+   return -EFAULT;
 
break;
}
@@ -210,7 +210,7 @@ long dgnc_mgmt_ioctl(struct file *file, unsigned int cmd, 
unsigned long arg)
uint channel = 0;
 
if (copy_from_user(&ni, uarg, sizeof(ni))) {
-   return(-EFAULT);
+   return -EFAULT;
}
 
DPR_MGMT(("DIGI_GETBD asking about board: %d channel: %d\n",
@@ -221,16 +221,16 @@ long dgnc_mgmt_ioctl(struct file *file, unsigned int cmd, 
unsigned long arg)
 
/* Verify boundaries on board */
if ((board < 0) || (board > dgnc_NumBoards) || (dgnc_NumBoards 
== 0))
-   return (-ENODEV);
+   return -ENODEV;
 
/* Verify boundaries on channel */
if ((channel < 0) || (channel > dgnc_Board[board]->nasync))
-   return (-ENODEV);
+   return -ENODEV;
 
ch = dgnc_Board[board]->channels[channel];
 
if (!ch || ch->magic != DGNC_CHANNEL_MAGIC)
-   return (-ENODEV);
+   return -ENODEV;
 
memset(&ni, 0, sizeof(ni));
ni.board = board;
@@ -291,7 +291,7 @@ long dgnc_mgmt_ioctl(struct file *file, unsigned int cmd, 
unsigned long arg)
DGNC_UNLOCK(ch->ch_lock, lock_flags);
 
if (copy_to_user(uarg, &ni, sizeof(ni)))
-   return (-EFAULT);
+   return -EFAULT;
 
break;
}
-- 
1.8.1.2

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


[PATCH 11/12] staging: dgnc: sysfs.c: checkpatch: removes parentheses around return statements

2013-08-31 Thread Lidza Louina
This patch removes this checkpatch warning:
ERROR: return is not a function, parentheses are not
required.

Signed-off-by: Lidza Louina 
---
 drivers/staging/dgnc/dgnc_sysfs.c | 116 +++---
 1 file changed, 58 insertions(+), 58 deletions(-)

diff --git a/drivers/staging/dgnc/dgnc_sysfs.c 
b/drivers/staging/dgnc/dgnc_sysfs.c
index 03d3e2f..5834e0c 100644
--- a/drivers/staging/dgnc/dgnc_sysfs.c
+++ b/drivers/staging/dgnc/dgnc_sysfs.c
@@ -152,13 +152,13 @@ void dgnc_remove_driver_sysfiles(struct pci_driver 
*dgnc_driver)
 
 #define DGNC_VERIFY_BOARD(p, bd)   \
if (!p) \
-   return (0); \
+   return 0;   \
\
bd = dev_get_drvdata(p);\
if (!bd || bd->magic != DGNC_BOARD_MAGIC)   \
-   return (0); \
+   return 0;   \
if (bd->state != BOARD_READY)   \
-   return (0); \
+   return 0;   \
 
 
 
@@ -432,18 +432,18 @@ static ssize_t dgnc_tty_state_show(struct device *d, 
struct device_attribute *at
struct un_t *un;
 
if (!d)
-   return (0);
+   return 0;
un = (struct un_t *) dev_get_drvdata(d);
if (!un || un->magic != DGNC_UNIT_MAGIC)
-   return (0);
+   return 0;
ch = un->un_ch;
if (!ch || ch->magic != DGNC_CHANNEL_MAGIC)
-   return (0);
+   return 0;
bd = ch->ch_bd;
if (!bd || bd->magic != DGNC_BOARD_MAGIC)
-   return (0);
+   return 0;
if (bd->state != BOARD_READY)
-   return (0);
+   return 0;
 
return snprintf(buf, PAGE_SIZE, "%s", un->un_open_count ? "Open" : 
"Closed");
 }
@@ -457,18 +457,18 @@ static ssize_t dgnc_tty_baud_show(struct device *d, 
struct device_attribute *att
struct un_t *un;
 
if (!d)
-   return (0);
+   return 0;
un = (struct un_t *) dev_get_drvdata(d);
if (!un || un->magic != DGNC_UNIT_MAGIC)
-   return (0);
+   return 0;
ch = un->un_ch;
if (!ch || ch->magic != DGNC_CHANNEL_MAGIC)
-   return (0);
+   return 0;
bd = ch->ch_bd;
if (!bd || bd->magic != DGNC_BOARD_MAGIC)
-   return (0);
+   return 0;
if (bd->state != BOARD_READY)
-   return (0);
+   return 0;
 
return snprintf(buf, PAGE_SIZE, "%d\n", ch->ch_old_baud);
 }
@@ -482,18 +482,18 @@ static ssize_t dgnc_tty_msignals_show(struct device *d, 
struct device_attribute
struct un_t *un;
 
if (!d)
-   return (0);
+   return 0;
un = (struct un_t *) dev_get_drvdata(d);
if (!un || un->magic != DGNC_UNIT_MAGIC)
-   return (0);
+   return 0;
ch = un->un_ch;
if (!ch || ch->magic != DGNC_CHANNEL_MAGIC)
-   return (0);
+   return 0;
bd = ch->ch_bd;
if (!bd || bd->magic != DGNC_BOARD_MAGIC)
-   return (0);
+   return 0;
if (bd->state != BOARD_READY)
-   return (0);
+   return 0;
 
if (ch->ch_open_count) {
return snprintf(buf, PAGE_SIZE, "%s %s %s %s %s %s\n",
@@ -516,18 +516,18 @@ static ssize_t dgnc_tty_iflag_show(struct device *d, 
struct device_attribute *at
struct un_t *un;
 
if (!d)
-   return (0);
+   return 0;
un = (struct un_t *) dev_get_drvdata(d);
if (!un || un->magic != DGNC_UNIT_MAGIC)
-   return (0);
+   return 0;
ch = un->un_ch;
if (!ch || ch->magic != DGNC_CHANNEL_MAGIC)
-   return (0);
+   return 0;
bd = ch->ch_bd;
if (!bd || bd->magic != DGNC_BOARD_MAGIC)
-   return (0);
+   return 0;
if (bd->state != BOARD_READY)
-   return (0);
+   return 0;
 
return snprintf(buf, PAGE_SIZE, "%x\n", ch->ch_c_iflag);
 }
@@ -541,18 +541,18 @@ static ssize_t dgnc_tty_cflag_show(struct device *d, 
struct device_attribute *at
struct un_t *un;
 
if (!d)
-   return (0);
+   return 0;
un = (struct un_t *) dev_get_drvdata(d);
if (!un || un->magic != DGNC_UNIT_MAGIC)
-   return (0);
+   return 0;
ch = un->un_ch;
if (!ch || ch->magic != DGNC_CHANNEL_MAGIC)
-   return (0);
+   return 0;
bd = ch->ch_bd;
if (!bd || bd->magic != DGNC_BOARD_MAGIC)
-   return (0);
+

[PATCH 12/12] staging: dgnc: tty.c: checkpatch: removes parentheses around return statements

2013-08-31 Thread Lidza Louina
This patch removes this checkpatch warning:
ERROR: return is not a function, parentheses are not
required.

Signed-off-by: Lidza Louina 
---
 drivers/staging/dgnc/dgnc_tty.c | 200 
 1 file changed, 100 insertions(+), 100 deletions(-)

diff --git a/drivers/staging/dgnc/dgnc_tty.c b/drivers/staging/dgnc/dgnc_tty.c
index b03e373..bc66930 100644
--- a/drivers/staging/dgnc/dgnc_tty.c
+++ b/drivers/staging/dgnc/dgnc_tty.c
@@ -190,10 +190,10 @@ int dgnc_tty_preinit(void)
 
if (!dgnc_TmpWriteBuf) {
DPR_INIT(("unable to allocate tmp write buf"));
-   return (-ENOMEM);
+   return -ENOMEM;
}
 
-   return(0);
+   return 0;
 }
 
 
@@ -255,7 +255,7 @@ int dgnc_tty_register(struct dgnc_board *brd)
rc = tty_register_driver(&brd->SerialDriver);
if (rc < 0) {
APR(("Can't register tty device (%d)\n", rc));
-   return(rc);
+   return rc;
}
brd->dgnc_Major_Serial_Registered = TRUE;
}
@@ -308,7 +308,7 @@ int dgnc_tty_register(struct dgnc_board *brd)
rc = tty_register_driver(&brd->PrintDriver);
if (rc < 0) {
APR(("Can't register Transparent Print device (%d)\n", 
rc));
-   return(rc);
+   return rc;
}
brd->dgnc_Major_TransparentPrint_Registered = TRUE;
}
@@ -319,7 +319,7 @@ int dgnc_tty_register(struct dgnc_board *brd)
 
DPR_INIT(("DGNC REGISTER TTY: MAJOR: %d\n", brd->SerialDriver.major));
 
-   return (rc);
+   return rc;
 }
 
 
@@ -336,7 +336,7 @@ int dgnc_tty_init(struct dgnc_board *brd)
struct channel_t *ch;
 
if (!brd)
-   return (-ENXIO);
+   return -ENXIO;
 
DPR_INIT(("dgnc_tty_init start\n"));
 
@@ -420,7 +420,7 @@ int dgnc_tty_init(struct dgnc_board *brd)
 
DPR_INIT(("dgnc_tty_init finish\n"));
 
-   return (0);
+   return 0;
 }
 
 
@@ -1457,7 +1457,7 @@ static int dgnc_tty_open(struct tty_struct *tty, struct 
file *file)
DGNC_UNLOCK(ch->ch_lock, lock_flags);
 
DPR_OPEN(("dgnc_tty_open finished\n"));
-   return (rc);
+   return rc;
 }
 
 
@@ -1475,12 +1475,12 @@ static int dgnc_block_til_ready(struct tty_struct *tty, 
struct file *file, struc
int sleep_on_un_flags = 0;
 
if (!tty || tty->magic != TTY_MAGIC || !file || !ch || ch->magic != 
DGNC_CHANNEL_MAGIC) {
-   return (-ENXIO);
+   return -ENXIO;
}
 
un = tty->driver_data;
if (!un || un->magic != DGNC_UNIT_MAGIC) {
-   return (-ENXIO);
+   return -ENXIO;
}
 
DPR_OPEN(("dgnc_block_til_ready - before block.\n"));
@@ -1608,12 +1608,12 @@ static int dgnc_block_til_ready(struct tty_struct *tty, 
struct file *file, struc
 
if (retval) {
DPR_OPEN(("dgnc_block_til_ready - done. error. retval: %x\n", 
retval));
-   return(retval);
+   return retval;
}
 
DPR_OPEN(("dgnc_block_til_ready - done no error. jiffies: %lu\n", 
jiffies));
 
-   return(0);
+   return 0;
 }
 
 
@@ -1827,15 +1827,15 @@ static int dgnc_tty_chars_in_buffer(struct tty_struct 
*tty)
ulong   lock_flags = 0;
 
if (tty == NULL)
-   return(0);
+   return 0;
 
un = tty->driver_data;
if (!un || un->magic != DGNC_UNIT_MAGIC)
-   return (0);
+   return 0;
 
ch = un->un_ch;
if (!ch || ch->magic != DGNC_CHANNEL_MAGIC)
-   return (0);
+   return 0;
 
DGNC_LOCK(ch->ch_lock, lock_flags);
 
@@ -1857,7 +1857,7 @@ static int dgnc_tty_chars_in_buffer(struct tty_struct 
*tty)
DPR_WRITE(("dgnc_tty_chars_in_buffer. Port: %x - %d (head: %d tail: 
%d)\n",
ch->ch_portnum, chars, thead, ttail));
 
-   return(chars);
+   return chars;
 }
 
 
@@ -1875,22 +1875,22 @@ static int dgnc_maxcps_room(struct tty_struct *tty, int 
bytes_available)
struct un_t *un = NULL;
 
if (!tty)
-   return (bytes_available);
+   return bytes_available;
 
un = tty->driver_data;
if (!un || un->magic != DGNC_UNIT_MAGIC)
-   return (bytes_available);
+   return bytes_available;
 
ch = un->un_ch;
if (!ch || ch->magic != DGNC_CHANNEL_MAGIC)
-   return (bytes_available);
+   return bytes_available;
 
/*
 * If its not the Transparent print device, return
 * the full data amount.
 */
if (un->un_type != DGNC_PRINT)
-   return (bytes_available);
+   return bytes_available;
 
if (ch->ch_digi.digi_maxcps > 0 && ch->ch_digi.digi_bufsize > 0 ) {
int cps_limit =

[PATCH 04/12] staging: dgnc: replaces struct board_t with dgnc_board

2013-08-31 Thread Lidza Louina
This patch replaces struct board_t with dgnc_board.
It contains the exact same information as board_t.
This change was made because board_t isn't descriptive
and the _t denotes a typedef, which it is not.

Reported-by: Dan Carpenter 
Signed-off-by: Lidza Louina 
---
 drivers/staging/dgnc/dgnc_cls.c| 14 +--
 drivers/staging/dgnc/dgnc_driver.c | 18 +++---
 drivers/staging/dgnc/dgnc_driver.h |  8 +++---
 drivers/staging/dgnc/dgnc_neo.c| 20 +++
 drivers/staging/dgnc/dgnc_sysfs.c  | 50 +++---
 drivers/staging/dgnc/dgnc_sysfs.h  |  6 ++---
 drivers/staging/dgnc/dgnc_tty.c| 38 ++---
 drivers/staging/dgnc/dgnc_tty.h|  6 ++---
 8 files changed, 80 insertions(+), 80 deletions(-)

diff --git a/drivers/staging/dgnc/dgnc_cls.c b/drivers/staging/dgnc/dgnc_cls.c
index 117e158..22875c1 100644
--- a/drivers/staging/dgnc/dgnc_cls.c
+++ b/drivers/staging/dgnc/dgnc_cls.c
@@ -43,7 +43,7 @@
 #include "dgnc_tty.h"
 #include "dgnc_trace.h"
 
-static inline void cls_parse_isr(struct board_t *brd, uint port);
+static inline void cls_parse_isr(struct dgnc_board *brd, uint port);
 static inline void cls_clear_break(struct channel_t *ch, int force);
 static inline void cls_set_cts_flow_control(struct channel_t *ch);
 static inline void cls_set_rts_flow_control(struct channel_t *ch);
@@ -53,7 +53,7 @@ static inline void cls_set_no_output_flow_control(struct 
channel_t *ch);
 static inline void cls_set_no_input_flow_control(struct channel_t *ch);
 static void cls_parse_modem(struct channel_t *ch, uchar signals);
 static void cls_tasklet(unsigned long data);
-static void cls_vpd(struct board_t *brd);
+static void cls_vpd(struct dgnc_board *brd);
 static void cls_uart_init(struct channel_t *ch);
 static void cls_uart_off(struct channel_t *ch);
 static int cls_drain(struct tty_struct *tty, uint seconds);
@@ -393,7 +393,7 @@ static inline void cls_clear_break(struct channel_t *ch, 
int force)
 
 
 /* Parse the ISR register for the specific port */
-static inline void cls_parse_isr(struct board_t *brd, uint port)
+static inline void cls_parse_isr(struct dgnc_board *brd, uint port)
 {
struct channel_t *ch;
uchar isr = 0;
@@ -477,7 +477,7 @@ static void cls_param(struct tty_struct *tty)
uchar uart_ier = 0;
 uint baud = 9600;
int quot = 0;
-struct board_t *bd;
+struct dgnc_board *bd;
struct channel_t *ch;
 struct un_t   *un;
 
@@ -725,7 +725,7 @@ static void cls_param(struct tty_struct *tty)
  */
 static void cls_tasklet(unsigned long data)
 {
-struct board_t *bd = (struct board_t *) data;
+struct dgnc_board *bd = (struct dgnc_board *) data;
struct channel_t *ch;
ulong  lock_flags;
int i;
@@ -802,7 +802,7 @@ static void cls_tasklet(unsigned long data)
  */
 static irqreturn_t cls_intr(int irq, void *voidbrd)
 {
-   struct board_t *brd = (struct board_t *) voidbrd;
+   struct dgnc_board *brd = (struct dgnc_board *) voidbrd;
uint i = 0;
uchar poll_reg;
unsigned long lock_flags;
@@ -1378,7 +1378,7 @@ static void cls_send_immediate_char(struct channel_t *ch, 
unsigned char c)
writeb(c, &ch->ch_cls_uart->txrx);
 }
 
-static void cls_vpd(struct board_t *brd)
+static void cls_vpd(struct dgnc_board *brd)
 {
 ulong   vpdbase;/* Start of io base of the card */
 u8 __iomem   *re_map_vpdbase;/* Remapped memory of the card */
diff --git a/drivers/staging/dgnc/dgnc_driver.c 
b/drivers/staging/dgnc/dgnc_driver.c
index 9dee64c..4d90ba3 100644
--- a/drivers/staging/dgnc/dgnc_driver.c
+++ b/drivers/staging/dgnc/dgnc_driver.c
@@ -71,16 +71,16 @@ PARM_INT(trcbuf_size,   0x10,   0644,   
"Debugging trace buffer size.");
  *
  */
 static int dgnc_start(void);
-static int dgnc_finalize_board_init(struct board_t *brd);
+static int dgnc_finalize_board_init(struct dgnc_board *brd);
 static voiddgnc_init_globals(void);
 static int dgnc_found_board(struct pci_dev *pdev, int id);
-static voiddgnc_cleanup_board(struct board_t *brd);
+static voiddgnc_cleanup_board(struct dgnc_board *brd);
 static voiddgnc_poll_handler(ulong dummy);
 static int dgnc_init_pci(void);
 static int dgnc_init_one(struct pci_dev *pdev, const struct 
pci_device_id *ent);
 static voiddgnc_remove_one(struct pci_dev *dev);
 static int dgnc_probe1(struct pci_dev *pdev, int card_type);
-static voiddgnc_do_remap(struct board_t *brd);
+static voiddgnc_do_remap(struct dgnc_board *brd);
 
 /* Driver load/unload functions */
 intdgnc_init_module(void);
@@ -106,7 +106,7 @@ static struct file_operations dgnc_BoardFops =
  * Globals
  */
 uint   dgnc_NumBoards;
-struct board_t *dgnc_Board[MAXBOARDS];
+struct dgnc_b

[PATCH 08/12] staging: dgnc: driver.c: checkpatch: removes parentheses around return statements

2013-08-31 Thread Lidza Louina
This patch removes this checkpatch warning:
ERROR: return is not a function, parentheses are not
required.

Signed-off-by: Lidza Louina 
---
 drivers/staging/dgnc/dgnc_driver.c | 102 ++---
 1 file changed, 51 insertions(+), 51 deletions(-)

diff --git a/drivers/staging/dgnc/dgnc_driver.c 
b/drivers/staging/dgnc/dgnc_driver.c
index 15896b0..88e252e 100644
--- a/drivers/staging/dgnc/dgnc_driver.c
+++ b/drivers/staging/dgnc/dgnc_driver.c
@@ -225,7 +225,7 @@ int dgnc_init_module(void)
rc = dgnc_start();
 
if (rc < 0) {
-   return(rc);
+   return rc;
}
 
/*
@@ -250,7 +250,7 @@ int dgnc_init_module(void)
}
 
DPR_INIT(("Finished init_module. Returning %d\n", rc));
-   return (rc);
+   return rc;
 }
 
 
@@ -286,7 +286,7 @@ static int dgnc_start(void)
if (rc <= 0) {
APR(("Can't register dgnc driver device 
(%d)\n", rc));
rc = -ENXIO;
-   return(rc);
+   return rc;
}
dgnc_Major = rc;
 
@@ -311,7 +311,7 @@ static int dgnc_start(void)
 
if (rc < 0) {
APR(("tty preinit - not enough memory (%d)\n", rc));
-   return(rc);
+   return rc;
}
 
/* Start the poller */
@@ -328,7 +328,7 @@ static int dgnc_start(void)
dgnc_driver_state = DRIVER_READY;
}
 
-   return(rc);
+   return rc;
 }
 
 /*
@@ -653,7 +653,7 @@ static int dgnc_found_board(struct pci_dev *pdev, int id)
 
default:
APR(("Did not find any compatible Neo or Classic PCI boards in 
system.\n"));
-   return (-ENXIO);
+   return -ENXIO;
 
}
 
@@ -715,11 +715,11 @@ static int dgnc_found_board(struct pci_dev *pdev, int id)
 
wake_up_interruptible(&brd->state_wait);
 
-   return(0);
+   return 0;
 
 failed:
 
-   return (-ENXIO);
+   return -ENXIO;
 
 }
 
@@ -730,7 +730,7 @@ static int dgnc_finalize_board_init(struct dgnc_board *brd) 
{
DPR_INIT(("dgnc_finalize_board_init() - start\n"));
 
if (!brd || brd->magic != DGNC_BOARD_MAGIC)
-   return(-ENODEV);
+   return -ENODEV;
 
DPR_INIT(("dgnc_finalize_board_init() - start #2\n"));
 
@@ -746,7 +746,7 @@ static int dgnc_finalize_board_init(struct dgnc_board *brd) 
{
DPR_INIT(("Requested and received usage of IRQ %d\n", 
brd->irq));
}
}
-   return(rc);
+   return rc;
 }
 
 /*
@@ -890,7 +890,7 @@ int dgnc_ms_sleep(ulong ms)
 {
current->state = TASK_INTERRUPTIBLE;
schedule_timeout((ms * HZ) / 1000);
-   return (signal_pending(current));
+   return signal_pending(current);
 }
 
 
@@ -902,47 +902,47 @@ char *dgnc_ioctl_name(int cmd)
 {
switch(cmd) {
 
-   case TCGETA:return("TCGETA");
-   case TCGETS:return("TCGETS");
-   case TCSETA:return("TCSETA");
-   case TCSETS:return("TCSETS");
-   case TCSETAW:   return("TCSETAW");
-   case TCSETSW:   return("TCSETSW");
-   case TCSETAF:   return("TCSETAF");
-   case TCSETSF:   return("TCSETSF");
-   case TCSBRK:return("TCSBRK");
-   case TCXONC:return("TCXONC");
-   case TCFLSH:return("TCFLSH");
-   case TIOCGSID:  return("TIOCGSID");
-
-   case TIOCGETD:  return("TIOCGETD");
-   case TIOCSETD:  return("TIOCSETD");
-   case TIOCGWINSZ:return("TIOCGWINSZ");
-   case TIOCSWINSZ:return("TIOCSWINSZ");
-
-   case TIOCMGET:  return("TIOCMGET");
-   case TIOCMSET:  return("TIOCMSET");
-   case TIOCMBIS:  return("TIOCMBIS");
-   case TIOCMBIC:  return("TIOCMBIC");
+   case TCGETA:return "TCGETA";
+   case TCGETS:return "TCGETS";
+   case TCSETA:return "TCSETA";
+   case TCSETS:return "TCSETS";
+   case TCSETAW:   return "TCSETAW";
+   case TCSETSW:   return "TCSETSW";
+   case TCSETAF:   return "TCSETAF";
+   case TCSETSF:   return "TCSETSF";
+   case TCSBRK:return "TCSBRK";
+   case TCXONC:return "TCXONC";
+   case TCFLSH:return "TCFLSH";
+   case TIOCGSID:  return "TIOCGSID";
+
+   case TIOCGETD:  return "TIOCGETD";
+   case TIOCSETD:  return "TIOCSETD";
+   case TIOCGWINSZ:return "TIOCGWINSZ";
+   case TIOCSWINSZ:return "TIOCSWINSZ";
+
+   case TIOCMGET:  return "TIOCMGET";
+   case TIOCMSET:  return "TIOCMSET";
+   case TIOCMBIS:  

[PATCH 03/12] staging: dgnc: driver.h: adds struct dgnc_board

2013-08-31 Thread Lidza Louina
This patch adds the dgnc_board struct to driver.h.
This struct will replace board_t in this driver.

Signed-off-by: Lidza Louina 
---
 drivers/staging/dgnc/dgnc_driver.h | 85 ++
 1 file changed, 85 insertions(+)

diff --git a/drivers/staging/dgnc/dgnc_driver.h 
b/drivers/staging/dgnc/dgnc_driver.h
index 218b15d..a369b2e 100644
--- a/drivers/staging/dgnc/dgnc_driver.h
+++ b/drivers/staging/dgnc/dgnc_driver.h
@@ -367,6 +367,91 @@ struct board_t {
 
 };
 
+struct dgnc_board {
+   int magic;  /* Board Magic number.  */
+   int boardnum;   /* Board number: 0-32 */
+
+   int type;   /* Type of board */
+   char*name;  /* Product Name */
+   struct pci_dev  *pdev;  /* Pointer to the pci_dev struct */
+   unsigned long   bd_flags;   /* Board flags */
+   u16 vendor; /* PCI vendor ID */
+   u16 device; /* PCI device ID */
+   u16 subvendor;  /* PCI subsystem vendor ID */
+   u16 subdevice;  /* PCI subsystem device ID */
+   uchar   rev;/* PCI revision ID */
+   uintpci_bus;/* PCI bus value */
+   uintpci_slot;   /* PCI slot value */
+   uintmaxports;   /* MAX ports this board can handle */
+   uchar   dvid;   /* Board specific device id */
+   uchar   vpd[128];   /* VPD of board, if found */
+   uchar   serial_num[20]; /* Serial number of board, if found in 
VPD */
+
+   spinlock_t  bd_lock;/* Used to protect board */
+
+   spinlock_t  bd_intr_lock;   /* Used to protect the poller tasklet 
and
+* the interrupt routine from each 
other.
+*/
+
+   uintstate;  /* State of card. */
+   wait_queue_head_t state_wait;   /* Place to sleep on for state change */
+
+   struct  tasklet_struct helper_tasklet; /* Poll helper tasklet */
+
+   uintnasync; /* Number of ports on card */
+
+   uintirq;/* Interrupt request number */
+   ulong   intr_count; /* Count of interrupts */
+   ulong   intr_modem; /* Count of interrupts */
+   ulong   intr_tx;/* Count of interrupts */
+   ulong   intr_rx;/* Count of interrupts */
+
+   ulong   membase;/* Start of base memory of the card */
+   ulong   membase_end;/* End of base memory of the card */
+
+   u8 __iomem  *re_map_membase;/* Remapped memory of the card 
*/
+
+   ulong   iobase; /* Start of io base of the card */
+   ulong   iobase_end; /* End of io base of the card */
+
+   uintbd_uart_offset; /* Space between each UART */
+
+   struct channel_t *channels[MAXPORTS]; /* array of pointers to our 
channels. */
+
+   struct tty_driver   SerialDriver;
+   charSerialName[200];
+   struct tty_driver   PrintDriver;
+   charPrintName[200];
+
+   uintdgnc_Major_Serial_Registered;
+   uintdgnc_Major_TransparentPrint_Registered;
+
+   uintdgnc_Serial_Major;
+   uintdgnc_TransparentPrint_Major;
+
+   uintTtyRefCnt;
+
+   char*flipbuf;   /* Our flip buffer, alloced if board is 
found */
+
+   u16 dpatype;/* The board "type", as defined by DPA 
*/
+   u16 dpastatus;  /* The board "status", as defined by 
DPA */
+
+   /*
+*  Mgmt data.
+*/
+   char*msgbuf_head;
+   char*msgbuf;
+
+   uintbd_dividend;/* Board/UARTs specific dividend */
+
+   struct board_ops *bd_ops;
+
+   /* /proc/ entries */
+   struct proc_dir_entry *proc_entry_pointer;
+   struct dgnc_proc_entry *dgnc_board_table;
+
+};
+
 
 /
  * Unit flag definitions for un_flags.
-- 
1.8.1.2

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


[PATCH 07/12] staging: dgnc: cls.c: checkpatch: removes parentheses around return statements

2013-08-31 Thread Lidza Louina
This patch removes this checkpatch warning:
ERROR: return is not a function, parentheses are not
required.

Signed-off-by: Lidza Louina 
---
 drivers/staging/dgnc/dgnc_cls.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/dgnc/dgnc_cls.c b/drivers/staging/dgnc/dgnc_cls.c
index 22875c1..fa1bb63 100644
--- a/drivers/staging/dgnc/dgnc_cls.c
+++ b/drivers/staging/dgnc/dgnc_cls.c
@@ -976,17 +976,17 @@ static int cls_drain(struct tty_struct *tty, uint seconds)
int rc = 0;
 
if (!tty || tty->magic != TTY_MAGIC) {
-   return (-ENXIO);
+   return -ENXIO;
}
 
un = (struct un_t *) tty->driver_data;
if (!un || un->magic != DGNC_UNIT_MAGIC) {
-   return (-ENXIO);
+   return -ENXIO;
}
 
ch = un->un_ch;
if (!ch || ch->magic != DGNC_CHANNEL_MAGIC) {
-   return (-ENXIO);
+   return -ENXIO;
}
 
DGNC_LOCK(ch->ch_lock, lock_flags);
@@ -1002,7 +1002,7 @@ static int cls_drain(struct tty_struct *tty, uint seconds)
if (rc)
DPR_IOCTL(("%d Drain - User ctrl c'ed\n", __LINE__));
 
-return (rc);
+return rc;
 }
 
 
-- 
1.8.1.2

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


[PATCH 02/12] staging: dgnc: replaces generic struct from sizeof calls

2013-08-31 Thread Lidza Louina
This patch replaces all instances of "sizeof(struct"
with actual instances of the struct. For example
"sizeof(struct tty_struct" is replaced with
"sizeof(brd->SerialDriver.ttys".

This patch affects driver.c, mgmt.c and tty.c.

Signed-off-by: Lidza Louina 
---
 drivers/staging/dgnc/dgnc_driver.c |  2 +-
 drivers/staging/dgnc/dgnc_mgmt.c   |  2 +-
 drivers/staging/dgnc/dgnc_tty.c| 28 ++--
 3 files changed, 16 insertions(+), 16 deletions(-)

diff --git a/drivers/staging/dgnc/dgnc_driver.c 
b/drivers/staging/dgnc/dgnc_driver.c
index 1e76f0c..9dee64c 100644
--- a/drivers/staging/dgnc/dgnc_driver.c
+++ b/drivers/staging/dgnc/dgnc_driver.c
@@ -499,7 +499,7 @@ static int dgnc_found_board(struct pci_dev *pdev, int id)
 
/* get the board structure and prep it */
brd = dgnc_Board[dgnc_NumBoards] =
-   kzalloc(sizeof(struct board_t), GFP_KERNEL);
+   kzalloc(sizeof(brd), GFP_KERNEL);
if (!brd) {
APR(("memory allocation for board structure failed\n"));
return(-ENOMEM);
diff --git a/drivers/staging/dgnc/dgnc_mgmt.c b/drivers/staging/dgnc/dgnc_mgmt.c
index c4629d7..dcab2a8 100644
--- a/drivers/staging/dgnc/dgnc_mgmt.c
+++ b/drivers/staging/dgnc/dgnc_mgmt.c
@@ -209,7 +209,7 @@ long dgnc_mgmt_ioctl(struct file *file, unsigned int cmd, 
unsigned long arg)
uint board = 0;
uint channel = 0;
 
-   if (copy_from_user(&ni, uarg, sizeof(struct ni_info))) {
+   if (copy_from_user(&ni, uarg, sizeof(ni))) {
return(-EFAULT);
}
 
diff --git a/drivers/staging/dgnc/dgnc_tty.c b/drivers/staging/dgnc/dgnc_tty.c
index a7bb6bc..e004ca8 100644
--- a/drivers/staging/dgnc/dgnc_tty.c
+++ b/drivers/staging/dgnc/dgnc_tty.c
@@ -208,8 +208,8 @@ int dgnc_tty_register(struct board_t *brd)
 
DPR_INIT(("tty_register start\n"));
 
-   memset(&brd->SerialDriver, 0, sizeof(struct tty_driver));
-   memset(&brd->PrintDriver, 0, sizeof(struct tty_driver));
+   memset(&brd->SerialDriver, 0, sizeof(brd->SerialDriver));
+   memset(&brd->PrintDriver, 0, sizeof(brd->PrintDriver));
 
brd->SerialDriver.magic = TTY_DRIVER_MAGIC;
 
@@ -230,7 +230,7 @@ int dgnc_tty_register(struct board_t *brd)
 * The kernel wants space to store pointers to
 * tty_struct's and termios's.
 */
-   brd->SerialDriver.ttys = kzalloc(brd->maxports * sizeof(struct 
tty_struct *), GFP_KERNEL);
+   brd->SerialDriver.ttys = kzalloc(brd->maxports * 
sizeof(brd->SerialDriver.ttys), GFP_KERNEL);
if (!brd->SerialDriver.ttys)
return(-ENOMEM);
 
@@ -240,12 +240,12 @@ int dgnc_tty_register(struct board_t *brd)
kref_init(&brd->SerialDriver.kref);
 #endif
 
-   brd->SerialDriver.termios = kzalloc(brd->maxports * sizeof(struct 
ktermios *), GFP_KERNEL);
+   brd->SerialDriver.termios = kzalloc(brd->maxports * 
sizeof(brd->SerialDriver.termios), GFP_KERNEL);
if (!brd->SerialDriver.termios)
return(-ENOMEM);
 
 #if LINUX_VERSION_CODE < KERNEL_VERSION(3,0,0)
-   brd->SerialDriver.termios_locked = kzalloc(brd->maxports * 
sizeof(struct ktermios *), GFP_KERNEL);
+   brd->SerialDriver.termios_locked = kzalloc(brd->maxports * 
sizeof(brd->SerialDriver.termios_locked), GFP_KERNEL);
if (!brd->SerialDriver.termios_locked)
return(-ENOMEM);
 #endif
@@ -289,7 +289,7 @@ int dgnc_tty_register(struct board_t *brd)
 * tty_struct's and termios's.  Must be seperate from
 * the Serial Driver so we don't get confused
 */
-   brd->PrintDriver.ttys = kzalloc(brd->maxports * sizeof(struct 
tty_struct *), GFP_KERNEL);
+   brd->PrintDriver.ttys = kzalloc(brd->maxports * 
sizeof(brd->PrintDriver.ttys), GFP_KERNEL);
if (!brd->PrintDriver.ttys)
return(-ENOMEM);
 
@@ -299,12 +299,12 @@ int dgnc_tty_register(struct board_t *brd)
kref_init(&brd->PrintDriver.kref);
 #endif
 
-   brd->PrintDriver.termios = kzalloc(brd->maxports * sizeof(struct 
ktermios *), GFP_KERNEL);
+   brd->PrintDriver.termios = kzalloc(brd->maxports * 
sizeof(brd->PrintDriver.termios), GFP_KERNEL);
if (!brd->PrintDriver.termios)
return(-ENOMEM);
 
 #if LINUX_VERSION_CODE < KERNEL_VERSION(3,0,0)
-   brd->PrintDriver.termios_locked = kzalloc(brd->maxports * sizeof(struct 
ktermios *), GFP_KERNEL);
+   brd->PrintDriver.termios_locked = kzalloc(brd->maxports * 
sizeof(brd->PrintDriver.termios_locked), GFP_KERNEL);
if (!brd->PrintDriver.termios_locked)
return(-ENOMEM);
 #endif
@@ -371,7 +371,7 @@ int dgnc_tty_init(struct board_t *brd)
 * Okay to malloc with GFP_KERNEL, we are not at
 * interrupt context, and there are no locks held.
 */
-   brd->channels[i] = kzalloc(sizeof(struct channel_t), 
GFP_KERNEL);
+  

[PATCH 06/12] staging: dgnc: removes kzalloc error statements

2013-08-31 Thread Lidza Louina
This patch removes the error statements that follow
kzalloc. These are useless because kzalloc has its
own error statement and the driver's error handling
would never actually happen.

Reported-by: Dan Carpenter 
Signed-off-by: Lidza Louina 
---
 drivers/staging/dgnc/dgnc_driver.c | 10 --
 drivers/staging/dgnc/dgnc_tty.c| 18 +-
 2 files changed, 1 insertion(+), 27 deletions(-)

diff --git a/drivers/staging/dgnc/dgnc_driver.c 
b/drivers/staging/dgnc/dgnc_driver.c
index 4d90ba3..15896b0 100644
--- a/drivers/staging/dgnc/dgnc_driver.c
+++ b/drivers/staging/dgnc/dgnc_driver.c
@@ -500,20 +500,10 @@ static int dgnc_found_board(struct pci_dev *pdev, int id)
/* get the board structure and prep it */
brd = dgnc_Board[dgnc_NumBoards] =
kzalloc(sizeof(brd), GFP_KERNEL);
-   if (!brd) {
-   APR(("memory allocation for board structure failed\n"));
-   return(-ENOMEM);
-   }
 
/* make a temporary message buffer for the boot messages */
brd->msgbuf = brd->msgbuf_head =
kzalloc(sizeof(char) * 8192, GFP_KERNEL);
-   if (!brd->msgbuf) {
-   kfree(brd);
-   APR(("memory allocation for board msgbuf failed\n"));
-   return(-ENOMEM);
-   }
-
/* store the info for the board we've found */
brd->magic = DGNC_BOARD_MAGIC;
brd->boardnum = dgnc_NumBoards;
diff --git a/drivers/staging/dgnc/dgnc_tty.c b/drivers/staging/dgnc/dgnc_tty.c
index 8880df2..b03e373 100644
--- a/drivers/staging/dgnc/dgnc_tty.c
+++ b/drivers/staging/dgnc/dgnc_tty.c
@@ -231,8 +231,6 @@ int dgnc_tty_register(struct dgnc_board *brd)
 * tty_struct's and termios's.
 */
brd->SerialDriver.ttys = kzalloc(brd->maxports * 
sizeof(brd->SerialDriver.ttys), GFP_KERNEL);
-   if (!brd->SerialDriver.ttys)
-   return(-ENOMEM);
 
 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,28)
brd->SerialDriver.refcount = brd->TtyRefCnt;
@@ -241,13 +239,10 @@ int dgnc_tty_register(struct dgnc_board *brd)
 #endif
 
brd->SerialDriver.termios = kzalloc(brd->maxports * 
sizeof(brd->SerialDriver.termios), GFP_KERNEL);
-   if (!brd->SerialDriver.termios)
-   return(-ENOMEM);
 
 #if LINUX_VERSION_CODE < KERNEL_VERSION(3,0,0)
brd->SerialDriver.termios_locked = kzalloc(brd->maxports * 
sizeof(brd->SerialDriver.termios_locked), GFP_KERNEL);
-   if (!brd->SerialDriver.termios_locked)
-   return(-ENOMEM);
+
 #endif
/*
 * Entry points for driver.  Called by the kernel from
@@ -290,8 +285,6 @@ int dgnc_tty_register(struct dgnc_board *brd)
 * the Serial Driver so we don't get confused
 */
brd->PrintDriver.ttys = kzalloc(brd->maxports * 
sizeof(brd->PrintDriver.ttys), GFP_KERNEL);
-   if (!brd->PrintDriver.ttys)
-   return(-ENOMEM);
 
 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,28)
brd->PrintDriver.refcount = brd->TtyRefCnt;
@@ -300,13 +293,8 @@ int dgnc_tty_register(struct dgnc_board *brd)
 #endif
 
brd->PrintDriver.termios = kzalloc(brd->maxports * 
sizeof(brd->PrintDriver.termios), GFP_KERNEL);
-   if (!brd->PrintDriver.termios)
-   return(-ENOMEM);
-
 #if LINUX_VERSION_CODE < KERNEL_VERSION(3,0,0)
brd->PrintDriver.termios_locked = kzalloc(brd->maxports * 
sizeof(brd->PrintDriver.termios_locked), GFP_KERNEL);
-   if (!brd->PrintDriver.termios_locked)
-   return(-ENOMEM);
 #endif
 
/*
@@ -372,10 +360,6 @@ int dgnc_tty_init(struct dgnc_board *brd)
 * interrupt context, and there are no locks held.
 */
brd->channels[i] = kzalloc(sizeof(brd->channels[i]), 
GFP_KERNEL);
-   if (!brd->channels[i]) {
-   DPR_CORE(("%s:%d Unable to allocate memory for 
channel struct\n",
-   __FILE__, __LINE__));
-   }
}
}
 
-- 
1.8.1.2

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


[PATCH 10/12] staging: dgnc: neo.c: checkpatch: removes parentheses around return statements

2013-08-31 Thread Lidza Louina
This patch removes this checkpatch warning:
ERROR: return is not a function, parentheses are not
required.

Signed-off-by: Lidza Louina 
---
 drivers/staging/dgnc/dgnc_neo.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/dgnc/dgnc_neo.c b/drivers/staging/dgnc/dgnc_neo.c
index 6165051..9421c71 100644
--- a/drivers/staging/dgnc/dgnc_neo.c
+++ b/drivers/staging/dgnc/dgnc_neo.c
@@ -1404,17 +1404,17 @@ static int neo_drain(struct tty_struct *tty, uint 
seconds)
int rc = 0;
 
if (!tty || tty->magic != TTY_MAGIC) {
-   return (-ENXIO);
+   return -ENXIO;
}
 
un = (struct un_t *) tty->driver_data;
if (!un || un->magic != DGNC_UNIT_MAGIC) {
-   return (-ENXIO);
+   return -ENXIO;
}
 
ch = un->un_ch;
if (!ch || ch->magic != DGNC_CHANNEL_MAGIC) {
-   return (-ENXIO);
+   return -ENXIO;
}
 
DPR_IOCTL(("%d Drain wait started.\n", __LINE__));
@@ -1439,7 +1439,7 @@ static int neo_drain(struct tty_struct *tty, uint seconds)
DPR_IOCTL(("%d Drain wait finished.\n", __LINE__));
}
 
-   return (rc);
+   return rc;
 }
 
 
-- 
1.8.1.2

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


[PATCH 05/12] staging: dgnc: driver.h: removes struct board_t

2013-08-31 Thread Lidza Louina
This patch removes the struct board_t. This struct
was replaced with dgnc_board in a previous patch.

Signed-off-by: Lidza Louina 
---
 drivers/staging/dgnc/dgnc_driver.h | 85 --
 1 file changed, 85 deletions(-)

diff --git a/drivers/staging/dgnc/dgnc_driver.h 
b/drivers/staging/dgnc/dgnc_driver.h
index 3d0394d..d4a830b 100644
--- a/drivers/staging/dgnc/dgnc_driver.h
+++ b/drivers/staging/dgnc/dgnc_driver.h
@@ -282,91 +282,6 @@ struct board_ops {
 /*
  * Per-board information
  */
-struct board_t {
-   int magic;  /* Board Magic number.  */
-   int boardnum;   /* Board number: 0-32 */
-
-   int type;   /* Type of board */
-   char*name;  /* Product Name */
-   struct pci_dev  *pdev;  /* Pointer to the pci_dev struct */
-   unsigned long   bd_flags;   /* Board flags */
-   u16 vendor; /* PCI vendor ID */
-   u16 device; /* PCI device ID */
-   u16 subvendor;  /* PCI subsystem vendor ID */
-   u16 subdevice;  /* PCI subsystem device ID */
-   uchar   rev;/* PCI revision ID */
-   uintpci_bus;/* PCI bus value */
-   uintpci_slot;   /* PCI slot value */
-   uintmaxports;   /* MAX ports this board can handle */
-   uchar   dvid;   /* Board specific device id */
-   uchar   vpd[128];   /* VPD of board, if found */
-   uchar   serial_num[20]; /* Serial number of board, if found in 
VPD */
-
-   spinlock_t  bd_lock;/* Used to protect board */
-
-   spinlock_t  bd_intr_lock;   /* Used to protect the poller tasklet 
and
-* the interrupt routine from each 
other.
-*/
-
-   uintstate;  /* State of card. */
-   wait_queue_head_t state_wait;   /* Place to sleep on for state change */
-
-   struct  tasklet_struct helper_tasklet; /* Poll helper tasklet */
-
-   uintnasync; /* Number of ports on card */
-
-   uintirq;/* Interrupt request number */
-   ulong   intr_count; /* Count of interrupts */
-   ulong   intr_modem; /* Count of interrupts */
-   ulong   intr_tx;/* Count of interrupts */
-   ulong   intr_rx;/* Count of interrupts */
-
-   ulong   membase;/* Start of base memory of the card */
-   ulong   membase_end;/* End of base memory of the card */
-
-   u8 __iomem  *re_map_membase;/* Remapped memory of the card 
*/
-
-   ulong   iobase; /* Start of io base of the card */
-   ulong   iobase_end; /* End of io base of the card */
-
-   uintbd_uart_offset; /* Space between each UART */
-
-   struct channel_t *channels[MAXPORTS]; /* array of pointers to our 
channels. */
-
-   struct tty_driver   SerialDriver;
-   charSerialName[200];
-   struct tty_driver   PrintDriver;
-   charPrintName[200];
-
-   uintdgnc_Major_Serial_Registered;
-   uintdgnc_Major_TransparentPrint_Registered;
-
-   uintdgnc_Serial_Major;
-   uintdgnc_TransparentPrint_Major;
-
-   uintTtyRefCnt;
-
-   char*flipbuf;   /* Our flip buffer, alloced if board is 
found */
-
-   u16 dpatype;/* The board "type", as defined by DPA 
*/
-   u16 dpastatus;  /* The board "status", as defined by 
DPA */
-
-   /*
-*  Mgmt data.
-*/
-   char*msgbuf_head;
-   char*msgbuf;
-
-   uintbd_dividend;/* Board/UARTs specific dividend */
-
-   struct board_ops *bd_ops;
-
-   /* /proc/ entries */
-   struct proc_dir_entry *proc_entry_pointer;
-   struct dgnc_proc_entry *dgnc_board_table;
-
-};
-
 struct dgnc_board {
int magic;  /* Board Magic number.  */
int boardnum;   /* Board number: 0-32 */
-- 
1.8.1.2

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


[PATCH] staging: asus_oled: Create device attributes automatically

2013-08-31 Thread Guenter Roeck
The 'enable' and 'picture' attributes are created for all oled_class devices.
They can be created automatically when creating the oled_class device.
This simplifies the code and ensures that the attributes exist when the
udev event announcing device registration is generated.

Signed-off-by: Guenter Roeck 
---
The class 'version' attribute could be created in a similar fashion, but that
would mean not using the existing class ABI defines and function to create
a class attribute displaying a fixed string. Since this is true for pretty much
every driver using CLASS_ATTR_STRING, a more generic solution might be better.

Compile tested only.

 drivers/staging/asus_oled/asus_oled.c |   58 +
 1 file changed, 23 insertions(+), 35 deletions(-)

diff --git a/drivers/staging/asus_oled/asus_oled.c 
b/drivers/staging/asus_oled/asus_oled.c
index 3654dc3..afe91b6 100644
--- a/drivers/staging/asus_oled/asus_oled.c
+++ b/drivers/staging/asus_oled/asus_oled.c
@@ -59,7 +59,6 @@ MODULE_DESCRIPTION("Asus OLED Driver");
 MODULE_LICENSE("GPL");
 MODULE_VERSION(ASUS_OLED_VERSION);
 
-static struct class *oled_class;
 static int oled_num;
 
 static uint start_off;
@@ -625,9 +624,18 @@ static DEVICE_ATTR(asus_oled_enabled, S_IWUSR | S_IRUGO,
   get_enabled, set_enabled);
 static DEVICE_ATTR(asus_oled_picture, S_IWUSR , NULL, set_picture);
 
-static DEVICE_ATTR(enabled, S_IWUSR | S_IRUGO,
-  class_get_enabled, class_set_enabled);
-static DEVICE_ATTR(picture, S_IWUSR, NULL, class_set_picture);
+static struct device_attribute oled_dev_attributes[] = {
+   __ATTR(enabled, S_IWUSR | S_IRUGO, class_get_enabled,
+  class_set_enabled),
+   __ATTR(picture, S_IWUSR, NULL, class_set_picture),
+   { }
+};
+
+static struct class oled_class = {
+   .owner = THIS_MODULE,
+   .name = ASUS_OLED_UNDERSCORE_NAME,
+   .dev_attrs = oled_dev_attributes,
+};
 
 static int asus_oled_probe(struct usb_interface *interface,
   const struct usb_device_id *id)
@@ -693,24 +701,13 @@ static int asus_oled_probe(struct usb_interface 
*interface,
if (retval)
goto err_files;
 
-   odev->dev = device_create(oled_class, &interface->dev, MKDEV(0, 0),
- NULL, "oled_%d", ++oled_num);
-
+   odev->dev = device_create(&oled_class, &interface->dev, MKDEV(0, 0),
+ odev, "oled_%d", ++oled_num);
if (IS_ERR(odev->dev)) {
retval = PTR_ERR(odev->dev);
goto err_files;
}
 
-   dev_set_drvdata(odev->dev, odev);
-
-   retval = device_create_file(odev->dev, &dev_attr_enabled);
-   if (retval)
-   goto err_class_enabled;
-
-   retval = device_create_file(odev->dev, &dev_attr_picture);
-   if (retval)
-   goto err_class_picture;
-
dev_info(&interface->dev,
 "Attached Asus OLED device: %s [width %u, pack_mode %d]\n",
 desc, odev->dev_width, odev->pack_mode);
@@ -720,13 +717,6 @@ static int asus_oled_probe(struct usb_interface *interface,
 
return 0;
 
-err_class_picture:
-   device_remove_file(odev->dev, &dev_attr_picture);
-
-err_class_enabled:
-   device_remove_file(odev->dev, &dev_attr_enabled);
-   device_unregister(odev->dev);
-
 err_files:
device_remove_file(&interface->dev, &ASUS_OLED_DEVICE_ATTR(enabled));
device_remove_file(&interface->dev, &ASUS_OLED_DEVICE_ATTR(picture));
@@ -745,8 +735,6 @@ static void asus_oled_disconnect(struct usb_interface 
*interface)
odev = usb_get_intfdata(interface);
usb_set_intfdata(interface, NULL);
 
-   device_remove_file(odev->dev, &dev_attr_picture);
-   device_remove_file(odev->dev, &dev_attr_enabled);
device_unregister(odev->dev);
 
device_remove_file(&interface->dev, &ASUS_OLED_DEVICE_ATTR(picture));
@@ -807,15 +795,15 @@ static CLASS_ATTR_STRING(version, S_IRUGO,
 
 static int __init asus_oled_init(void)
 {
-   int retval = 0;
-   oled_class = class_create(THIS_MODULE, ASUS_OLED_UNDERSCORE_NAME);
+   int retval;
 
-   if (IS_ERR(oled_class)) {
-   pr_err("Error creating " ASUS_OLED_UNDERSCORE_NAME " class\n");
-   return PTR_ERR(oled_class);
+   retval = class_register(&oled_class);
+   if (retval) {
+   pr_err("Error registering " ASUS_OLED_UNDERSCORE_NAME " 
class\n");
+   return retval;
}
 
-   retval = class_create_file(oled_class, &class_attr_version.attr);
+   retval = class_create_file(&oled_class, &class_attr_version.attr);
if (retval) {
pr_err("Error creating class version file\n");
goto error;
@@ -831,15 +819,15 @@ static int __init asus_oled_init(void)
return retval;
 
 error:
-   class_destroy(oled_class);
+   class_unregister(&oled_class);
return retval;
 }
 

[PATCH] staging: dgrp: Convert to use device_create_with_groups

2013-08-31 Thread Guenter Roeck
Use device_create_with_groups to create sysfs attributes together with device.
Also create class attribute together with class registration.
This simplifies the code and ensures that attribute files exist when udev
events are generated.

Signed-off-by: Guenter Roeck 
---
I suspect that the 'register_with_sysfs' attribute exists to work around
the problem solved with this patch. It doesn't make much sense otherwise.
Can it be removed ?

Compile tested only.

 drivers/staging/dgrp/dgrp_sysfs.c |   97 +++--
 1 file changed, 39 insertions(+), 58 deletions(-)

diff --git a/drivers/staging/dgrp/dgrp_sysfs.c 
b/drivers/staging/dgrp/dgrp_sysfs.c
index 8cee9c8..b65fa83 100644
--- a/drivers/staging/dgrp/dgrp_sysfs.c
+++ b/drivers/staging/dgrp/dgrp_sysfs.c
@@ -31,7 +31,6 @@
 #define SERIAL_TYPE_XPRINT  3
 
 
-static struct class *dgrp_class;
 static struct device *dgrp_class_nodes_dev;
 static struct device *dgrp_class_global_settings_dev;
 
@@ -41,8 +40,17 @@ static ssize_t dgrp_class_version_show(struct class *class,
 {
return snprintf(buf, PAGE_SIZE, "%s\n", DIGI_VERSION);
 }
-static CLASS_ATTR(driver_version, 0400, dgrp_class_version_show, NULL);
 
+struct class_attribute dgrp_class_attrs[] = {
+   __ATTR(driver_version, 0400, dgrp_class_version_show, NULL),
+   { }
+};
+
+static struct class dgrp_class = {
+   .owner = THIS_MODULE,
+   .name = "digi_realport",
+   .class_attrs = dgrp_class_attrs,
+};
 
 static ssize_t dgrp_class_register_with_sysfs_show(struct device *c,
   struct device_attribute 
*attr,
@@ -83,51 +91,41 @@ static struct attribute_group 
dgrp_global_settings_attribute_group = {
.attrs = dgrp_sysfs_global_settings_entries,
 };
 
-
+static const struct attribute_group *dgrp_global_settings_attribute_groups[] = 
{
+   &dgrp_global_settings_attribute_group,
+   NULL
+};
 
 int dgrp_create_class_sysfs_files(void)
 {
-   int ret = 0;
+   int ret;
int max_majors = 1U << (32 - MINORBITS);
 
-   dgrp_class = class_create(THIS_MODULE, "digi_realport");
-   if (IS_ERR(dgrp_class))
-   return PTR_ERR(dgrp_class);
-   ret = class_create_file(dgrp_class, &class_attr_driver_version);
+   ret = class_register(&dgrp_class);
if (ret)
-   goto err_class;
+   return ret;
 
-   dgrp_class_global_settings_dev = device_create(dgrp_class, NULL,
-   MKDEV(0, max_majors + 1), NULL, "driver_settings");
+   dgrp_class_global_settings_dev =
+ device_create_with_groups(&dgrp_class, NULL, MKDEV(0, max_majors + 1),
+   NULL, dgrp_global_settings_attribute_groups,
+   "driver_settings");
if (IS_ERR(dgrp_class_global_settings_dev)) {
ret = PTR_ERR(dgrp_class_global_settings_dev);
-   goto err_file;
-   }
-   ret = sysfs_create_group(&dgrp_class_global_settings_dev->kobj,
-   &dgrp_global_settings_attribute_group);
-   if (ret) {
-   pr_alert("%s: failed to create sysfs global settings device 
attributes.\n",
-   __func__);
-   goto err_dev1;
+   goto err_class;
}
 
-   dgrp_class_nodes_dev = device_create(dgrp_class, NULL,
+   dgrp_class_nodes_dev = device_create(&dgrp_class, NULL,
MKDEV(0, max_majors + 2), NULL, "nodes");
if (IS_ERR(dgrp_class_nodes_dev)) {
ret = PTR_ERR(dgrp_class_nodes_dev);
-   goto err_group;
+   goto err_dev1;
}
 
return 0;
-err_group:
-   sysfs_remove_group(&dgrp_class_global_settings_dev->kobj,
-   &dgrp_global_settings_attribute_group);
 err_dev1:
-   device_destroy(dgrp_class, MKDEV(0, max_majors + 1));
-err_file:
-   class_remove_file(dgrp_class, &class_attr_driver_version);
+   device_destroy(&dgrp_class, MKDEV(0, max_majors + 1));
 err_class:
-   class_destroy(dgrp_class);
+   class_unregister(&dgrp_class);
return ret;
 }
 
@@ -140,14 +138,9 @@ void dgrp_remove_class_sysfs_files(void)
list_for_each_entry(nd, &nd_struct_list, list)
dgrp_remove_node_class_sysfs_files(nd);
 
-   sysfs_remove_group(&dgrp_class_global_settings_dev->kobj,
-   &dgrp_global_settings_attribute_group);
-
-   class_remove_file(dgrp_class, &class_attr_driver_version);
-
-   device_destroy(dgrp_class, MKDEV(0, max_majors + 1));
-   device_destroy(dgrp_class, MKDEV(0, max_majors + 2));
-   class_destroy(dgrp_class);
+   device_destroy(&dgrp_class, MKDEV(0, max_majors + 1));
+   device_destroy(&dgrp_class, MKDEV(0, max_majors + 2));
+   class_unregister(&dgrp_class);
 }
 
 static ssize_t dgrp_node_state_show(struct device *c,
@@ -261,10 +254,13 @@ static struct attribute_group dgrp_node_attribute_group = 
{
.attrs

Re: [PATCH v2] staging: android/timed_output: Create 'enable' attribute automatically

2013-08-31 Thread Guenter Roeck

On 08/31/2013 01:20 PM, Guenter Roeck wrote:

The 'enable' attribute is needed for all timed_output_class devices.
It can thus be created automatically when creating the timed_output device.
This simplifies the code and ensures that the attribute exists when the
udev event announcing device registration is generated.

Signed-off-by: Guenter Roeck 


Just noticed that Greg already queued a patch to fix this problem.
Sorry for the noise.

Guenter


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


Re: [PATCH] staging: asus_oled: Create device attributes automatically

2013-08-31 Thread Guenter Roeck

On 08/31/2013 03:24 PM, Guenter Roeck wrote:

The 'enable' and 'picture' attributes are created for all oled_class devices.
They can be created automatically when creating the oled_class device.
This simplifies the code and ensures that the attributes exist when the
udev event announcing device registration is generated.

Signed-off-by: Guenter Roeck 


Just noticed that the driver is gone from -next.
Oh well. Sorry for the noise.

Guenter


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


Re: [PATCH v2 net-next 0/9] set addr_assign_type when inheriting a dev_addr

2013-08-31 Thread David Miller
From: Bjørn Mork 
Date: Fri, 30 Aug 2013 18:08:43 +0200

> Copying the dev_addr from a parent device is an operation
> common to a number of drivers. The addr_assign_type should
> be updated accordingly, either by reusing the value from
> the source device or explicitly indicating that the address
> is stolen by setting addr_assign_type to NET_ADDR_STOLEN.
> 
> This patch set adds a helper copying both the dev_addr and
> the addr_assign_type, and use this helper in drivers which
> don't currently set the addr_assign_type. Using NET_ADDR_STOLEN
> might be more appropriate in some of these cases.  Please
> let me know, and I'll update the patch accordingly.
> 
> Changes in v2:
>  - assuming addr_len == ETH_ALEN to allow optimized memcpy
>  - dropped the vt6656 patch due to addr_len being unset in that driver

Looks good, series applied, thanks.
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel