Re: vme_ca91cx42.c

2012-09-24 Thread Martyn Welch
On 20/09/12 15:13, gschr...@beyondelectronics.us wrote:
 
 We are currently attempting to write a validation suite for the
 vme_ca91cx42 driver (Tundra Universe currently in staging) and are looking
 for starting points.  I have found a significant amount of code and
 documentation, but am unsure what is current.  Any pointers would be
 greatly appreciated.
 

Hi George,

There is an in-kernel API. This is documented in the vme_api.txt file found in
Documentation/ (or drivers/staging/vme for older kernels, prior to the
migration from staging).

The user space module only supports features that can be sanely used from user
space (so no interrupt support for example). This module is also still in
staging and is likely to change a lot before being in an acceptable state to
leave staging.

Hope that helps,

Martyn

 Thank you,
 
 George
 
 George Schreck
 C.T.O.
 
 Beyond Electronics Corporation
 www.beyondelectronics.us
 ph 919-231-8000 ext 400
 
 ___
 devel mailing list
 devel@linuxdriverproject.org
 http://driverdev.linuxdriverproject.org/mailman/listinfo/devel
 


-- 
Martyn Welch (Lead Software Engineer)  | Registered in England and Wales
GE Intelligent Platforms   | (3828642) at 100 Barbirolli Square
T +44(0)1327322748 | Manchester, M2 3AB
E martyn.we...@ge.com  | VAT:GB 927559189
___
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/devel


Re: [RFC] mm: add support for zsmalloc and zcache

2012-09-24 Thread Mel Gorman
On Sat, Sep 22, 2012 at 02:18:44PM -0700, Dan Magenheimer wrote:
  From: Mel Gorman [mailto:mgor...@suse.de]
  Subject: Re: [RFC] mm: add support for zsmalloc and zcache
  
  On Fri, Sep 21, 2012 at 01:35:15PM -0700, Dan Magenheimer wrote:
From: Seth Jennings [mailto:sjenn...@linux.vnet.ibm.com]
Subject: Re: [RFC] mm: add support for zsmalloc and zcache
   The two proposals:
   A) Recreate all the work done for zcache2 as a proper sequence of
  independent patches and apply them to zcache1. (Seth/Konrad)
   B) Add zsmalloc back in to zcache2 as an alternative allocator
  for frontswap pages. (Dan)
  
  Throwing it out there but 
  
  C) Merge both, but freeze zcache1 except for critical fixes. Only allow
 future work on zcache2. Document limitations of zcache1 and
 workarounds until zcache2 is fully production ready.
 
 Hi Mel (with request for Seth below) --
 
 (C) may be the politically-expedient solution but, personally,
 I think it is a bit insane and I suspect that any mm developer
 who were to deeply review both codebases side-by-side would come to
 the same conclusion. 

I have not read zcache2 and maybe it is the case that no one in their
right mind would use zcache1 if zcache2 was available but the discussion
keeps going in circles.

 The cost in developer/maintainer time,
 and the confusion presented to the user/distro base if both
 are promoted/merged would be way too high, and IMHO completely
 unwarranted.  Let me try to explain...
 

What would the impact be if zcache2 and zcache1 were mutually exclusive
in Kconfig and the naming was as follows?

CONFIG_ZCACHE_DEPRECATED(zcache1)
CONFIG_ZCACHE   (zcache2)

That would make it absolutely clear to distributions which one they should
be enabling and also make it clear that all future development happen
on zcache2.

I know it looks insane to promote something that is instantly deprecated
but none of the other alternatives seem to be gaining traction either.
This would at least allow the people who are currently heavily behind
zcache1 to continue supporting it and applying critical fixes until they
move to zcache2.

 I use the terms zcache1 and zcache2 only to clarify which
 codebase, not because they are dramatically different. I estimate
 that 85%-90% of the code in zcache1 and zcache2 is identical, not
 counting the allocator or comments/whitespace/janitorial!
 

If 85-90% of the code is identicial then they really should be sharing
the code rather than making copies. That will result in some monolithic
patches but it's unavoidable. I expect it would end up looking like

Patch 1 promote zcache1
Patch 2 promote zcache2
Patch 3 move shared code for zcache1,zcache2 to common files

If the shared code is really shared and not copied it may reduce some of
the friction between the camps.

 Zcache2 _is_ zcache1 with some good stuff added and with zsmalloc
 dropped.  I think after careful study, there would be wide agreement
 among mm developers that the stuff added is all moving in the direction
 of making zcache production-ready.  IMHO, zcache1 has _never_
 been production-ready, and zcache2 is merely a big step in the right
 direction.
 

zcache1 does appear to have a few snarls that would make me wary of having
to support it. I don't know if zcache2 suffers the same problems or not
as I have not read it.

 (Quick logistical aside: zcache2 is in staging-next and linux-next,
 currently housed under the drivers/staging/ramster directory...
 with !CONFIG_RAMSTER, ramster _is_ zcache2.)
 

Unfortunately, I'm not going to get the chance to review it in the
short-term. However, if zcache1 and zcache2 shared code in common files
it would at least reduce the amount of new code I have to read :)

 Seth (and IBM) seems to have a bee in his bonnet that the existing
 zcache1 code _must_ be promoted _soon_ with as little change as possible.
 Other than the fact that he didn't like my patching approach [1],
 the only technical objection Seth has raised to zcache2 is that he
 thinks zsmalloc is the best choice of allocator [2] for his limited
 benchmarking [3].
 

FWIW, I would fear that kernbench is not that interesting a benchmark for
something like zcache. From an MM perspective, I would be wary that the
data compresses too well and fits too neatly in the different buckets and
make zsmalloc appear to behave much better than it would for a more general
workload.  Of greater concern is that the allocations for zcache would be
too short lived to measure if external fragmentation was a real problem
or not. This is pure guesswork as I didn't read zsmalloc but this is the
sort of problem I'd be looking out for if I did review it. In practice,
I would probably prefer to depend on zbud because it avoids the external
fragmentation problem even if it wasted memory but that's just me being
cautious.

 I've offered to put zsmalloc back in to zcache2 as an optional
 (even default) allocator, but that 

Re: [PATCH] Staging:bcm: fix coding style issue in Bcmchar.c

2012-09-24 Thread Dan Carpenter
On Mon, Sep 24, 2012 at 04:44:43PM +0600, Gorskin Ilya wrote:
 This is a patch to the Bcmchar.c file that fixes up a coding style
 warning found by the checkpatch.pl tool
 

The right way to fix this is to choose better variable names and to
get rid of the bogus BCM_DEBUG_PRINT() macro.  It's better to leave
the warnings in for now.

checkpatch.pl is not the king of us.

regards,
dan carpenter

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


Re: [PATCH 3/8] Staging: bcm: Remove typedef for _stLocalSFAddIndication and call directly.

2012-09-24 Thread Dan Carpenter
On Sun, Sep 23, 2012 at 11:07:12PM -0400, Kevin McKinney wrote:
 - pstAddIndication = kmalloc(sizeof(*pstAddIndication), GFP_KERNEL);
 + pstAddIndication = kmalloc(sizeof(struct bcm_add_indication), 
 GFP_KERNEL);

Don't resend, but the style was still better in the original.

regards,
dan carpenter

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


Re: [PATCH 8/8] Staging: bcm: Remove typedef for _stCPacketClassificationRuleSI and call directly.

2012-09-24 Thread Dan Carpenter
On Sun, Sep 23, 2012 at 11:07:17PM -0400, Kevin McKinney wrote:
 This patch removes typedef for
 _stCPacketClassificationRuleSI, changes the
 name of the struct to bcm_packet_class_rules,
 and updates the comments appropriately . In
 addition, any calls to typedefs
 CCPacketClassificationRuleSI,
 stCPacketClassificationRuleSI,
 or *pstCPacketClassificationRuleSI are changed
 to call the struct directly.
 
 Signed-off-by: Kevin McKinney klmckinn...@gmail.com

These all look good.

Acked-by: Dan Carpenter dan.carpen...@oracle.com

regards,
dan carpenter

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


Re: vme_ca91cx42.c

2012-09-24 Thread gschreck
On Mon, 24 Sep 2012 11:00:17 +0100, Martyn Welch martyn.we...@ge.com
wrote:
 On 20/09/12 15:13, gschr...@beyondelectronics.us wrote:
snip
 
 Hi George,
 
 There is an in-kernel API. This is documented in the vme_api.txt file
 found in
 Documentation/ (or drivers/staging/vme for older kernels, prior to the
 migration from staging).
 
 The user space module only supports features that can be sanely used
from
 user
 space (so no interrupt support for example). This module is also still
in
 staging and is likely to change a lot before being in an acceptable
state
 to
 leave staging.
 
 Hope that helps,
 
 Martyn
 
snip

Hi Martyn,

Thank you for the pointers.  Once we get caught up with you, we will send
some comments / code back.

George


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


[PATCH v2 0/3] staging: comedi: avoid mixing __user and kernel pointers

2012-09-24 Thread Ian Abbott
Some patches from the v1 sequence of 9 patches that were nothing to do
with mixing __user and kernel pointers have already been applied by
Greg, leaving 4 patches unapplied.  For v2, I've combined 2 of those 4
patches, reordered them, slightly modified one of them and changed the
commit messages.

Patch 1 in v2 corresponds to patch 4 in v1.  Patch 2 in v2 corresponds
to patch 9 in v1.  Patch 3 in v2 corresponds to patches 1 and 2 in v1.

I should point out that Dan Carpenter objected to this change in v1 and
nothing has been done to address that in v2.  It's a difference of
opinion.

As remarked in the original patch sequence, one of these patches (patch
2 this time) contains a couple of overlength lines in pcmmio.c and
pcmuio.c as the affected functions need a serious amount of
refactoring.  At least the patched lines are slightly shorter than the
originals!

Patch 1) staging: comedi: add chanlist to do_cmdtest() handlers
Patch 2) staging: comedi: put command channel list in async structure
Patch 3) staging: comedi: add __user tag to chanlist

 drivers/staging/comedi/comedi.h|   2 +-
 drivers/staging/comedi/comedi_fops.c   |  31 +++---
 drivers/staging/comedi/comedidev.h |   3 +-
 drivers/staging/comedi/drivers/8255.c  |   3 +-
 .../staging/comedi/drivers/addi-data/addi_common.h |   2 +-
 .../comedi/drivers/addi-data/hwdrv_apci3120.c  |  36 ---
 .../comedi/drivers/addi-data/hwdrv_apci3120.h  |   6 +-
 .../comedi/drivers/addi-data/hwdrv_apci3200.c  |  55 +-
 .../comedi/drivers/addi-data/hwdrv_apci3200.h  |   6 +-
 drivers/staging/comedi/drivers/adl_pci9111.c   |  20 ++--
 drivers/staging/comedi/drivers/adl_pci9118.c   |  15 +--
 drivers/staging/comedi/drivers/adv_pci1710.c   |  15 +--
 drivers/staging/comedi/drivers/amplc_dio200.c  |  12 ++-
 drivers/staging/comedi/drivers/amplc_pc236.c   |   3 +-
 drivers/staging/comedi/drivers/amplc_pci224.c  |  24 +++--
 drivers/staging/comedi/drivers/amplc_pci230.c  |  61 ++-
 drivers/staging/comedi/drivers/cb_das16_cs.c   |   3 +-
 drivers/staging/comedi/drivers/cb_pcidas.c |  41 
 drivers/staging/comedi/drivers/cb_pcidas64.c   | 117 +++--
 drivers/staging/comedi/drivers/cb_pcidda.c |   3 +-
 drivers/staging/comedi/drivers/comedi_parport.c|   3 +-
 drivers/staging/comedi/drivers/comedi_test.c   |  10 +-
 drivers/staging/comedi/drivers/das16.c |  19 ++--
 drivers/staging/comedi/drivers/das16m1.c   |  12 ++-
 drivers/staging/comedi/drivers/das1800.c   |  29 ++---
 drivers/staging/comedi/drivers/das800.c|  21 ++--
 drivers/staging/comedi/drivers/dmm32at.c   |  23 ++--
 drivers/staging/comedi/drivers/dt2814.c|   9 +-
 drivers/staging/comedi/drivers/dt282x.c|  14 ++-
 drivers/staging/comedi/drivers/dt3000.c|  13 ++-
 drivers/staging/comedi/drivers/gsc_hpdi.c  |  12 +--
 drivers/staging/comedi/drivers/me4000.c|  46 
 drivers/staging/comedi/drivers/me_daq.c|   3 +-
 drivers/staging/comedi/drivers/ni_6527.c   |   3 +-
 drivers/staging/comedi/drivers/ni_65xx.c   |   3 +-
 drivers/staging/comedi/drivers/ni_660x.c   |   5 +-
 drivers/staging/comedi/drivers/ni_at_a2150.c   |  22 ++--
 drivers/staging/comedi/drivers/ni_atmio16d.c   |  11 +-
 drivers/staging/comedi/drivers/ni_labpc.c  |  52 -
 drivers/staging/comedi/drivers/ni_mio_common.c |  58 ++
 drivers/staging/comedi/drivers/ni_pcidio.c |   6 +-
 drivers/staging/comedi/drivers/ni_tio.h|   3 +-
 drivers/staging/comedi/drivers/ni_tiocmd.c |   3 +-
 drivers/staging/comedi/drivers/pcl711.c|   9 +-
 drivers/staging/comedi/drivers/pcl812.c|   9 +-
 drivers/staging/comedi/drivers/pcl816.c|  29 ++---
 drivers/staging/comedi/drivers/pcl818.c|  28 ++---
 drivers/staging/comedi/drivers/pcm_common.c|   3 +-
 drivers/staging/comedi/drivers/pcm_common.h|   3 +-
 drivers/staging/comedi/drivers/pcmmio.c|  21 ++--
 drivers/staging/comedi/drivers/pcmuio.c|  21 ++--
 drivers/staging/comedi/drivers/quatech_daqp_cs.c   |   9 +-
 drivers/staging/comedi/drivers/rtd520.c|  12 ++-
 drivers/staging/comedi/drivers/s626.c  |  26 ++---
 drivers/staging/comedi/drivers/skel.c  |   6 +-
 drivers/staging/comedi/drivers/usbdux.c|  21 ++--
 drivers/staging/comedi/drivers/usbduxfast.c|  27 ++---
 drivers/staging/comedi/drivers/usbduxsigma.c   |  16 ++-
 58 files changed, 607 insertions(+), 471 deletions(-)
___
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/devel


[PATCH 3/3] staging: comedi: add __user tag to chanlist

2012-09-24 Thread Ian Abbott
This reverts staging: comedi: comedi.h: remove __user tag from
chanlist by H Hartley Sweeten on 2012-09-18 (committed by Greg
Kroah-Hartman on Wed Sep 19 09:36:44 2012 +0100), and also removes a
couple of `__user` casts that are now unnecessary and a couple of
`__force` casts that are now wrong.

The `chanlist` member of `struct comedi_cmd` is used by the `COMEDI_CMD`
and `COMEDI_CMDTEST` ioctls where it points to a channel list in user
memory (but it may be `NULL` for the `COMEDI_CMDTEST` ioctl).
Previously, the `chanlist` member pointed to a kernel copy of the
channel list in other contexts, but that is no longer the case.

Signed-off-by: Ian Abbott abbo...@mev.co.uk
---
v2: Reordered patch sequence.  Combined original patches 1 and 2 to
avoid introducing sparse warnings.
---
 drivers/staging/comedi/comedi.h  | 2 +-
 drivers/staging/comedi/comedi_fops.c | 8 
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/comedi/comedi.h b/drivers/staging/comedi/comedi.h
index 133f013..76cdb2c 100644
--- a/drivers/staging/comedi/comedi.h
+++ b/drivers/staging/comedi/comedi.h
@@ -365,7 +365,7 @@ struct comedi_cmd {
unsigned int stop_src;
unsigned int stop_arg;
 
-   unsigned int *chanlist; /* channel/range list */
+   unsigned int __user *chanlist;  /* channel/range list */
unsigned int chanlist_len;
 
short __user *data; /* data list, size depends on subd flags */
diff --git a/drivers/staging/comedi/comedi_fops.c 
b/drivers/staging/comedi/comedi_fops.c
index 41dbe68..9433aae 100644
--- a/drivers/staging/comedi/comedi_fops.c
+++ b/drivers/staging/comedi/comedi_fops.c
@@ -1145,7 +1145,7 @@ static int do_cmd_ioctl(struct comedi_device *dev,
return -EFAULT;
}
/* save user's chanlist pointer so it can be restored later */
-   user_chanlist = (unsigned int __user *)cmd.chanlist;
+   user_chanlist = cmd.chanlist;
 
if (cmd.subdev = dev-n_subdevices) {
DPRINTK(%d no such subdevice\n, cmd.subdev);
@@ -1229,7 +1229,7 @@ static int do_cmd_ioctl(struct comedi_device *dev,
DPRINTK(test returned %d\n, ret);
cmd = async-cmd;
/* restore chanlist pointer before copying back */
-   cmd.chanlist = (unsigned int __force *)user_chanlist;
+   cmd.chanlist = user_chanlist;
cmd.data = NULL;
if (copy_to_user(arg, cmd, sizeof(struct comedi_cmd))) {
DPRINTK(fault writing cmd\n);
@@ -1295,7 +1295,7 @@ static int do_cmdtest_ioctl(struct comedi_device *dev,
return -EFAULT;
}
/* save user's chanlist pointer so it can be restored later */
-   user_chanlist = (unsigned int __user *)cmd.chanlist;
+   user_chanlist = cmd.chanlist;
 
if (cmd.subdev = dev-n_subdevices) {
DPRINTK(%d no such subdevice\n, cmd.subdev);
@@ -1351,7 +1351,7 @@ static int do_cmdtest_ioctl(struct comedi_device *dev,
ret = s-do_cmdtest(dev, s, cmd, chanlist);
 
/* restore chanlist pointer before copying back */
-   cmd.chanlist = (unsigned int __force *)user_chanlist;
+   cmd.chanlist = user_chanlist;
if (copy_to_user(arg, cmd, sizeof(struct comedi_cmd))) {
DPRINTK(bad cmd address\n);
ret = -EFAULT;
-- 
1.7.12

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


Re: [PATCH v2 0/3] staging: comedi: avoid mixing __user and kernel pointers

2012-09-24 Thread Dan Carpenter
On Mon, Sep 24, 2012 at 01:34:11PM +0100, Ian Abbott wrote:
 Some patches from the v1 sequence of 9 patches that were nothing to do
 with mixing __user and kernel pointers have already been applied by
 Greg, leaving 4 patches unapplied.  For v2, I've combined 2 of those 4
 patches, reordered them, slightly modified one of them and changed the
 commit messages.
 
 Patch 1 in v2 corresponds to patch 4 in v1.  Patch 2 in v2 corresponds
 to patch 9 in v1.  Patch 3 in v2 corresponds to patches 1 and 2 in v1.
 
 I should point out that Dan Carpenter objected to this change in v1 and
 nothing has been done to address that in v2.  It's a difference of
 opinion.
 

Yep. I do still think that this patchset is the wrong idea and the
current code is cleaner.  I don't understand the urgency either.

But it's your code...  *shrug*.

regards,
dan carpenter

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


Re: [PATCH 3/8] Staging: bcm: Remove typedef for _stLocalSFAddIndication and call directly.

2012-09-24 Thread Kevin McKinney
On Mon, Sep 24, 2012 at 6:57 AM, Dan Carpenter dan.carpen...@oracle.com wrote:
 On Sun, Sep 23, 2012 at 11:07:12PM -0400, Kevin McKinney wrote:
 - pstAddIndication = kmalloc(sizeof(*pstAddIndication), GFP_KERNEL);
 + pstAddIndication = kmalloc(sizeof(struct bcm_add_indication), 
 GFP_KERNEL);

 Don't resend, but the style was still better in the original.

Okay, I can change the style back to the original in a future patch?
That is no problem, but I am not sure what style you are referring?
Are you referring to this: sizeof(struct bcm_add_indication)?  Do
you want me to change this statement?

By the way, I was able to locate a complete setup / installation for
this hardware here:
https://sites.google.com/site/jrey42/Home/wimax
http://developer.sprint.com/getDocument.do?docId=101032

I am going to try to get the hardware installed and working so I can
test. Hopefully I can call sprint and get access in my area.  I am not
sure, but I will try!

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


Re: [PATCH 3/8] Staging: bcm: Remove typedef for _stLocalSFAddIndication and call directly.

2012-09-24 Thread Dan Carpenter
On Mon, Sep 24, 2012 at 09:46:05AM -0400, Kevin McKinney wrote:
 On Mon, Sep 24, 2012 at 6:57 AM, Dan Carpenter dan.carpen...@oracle.com 
 wrote:
  On Sun, Sep 23, 2012 at 11:07:12PM -0400, Kevin McKinney wrote:
  - pstAddIndication = kmalloc(sizeof(*pstAddIndication), GFP_KERNEL);
  + pstAddIndication = kmalloc(sizeof(struct bcm_add_indication), 
  GFP_KERNEL);
 
  Don't resend, but the style was still better in the original.
 
 Okay, I can change the style back to the original in a future patch?
 That is no problem, but I am not sure what style you are referring?
 Are you referring to this: sizeof(struct bcm_add_indication)?  Do
 you want me to change this statement?
 

It's not worth worrying about given the other problems in bcm.  :P
But I only complained about it because that line was an unneeded
change to begin with.

Better:
foo = kmalloc(sizeof(*foo), GFP_KERNEL);

Less preferred:
foo = kmalloc(sizeof(struct foo_type), GFP_KERNEL);

When we're reading code the first one is easiest to read.  For that
we don't need to care about what type foo is, we're allocating one
of whatever it is.  For the second one then there is a small
possibility that we're struct foo_type doesn't match with how foo
is declared.  Or the other justification for preferring the first
way is that if we change the type of foo then we don't have to
change the kmalloc() line as well, it gets updated automatically.

This isn't in CodingStyle, but it's still better style.  It's an
unenforced rule.  ;)

 By the way, I was able to locate a complete setup / installation for
 this hardware here:
 https://sites.google.com/site/jrey42/Home/wimax
 http://developer.sprint.com/getDocument.do?docId=101032
 
 I am going to try to get the hardware installed and working so I can
 test. Hopefully I can call sprint and get access in my area.  I am not
 sure, but I will try!

Sounds cool.  Rinat had this working.  Added to the CC list.  :)

regards,
dan carpenter

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


[PATCH] staging: comedi: jr3_pci: add __iomem tags

2012-09-24 Thread Ian Abbott
Tag pointers to remapped I/O memory with `__iomem` and remove the
`volatile` qualifiers.  Fix the single place in `jr3_pci_attach()` where
an I/O memory pointer is being dereferenced directly to use the
appropriate I/O memory access function.

Signed-off-by: Ian Abbott abbo...@mev.co.uk
---
 drivers/staging/comedi/drivers/jr3_pci.c | 35 
 drivers/staging/comedi/drivers/jr3_pci.h | 12 +--
 2 files changed, 24 insertions(+), 23 deletions(-)

diff --git a/drivers/staging/comedi/drivers/jr3_pci.c 
b/drivers/staging/comedi/drivers/jr3_pci.c
index 360107c..5b193ef 100644
--- a/drivers/staging/comedi/drivers/jr3_pci.c
+++ b/drivers/staging/comedi/drivers/jr3_pci.c
@@ -62,7 +62,7 @@ struct jr3_pci_dev_private {
 
struct pci_dev *pci_dev;
int pci_enabled;
-   volatile struct jr3_t *iobase;
+   struct jr3_t __iomem *iobase;
int n_channels;
struct timer_list timer;
 };
@@ -74,7 +74,7 @@ struct poll_delay_t {
 };
 
 struct jr3_pci_subdev_private {
-   volatile struct jr3_channel *channel;
+   struct jr3_channel __iomem *channel;
unsigned long next_time_min;
unsigned long next_time_max;
enum { state_jr3_poll,
@@ -138,7 +138,7 @@ static struct poll_delay_t poll_delay_min_max(int min, int 
max)
return result;
 }
 
-static int is_complete(volatile struct jr3_channel *channel)
+static int is_complete(struct jr3_channel __iomem *channel)
 {
return get_s16(channel-command_word0) == 0;
 }
@@ -150,7 +150,7 @@ struct transform_t {
} link[8];
 };
 
-static void set_transforms(volatile struct jr3_channel *channel,
+static void set_transforms(struct jr3_channel __iomem *channel,
   struct transform_t transf, short num)
 {
int i;
@@ -169,18 +169,18 @@ static void set_transforms(volatile struct jr3_channel 
*channel,
}
 }
 
-static void use_transform(volatile struct jr3_channel *channel,
+static void use_transform(struct jr3_channel __iomem *channel,
  short transf_num)
 {
set_s16(channel-command_word0, 0x0500 + (transf_num  0x000f));
 }
 
-static void use_offset(volatile struct jr3_channel *channel, short offset_num)
+static void use_offset(struct jr3_channel __iomem *channel, short offset_num)
 {
set_s16(channel-command_word0, 0x0600 + (offset_num  0x000f));
 }
 
-static void set_offset(volatile struct jr3_channel *channel)
+static void set_offset(struct jr3_channel __iomem *channel)
 {
set_s16(channel-command_word0, 0x0700);
 }
@@ -194,7 +194,7 @@ struct six_axis_t {
s16 mz;
 };
 
-static void set_full_scales(volatile struct jr3_channel *channel,
+static void set_full_scales(struct jr3_channel __iomem *channel,
struct six_axis_t full_scale)
 {
printk(%d %d %d %d %d %d\n,
@@ -210,7 +210,7 @@ static void set_full_scales(volatile struct jr3_channel 
*channel,
set_s16(channel-command_word0, 0x0a00);
 }
 
-static struct six_axis_t get_min_full_scales(volatile struct jr3_channel
+static struct six_axis_t get_min_full_scales(struct jr3_channel __iomem
 *channel)
 {
struct six_axis_t result;
@@ -223,7 +223,7 @@ static struct six_axis_t get_min_full_scales(volatile 
struct jr3_channel
return result;
 }
 
-static struct six_axis_t get_max_full_scales(volatile struct jr3_channel
+static struct six_axis_t get_max_full_scales(struct jr3_channel __iomem
 *channel)
 {
struct six_axis_t result;
@@ -492,7 +492,7 @@ static struct poll_delay_t jr3_pci_poll_subdevice(struct 
comedi_subdevice *s)
int i;
 
if (p) {
-   volatile struct jr3_channel *channel = p-channel;
+   struct jr3_channel __iomem *channel = p-channel;
int errors = get_u16(channel-errors);
 
if (errors != p-errors) {
@@ -607,7 +607,7 @@ static struct poll_delay_t jr3_pci_poll_subdevice(struct 
comedi_subdevice *s)
 is_complete(channel));
result = poll_delay_min_max(20, 100);
} else {
-   volatile struct force_array *full_scale;
+   struct force_array __iomem *full_scale;
 
/*  Use ranges in kN or we will 
overflow arount 2000N! */
full_scale = channel-full_scale;
@@ -848,9 +848,10 @@ static int jr3_pci_attach(struct comedi_device *dev,
p = dev-subdevices[i].private;
p-channel = devpriv-iobase-channel[i].data;
dev_dbg(dev-class_dev, p-channel %p %p (%tx)\n,
-   p-channel, devpriv-iobase,
-   ((char *)(p-channel) -
-  

[PATCH] staging: comedi: gsc_hpdi: make internal functions static

2012-09-24 Thread Ian Abbott
This module does not export any symbols so declare all the functions as
`static`.  Some of them are currently unused but might get used in the
future, so tag them as `__maybe_unused` for now to get rid of compiler
warnings.

Signed-off-by: Ian Abbott abbo...@mev.co.uk
---
 drivers/staging/comedi/drivers/gsc_hpdi.c | 41 +--
 1 file changed, 22 insertions(+), 19 deletions(-)

diff --git a/drivers/staging/comedi/drivers/gsc_hpdi.c 
b/drivers/staging/comedi/drivers/gsc_hpdi.c
index 5d3fa71..5fbd827 100644
--- a/drivers/staging/comedi/drivers/gsc_hpdi.c
+++ b/drivers/staging/comedi/drivers/gsc_hpdi.c
@@ -104,7 +104,7 @@ enum hpdi_registers {
INTERRUPT_POLARITY_REG = 0x54,
 };
 
-int command_channel_valid(unsigned int channel)
+static int command_channel_valid(unsigned int channel)
 {
if (channel == 0 || channel  6) {
printk(KERN_WARNING
@@ -119,17 +119,18 @@ int command_channel_valid(unsigned int channel)
 enum firmware_revision_bits {
FEATURES_REG_PRESENT_BIT = 0x8000,
 };
-int firmware_revision(uint32_t fwr_bits)
+
+static int __maybe_unused firmware_revision(uint32_t fwr_bits)
 {
return fwr_bits  0xff;
 }
 
-int pcb_revision(uint32_t fwr_bits)
+static int __maybe_unused pcb_revision(uint32_t fwr_bits)
 {
return (fwr_bits  8)  0xff;
 }
 
-int hpdi_subid(uint32_t fwr_bits)
+static int __maybe_unused hpdi_subid(uint32_t fwr_bits)
 {
return (fwr_bits  16)  0xff;
 }
@@ -147,8 +148,9 @@ enum board_control_bits {
CABLE_THROTTLE_ENABLE_BIT = 0x20,
TEST_MODE_ENABLE_BIT = 0x8000,
 };
-uint32_t command_discrete_output_bits(unsigned int channel, int output,
- int output_value)
+
+static uint32_t __maybe_unused
+command_discrete_output_bits(unsigned int channel, int output, int 
output_value)
 {
uint32_t bits = 0;
 
@@ -182,24 +184,24 @@ enum board_status_bits {
RX_OVERRUN_BIT = 0x80,
 };
 
-uint32_t almost_full_bits(unsigned int num_words)
+static uint32_t almost_full_bits(unsigned int num_words)
 {
-/* XXX need to add or subtract one? */
+   /* XXX need to add or subtract one? */
return (num_words  16)  0xff;
 }
 
-uint32_t almost_empty_bits(unsigned int num_words)
+static uint32_t almost_empty_bits(unsigned int num_words)
 {
return num_words  0x;
 }
 
-unsigned int almost_full_num_words(uint32_t bits)
+static unsigned int __maybe_unused almost_full_num_words(uint32_t bits)
 {
-/* XXX need to add or subtract one? */
+   /* XXX need to add or subtract one? */
return (bits  16)  0x;
 }
 
-unsigned int almost_empty_num_words(uint32_t bits)
+static unsigned int __maybe_unused almost_empty_num_words(uint32_t bits)
 {
return bits  0x;
 }
@@ -225,39 +227,40 @@ enum interrupt_sources {
RX_ALMOST_FULL_INTR = 14,
RX_FULL_INTR = 15,
 };
-int command_intr_source(unsigned int channel)
+
+static int __maybe_unused command_intr_source(unsigned int channel)
 {
if (command_channel_valid(channel) == 0)
channel = 1;
return channel + 1;
 }
 
-uint32_t intr_bit(int interrupt_source)
+static uint32_t intr_bit(int interrupt_source)
 {
return 0x1  interrupt_source;
 }
 
-uint32_t tx_clock_divisor_bits(unsigned int divisor)
+static uint32_t __maybe_unused tx_clock_divisor_bits(unsigned int divisor)
 {
return divisor  0xff;
 }
 
-unsigned int fifo_size(uint32_t fifo_size_bits)
+static unsigned int fifo_size(uint32_t fifo_size_bits)
 {
return fifo_size_bits  0xf;
 }
 
-unsigned int fifo_words(uint32_t fifo_words_bits)
+static unsigned int __maybe_unused fifo_words(uint32_t fifo_words_bits)
 {
return fifo_words_bits  0xf;
 }
 
-uint32_t intr_edge_bit(int interrupt_source)
+static uint32_t __maybe_unused intr_edge_bit(int interrupt_source)
 {
return 0x1  interrupt_source;
 }
 
-uint32_t intr_active_high_bit(int interrupt_source)
+static uint32_t __maybe_unused intr_active_high_bit(int interrupt_source)
 {
return 0x1  interrupt_source;
 }
-- 
1.7.12

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


[PATCH] staging: comedi: ni_mio_common: always lock in ni_ai_poll()

2012-09-24 Thread Ian Abbott
`ni_ai_poll()` currently acquires (and later releases) the comedi
device's spin-lock iff `in_interrupt()` returns 0.  However, it is only
called during processing of a `COMEDI_POLL` ioctl so `in_interrupt()`
will always return 0 in this case.  Remove this test and acquire/release
the spin-lock unconditionally.  This eliminates a sparse warning about
different lock contexts for basic block.

Signed-off-by: Ian Abbott abbo...@mev.co.uk
---
 drivers/staging/comedi/drivers/ni_mio_common.c | 8 +++-
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/comedi/drivers/ni_mio_common.c 
b/drivers/staging/comedi/drivers/ni_mio_common.c
index 87995da..4bbb979 100644
--- a/drivers/staging/comedi/drivers/ni_mio_common.c
+++ b/drivers/staging/comedi/drivers/ni_mio_common.c
@@ -1766,20 +1766,18 @@ static int ni_ai_reset(struct comedi_device *dev, 
struct comedi_subdevice *s)
 
 static int ni_ai_poll(struct comedi_device *dev, struct comedi_subdevice *s)
 {
-   unsigned long flags = 0;
+   unsigned long flags;
int count;
 
/*  lock to avoid race with interrupt handler */
-   if (in_interrupt() == 0)
-   spin_lock_irqsave(dev-spinlock, flags);
+   spin_lock_irqsave(dev-spinlock, flags);
 #ifndef PCIDMA
ni_handle_fifo_dregs(dev);
 #else
ni_sync_ai_dma(dev);
 #endif
count = s-async-buf_write_count - s-async-buf_read_count;
-   if (in_interrupt() == 0)
-   spin_unlock_irqrestore(dev-spinlock, flags);
+   spin_unlock_irqrestore(dev-spinlock, flags);
 
return count;
 }
-- 
1.7.12

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


Re: [PATCH 3/8] Staging: bcm: Remove typedef for _stLocalSFAddIndication and call directly.

2012-09-24 Thread Kevin McKinney
On Mon, Sep 24, 2012 at 10:16 AM, Dan Carpenter
dan.carpen...@oracle.com wrote:
 On Mon, Sep 24, 2012 at 09:46:05AM -0400, Kevin McKinney wrote:
 On Mon, Sep 24, 2012 at 6:57 AM, Dan Carpenter dan.carpen...@oracle.com 
 wrote:
  On Sun, Sep 23, 2012 at 11:07:12PM -0400, Kevin McKinney wrote:
  - pstAddIndication = kmalloc(sizeof(*pstAddIndication), GFP_KERNEL);
  + pstAddIndication = kmalloc(sizeof(struct bcm_add_indication), 
  GFP_KERNEL);
 
  Don't resend, but the style was still better in the original.

 Okay, I can change the style back to the original in a future patch?
 That is no problem, but I am not sure what style you are referring?
 Are you referring to this: sizeof(struct bcm_add_indication)?  Do
 you want me to change this statement?


 It's not worth worrying about given the other problems in bcm.  :P
 But I only complained about it because that line was an unneeded
 change to begin with.

 Better:
 foo = kmalloc(sizeof(*foo), GFP_KERNEL);

 Less preferred:
 foo = kmalloc(sizeof(struct foo_type), GFP_KERNEL);

 When we're reading code the first one is easiest to read.  For that
 we don't need to care about what type foo is, we're allocating one
 of whatever it is.  For the second one then there is a small
 possibility that we're struct foo_type doesn't match with how foo
 is declared.  Or the other justification for preferring the first
 way is that if we change the type of foo then we don't have to
 change the kmalloc() line as well, it gets updated automatically.

 This isn't in CodingStyle, but it's still better style.  It's an
 unenforced rule.  ;)

Got it, I will keep this in mind for the future.

 By the way, I was able to locate a complete setup / installation for
 this hardware here:
 https://sites.google.com/site/jrey42/Home/wimax
 http://developer.sprint.com/getDocument.do?docId=101032

 I am going to try to get the hardware installed and working so I can
 test. Hopefully I can call sprint and get access in my area.  I am not
 sure, but I will try!

 Sounds cool.  Rinat had this working.  Added to the CC list.  :)

I really want to set this up for testing purposes.

Rinat, please let me know if you have any suggestions or caveats.  I
am hoping I can get access through Sprint in my area.

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


[PATCH]staging wlan-ng Fix typos.

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

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

---

The below patch fixes typos found while reading through staging wlan-ng

 drivers/staging/wlan-ng/cfg80211.c |4 ++--
 drivers/staging/wlan-ng/p80211netdev.c |2 +-
 drivers/staging/wlan-ng/p80211types.h  |2 +-
 drivers/staging/wlan-ng/prism2fw.c |2 +-
 4 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/wlan-ng/cfg80211.c 
b/drivers/staging/wlan-ng/cfg80211.c
index 0970127..e1833bd 100644
--- a/drivers/staging/wlan-ng/cfg80211.c
+++ b/drivers/staging/wlan-ng/cfg80211.c
@@ -1,7 +1,7 @@
 /* cfg80211 Interface for prism2_usb module */
 
 
-/* Prism2 channell/frequency/bitrate declarations */
+/* Prism2 channel/frequency/bitrate declarations */
 static const struct ieee80211_channel prism2_channels[] = {
{ .center_freq = 2412 },
{ .center_freq = 2417 },
@@ -499,7 +499,7 @@ int prism2_connect(struct wiphy *wiphy, struct net_device 
*dev,
goto exit;
}
 
-   /* Set the authorisation */
+   /* Set the authorization */
if ((sme-auth_type == NL80211_AUTHTYPE_OPEN_SYSTEM) ||
((sme-auth_type == NL80211_AUTHTYPE_AUTOMATIC)  !is_wep))
msg_join.authtype.data = P80211ENUM_authalg_opensystem;
diff --git a/drivers/staging/wlan-ng/p80211netdev.c 
b/drivers/staging/wlan-ng/p80211netdev.c
index 8afb193..a5e2d41 100644
--- a/drivers/staging/wlan-ng/p80211netdev.c
+++ b/drivers/staging/wlan-ng/p80211netdev.c
@@ -461,7 +461,7 @@ failed:
 /*
 * p80211knetdev_set_multicast_list
 *
-* Called from higher lavers whenever there's a need to set/clear
+* Called from higher layers whenever there's a need to set/clear
 * promiscuous mode or rewrite the multicast list.
 *
 * Arguments:
diff --git a/drivers/staging/wlan-ng/p80211types.h 
b/drivers/staging/wlan-ng/p80211types.h
index f043090..8cb4fc6 100644
--- a/drivers/staging/wlan-ng/p80211types.h
+++ b/drivers/staging/wlan-ng/p80211types.h
@@ -197,7 +197,7 @@
P80211DID_LSB_ACCESS)
 
 /**/
-/* The following structure types are used for the represenation */
+/* The following structure types are used for the representation */
 /*  of ENUMint type metadata. */
 
 typedef struct p80211enumpair {
diff --git a/drivers/staging/wlan-ng/prism2fw.c 
b/drivers/staging/wlan-ng/prism2fw.c
index e22784e..0dfd2a4 100644
--- a/drivers/staging/wlan-ng/prism2fw.c
+++ b/drivers/staging/wlan-ng/prism2fw.c
@@ -806,7 +806,7 @@ static int read_cardpda(struct pda *pda, wlandevice_t 
*wlandev)
 *
 * Note also that the start address record, originally an S7 record in
 * the srec file, is expected in the fw file to be like a data record but
-* with a certain address to make it identiable.
+* with a certain address to make it identifiable.
 *
 * Here's the SREC format that the fw should have come from:
 * S[37]nnddd...dddcc
-- 
1.7.9.5

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


[PATCH 2/2] staging: comedi: s626: add FIXME comment

2012-09-24 Thread Ian Abbott
`s626_enc_insn_config()` is the `insn_config()` handler for a counter
subdevice.  The `data[0]` value is supposed to be one of the
`INSN_CONFIG_...` constants defined in comedi.h indicating the type of
configuration instruction, but this function seems to be using it as a
variable value to preload the counter with.  Various values of `data[0]`
are going to cause `check_insn_config_length()` in the comedi core
(comedi_fops.c) to return an error, and this function won't be called
in those cases.  Most other values will log a warning to the kernel log.

It's not entirely clear what constant should be checked for in
`data[0]`, so add a FIXME comment for now.

Signed-off-by: Ian Abbott abbo...@mev.co.uk
---
 drivers/staging/comedi/drivers/s626.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/staging/comedi/drivers/s626.c 
b/drivers/staging/comedi/drivers/s626.c
index 2b03b68..2421766 100644
--- a/drivers/staging/comedi/drivers/s626.c
+++ b/drivers/staging/comedi/drivers/s626.c
@@ -1847,6 +1847,9 @@ static int s626_dio_insn_config(struct comedi_device *dev,
 /* Now this function initializes the value of the counter (data[0])
and set the subdevice. To complete with trigger and interrupt
configuration */
+/* FIXME: data[0] is supposed to be an INSN_CONFIG_xxx constant indicating
+ * what is being configured, but this function appears to be using data[0]
+ * as a variable. */
 static int s626_enc_insn_config(struct comedi_device *dev,
struct comedi_subdevice *s,
struct comedi_insn *insn, unsigned int *data)
-- 
1.7.12

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


[PATCH 1/2] staging: comedi: s626: don't dereference insn-data

2012-09-24 Thread Ian Abbott
`s626_enc_insn_config()` is incorrectly dereferencing `insn-data` which
is a pointer to user memory.  It should be dereferencing the separate
`data` parameter that points to a copy of the data in kernel memory.

Cc: sta...@vger.kernel.org
Signed-off-by: Ian Abbott abbo...@mev.co.uk
---
 drivers/staging/comedi/drivers/s626.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/comedi/drivers/s626.c 
b/drivers/staging/comedi/drivers/s626.c
index f90578e..2b03b68 100644
--- a/drivers/staging/comedi/drivers/s626.c
+++ b/drivers/staging/comedi/drivers/s626.c
@@ -1868,7 +1868,7 @@ static int s626_enc_insn_config(struct comedi_device *dev,
/*   (data==NULL) ? (Preloadvalue=0) : (Preloadvalue=data[0]); */
 
k-SetMode(dev, k, Setup, TRUE);
-   Preload(dev, k, *(insn-data));
+   Preload(dev, k, data[0]);
k-PulseIndex(dev, k);
SetLatchSource(dev, k, valueSrclatch);
k-SetEnable(dev, k, (uint16_t) (enab != 0));
-- 
1.7.12

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


Re: [PATCH] staging: comedi: jr3_pci: add __iomem tags

2012-09-24 Thread Ian Abbott

On 2012-09-24 17:38, H Hartley Sweeten wrote:

On Monday, September 24, 2012 7:20 AM, Ian Abbott wrote:

Tag pointers to remapped I/O memory with `__iomem` and remove the
`volatile` qualifiers.  Fix the single place in `jr3_pci_attach()` where
an I/O memory pointer is being dereferenced directly to use the
appropriate I/O memory access function.

Signed-off-by: Ian Abbott abbo...@mev.co.uk


Ian,

I don't think this is _completely_ right.


---
  drivers/staging/comedi/drivers/jr3_pci.c | 35 
  drivers/staging/comedi/drivers/jr3_pci.h | 12 +--
  2 files changed, 24 insertions(+), 23 deletions(-)

diff --git a/drivers/staging/comedi/drivers/jr3_pci.c 
b/drivers/staging/comedi/drivers/jr3_pci.c
index 360107c..5b193ef 100644
--- a/drivers/staging/comedi/drivers/jr3_pci.c
+++ b/drivers/staging/comedi/drivers/jr3_pci.c
@@ -62,7 +62,7 @@ struct jr3_pci_dev_private {

struct pci_dev *pci_dev;
int pci_enabled;
-   volatile struct jr3_t *iobase;
+   struct jr3_t __iomem *iobase;


The ioremap'ed pci base address is a 'void __iomem *'. This is casting
it to a 'struct jr3_t __iomem *'. Which still leaves this driver with the
goofy indirect i/o using the struct instead of normal read[lwb]/write[lwb]
calls.

Changing the iobase variable in the struct like you have done may
get rid of the sparse warning but this drive is still pretty darn confusing.

I think the struct itself needs to be removed an replaced with #define's
for the memory map of the card. Then all the struct i/o access can be
replaced with read*/write* calls as appropriate.


It is actually using readl() and writel() throughout (mostly via its 
`get_s16()`, `set_s16()`, get_u16()` and `set_u16()` functions), but 
yes, the way the register offsets is determined is a bit goofy!


--
-=( Ian Abbott @ MEV Ltd.E-mail: abbo...@mev.co.uk)=-
-=( Tel: +44 (0)161 477 1898   FAX: +44 (0)161 718 3587 )=-
___
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/devel


Re: [RFC] mm: add support for zsmalloc and zcache

2012-09-24 Thread Seth Jennings
On 09/21/2012 03:35 PM, Dan Magenheimer wrote:
 From: Seth Jennings [mailto:sjenn...@linux.vnet.ibm.com]
 Subject: Re: [RFC] mm: add support for zsmalloc and zcache

 On 09/21/2012 01:02 PM, Konrad Rzeszutek Wilk wrote:
 On Fri, Sep 21, 2012 at 05:12:52PM +0100, Mel Gorman wrote:
 On Tue, Sep 04, 2012 at 04:34:46PM -0500, Seth Jennings wrote:
 zcache is the remaining piece of code required to support in-kernel
 memory compression.  The other two features, cleancache and frontswap,
 have been promoted to mainline in 3.0 and 3.5 respectively.  This
 patchset promotes zcache from the staging tree to mainline.


 Very broadly speaking my initial reaction before I reviewed anything was
 that *some* sort of usable backend for cleancache or frontswap should exist
 at this point. My understanding is that Xen is the primary user of both
 those frontends and ramster, while interesting, is not something that a
 typical user will benefit from.

 Right, the majority of users do not use virtualization. Thought embedded
 wise .. well, there are a lot of Android users - thought I am not 100%
 sure they are using it right now (I recall seeing changelogs for the clones
 of Android mentioning zcache).

 That said, I worry that this has bounced around a lot and as Dan (the
 original author) has a rewrite. I'm wary of spending too much time on this
 at all. Is Dan's new code going to replace this or what? It'd be nice to
 find a definitive answer on that.

 The idea is to take parts of zcache2 as seperate patches and stick it
 in the code you just reviewed (those that make sense as part of unstaging).

 I agree with this.  Only the changes from zcache2 (Dan's
 rewrite) that are necessary for promotion should be
 considered right now.  Afaict, none of the concerns raised
 in these comments are addressed by the changes in zcache2.
 
 While I may agree with the proposed end result, this proposal
 is a _very_ long way away from a solution.  To me, it sounds like
 a split the baby in half proposal (cf. wisdom of Solomon)
 which may sound reasonable to some but, in the end, everyone loses.
 
 I have proposed a reasonable compromise offlist to Seth, but
 it appears that it has been silently rejected; I guess it is
 now time to take the proposal public. I apologize in advance
 for my characteristic bluntness...
 
 So let's consider two proposals and the pros and cons of them,
 before we waste any further mm developer time.  (Fortunately,
 most of Mel's insightful comments apply to both versions, though
 he did identify some of the design issues that led to zcache2!)
 
 The two proposals:
 A) Recreate all the work done for zcache2 as a proper sequence of
independent patches and apply them to zcache1. (Seth/Konrad)
 B) Add zsmalloc back in to zcache2 as an alternative allocator
for frontswap pages. (Dan)
 
 Pros for (A):
 1. It better preserves the history of the handful of (non-zsmalloc)
commits in the original zcache code.
 2. Seth[1] can incrementally learn the new designs by reading
normal kernel patches.

It's not a matter of breaking the patches up so that I can
understand them.  I understand them just fine as indicated
by my responses to the attempt to overwrite zcache/remove
zsmalloc:

https://lkml.org/lkml/2012/8/14/347
https://lkml.org/lkml/2012/8/17/498

zcache2 also crashes on PPC64, which uses 64k pages, because
a 4k maximum page size is hard coded into the new zbudpage
struct.

The point is to discuss and adopt each change on it's own
merits instead of this take a 10k line patch or leave it
approach.

 3. For kernel purists, it is the _right_ way dammit (and Dan
should be shot for redesigning code non-incrementally, even
if it was in staging, etc.)

Dan says dammit to add a comic element to this point,
however, it is a valid point (minus the firing squad).

Lets be clear about what zcache2 is.  It is not a rewrite in
the way most people think: a refactored codebase the caries
out the same functional set as an original codebase.  It is
an _overwrite_ to accommodate an entirely new set of
functionally whose code doubles the size of the origin
codebase and regresses performance on the original
functionality.

 4. Seth believes that zcache will be promoted out of staging sooner
because, except for a few nits, it is ready today.
 
 Cons for (A):
 1. Nobody has signed up to do the work, including testing.  It
took the author (and sole expert on all the components
except zsmalloc) between two and three months essentially
fulltime to move zcache1-zcache2.  So forward progress on
zcache will likely be essentially frozen until at least the
end of 2012, possibly a lot longer.

This is not true.  I have agreed to do the work necessary to
make zcache1 acceptable for mainline, which can include
merging changes from zcache2 if people agree it is a blocker.

 2. The end result (if we reach one) is almost certainly a
_third_ implementation of zcache: zcache 1.5.  So
we may not be 

re: staging: Add dgrp driver for Digi Realport devices

2012-09-24 Thread Dan Carpenter
Hi Bill,

I have a concern about the following code:

drivers/staging/dgrp/dgrp_net_ops.c:3159 dgrp_receive()
  3128  plen = get_unaligned_be16(b + 2);
  3129  
  3130  if (plen  4 || plen  1000) {

plen = 4 here.  It is a signed long.

  3131  error = Response Packet length 
error;
  3132  goto prot_error;
  3133  }
  3134  
  3135  nd-nd_tx_work = 1;
  3136  
  3137  switch (b[1]) {
  3138  /*
  3139   *  Echo packet.
  3140   */
  3141  
  3142  case 0:
  3143  nd-nd_expect = ~NR_ECHO;
  3144  break;
  3145  
  3146  /*
  3147   *  Product Response Packet.
  3148   */
  3149  
  3150  case 1:
  3151  {
  3152  int desclen;
  3153  
  3154  nd-nd_hw_ver = (b[8] 
 8) | b[9];
  3155  nd-nd_sw_ver = (b[10] 
 8) | b[11];
  3156  nd-nd_hw_id = b[6];
  3157  desclen = ((plen - 12) 
 MAX_DESC_LEN) ? MAX_DESC_LEN :
  3158  plen - 12;
  3159  strncpy(nd-nd_ps_desc, 
b + 12, desclen);

^^^
desclen is -8 here.  strncpy() treats negatives as large postivies.

  3160  nd-nd_ps_desc[desclen] 
= 0;
  3161  }

regards,
dan carpenter

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


[PATCH 1/2] The tidspbridge driver does not compile anymore (Some OMAP34XX CPU definitions are missing). I Added a header file for these definitions.

2012-09-24 Thread selso
From: sli sli@SLI-V420.(none)


Signed-off-by: sli sli@SLI-V420.(none)
---
 drivers/staging/tidspbridge/core/dsp-clock.c   |3 ++
 drivers/staging/tidspbridge/core/tiomap3430.c  |4 ++
 drivers/staging/tidspbridge/core/wdt.c |2 +-
 .../tidspbridge/include/dspbridge/omap34xx.h   |   33 
 4 files changed, 41 insertions(+), 1 deletions(-)
 create mode 100644 drivers/staging/tidspbridge/include/dspbridge/omap34xx.h

diff --git a/drivers/staging/tidspbridge/core/dsp-clock.c 
b/drivers/staging/tidspbridge/core/dsp-clock.c
index 7d056bd..746fd52 100644
--- a/drivers/staging/tidspbridge/core/dsp-clock.c
+++ b/drivers/staging/tidspbridge/core/dsp-clock.c
@@ -18,6 +18,9 @@
 
 #include linux/types.h
 
+/*  --- CPU definitions */
+#include dspbridge/omap34xx.h
+
 /*  --- Host OS */
 #include dspbridge/host_os.h
 #include plat/dmtimer.h
diff --git a/drivers/staging/tidspbridge/core/tiomap3430.c 
b/drivers/staging/tidspbridge/core/tiomap3430.c
index 7bf55c4..637bf63 100644
--- a/drivers/staging/tidspbridge/core/tiomap3430.c
+++ b/drivers/staging/tidspbridge/core/tiomap3430.c
@@ -19,6 +19,10 @@
 #include linux/platform_data/dsp-omap.h
 
 #include linux/types.h
+
+/*  --- CPU definitions */
+#include dspbridge/omap34xx.h
+
 /*  --- Host OS */
 #include dspbridge/host_os.h
 #include linux/mm.h
diff --git a/drivers/staging/tidspbridge/core/wdt.c 
b/drivers/staging/tidspbridge/core/wdt.c
index 453ef74..4cf1dd1 100644
--- a/drivers/staging/tidspbridge/core/wdt.c
+++ b/drivers/staging/tidspbridge/core/wdt.c
@@ -17,6 +17,7 @@
  */
 #include linux/types.h
 
+#include dspbridge/omap34xx.h
 #include dspbridge/dbdefs.h
 #include dspbridge/dspdeh.h
 #include dspbridge/dev.h
@@ -24,7 +25,6 @@
 #include dspbridge/wdt.h
 #include dspbridge/host_os.h
 
-
 #define INT_34XX_WDT3_IRQ  (36 + NR_IRQS)
 
 static struct dsp_wdt_setting dsp_wdt;
diff --git a/drivers/staging/tidspbridge/include/dspbridge/omap34xx.h 
b/drivers/staging/tidspbridge/include/dspbridge/omap34xx.h
new file mode 100644
index 000..66a6fc8
--- /dev/null
+++ b/drivers/staging/tidspbridge/include/dspbridge/omap34xx.h
@@ -0,0 +1,32 @@
+/*
+ * This file contains some processor specific definitions of the TI OMAP34XX.
+ * Values are copied from mach-omap2 headers.
+ *
+ * Copyright (C) 2007 Texas Instruments.
+ * Copyright (C) 2007 Nokia Corporation.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+#ifndef __ASM_ARCH_OMAP34XX_H
+#define __ASM_ARCH_OMAP34XX_H
+
+#define L4_34XX_BASE   0x4800
+#define L4_PER_34XX_BASE   0x4900
+#define OMAP343X_SCM_BASE  0x48002000
+#define OMAP343X_CTRL_BASE OMAP343X_SCM_BASE
+#define OMAP34XX_WDT3_BASE (L4_PER_34XX_BASE + 0x3)
+
+#endif /* __ASM_ARCH_OMAP34XX_H */
-- 
1.6.0.4


From c95ae01f19010e547edf0a5c05484e5c479ca235 Mon Sep 17 00:00:00 2001
From: sli sli@SLI-V420.(none)
Date: Mon, 24 Sep 2012 20:13:52 +0200
Subject: [PATCH 2/2] style correction : delete whitespace


Signed-off-by: sli sli@SLI-V420.(none)
---
 .../tidspbridge/include/dspbridge/omap34xx.h   |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/staging/tidspbridge/include/dspbridge/omap34xx.h 
b/drivers/staging/tidspbridge/include/dspbridge/omap34xx.h
index 66a6fc8..053b61e 100644
--- a/drivers/staging/tidspbridge/include/dspbridge/omap34xx.h
+++ b/drivers/staging/tidspbridge/include/dspbridge/omap34xx.h
@@ -27,7 +27,7 @@
 #define L4_PER_34XX_BASE   0x4900
 #define OMAP343X_SCM_BASE  0x48002000
 #define OMAP343X_CTRL_BASE OMAP343X_SCM_BASE
-#define OMAP34XX_WDT3_BASE (L4_PER_34XX_BASE + 0x3)
+#define OMAP34XX_WDT3_BASE (L4_PER_34XX_BASE + 0x3)
 
 #endif /* __ASM_ARCH_OMAP34XX_H */
 
-- 
1.6.0.4

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


Re: staging: Add dgrp driver for Digi Realport devices

2012-09-24 Thread Bill Pemberton
 
 I have a concern about the following code:
 
 drivers/staging/dgrp/dgrp_net_ops.c:3159 dgrp_receive()
   3128  plen = get_unaligned_be16(b + 2);
   3129  
   3130  if (plen  4 || plen  1000) {
 
 plen = 4 here.  It is a signed long.
 

Thanks, I fear it's probably full of things like this.  I cleaned up
the stuff that I saw as obviously bad, but I figured I needed more
eyes on it.

I'll work up a fix for this.

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


RE: [RFC] mm: add support for zsmalloc and zcache

2012-09-24 Thread Dan Magenheimer
 From: James Bottomley [mailto:james.bottom...@hansenpartnership.com]
 Subject: Re: [RFC] mm: add support for zsmalloc and zcache

 On Sat, 2012-09-22 at 02:07 +0100, Mel Gorman wrote:
   The two proposals:
   A) Recreate all the work done for zcache2 as a proper sequence of
  independent patches and apply them to zcache1. (Seth/Konrad)
   B) Add zsmalloc back in to zcache2 as an alternative allocator
  for frontswap pages. (Dan)
 
  Throwing it out there but 
 
  C) Merge both, but freeze zcache1 except for critical fixes. Only
  allow
 future work on zcache2. Document limitations of zcache1 and
 workarounds until zcache2 is fully production ready.
 
 Actually, there is a fourth option, which is the one we'd have usually
 used when staging wasn't around:  Throw the old code out as a successful
 prototype which showed the author how to do it better (i.e. flush it
 from staging) and start again from the new code which has all the
 benefits learned from the old code.
 
 Staging isn't supposed to be some magical set of history that we have to
 adhere to no matter what (unlike the rest of the tree). It's supposed to
 be an accelerator to get stuff into the kernel and not become a
 hindrance to it.
 
 There also seem to be a couple of process issues here that could do with
 sorting:  Firstly that rewrites on better reflection, while not common,
 are also not unusual so we need a mechanism for coping with them.  This
 is actually a serious process problem: everyone becomes so attached to
 the code they helped clean up that they're hugely unwilling to
 countenance a rewrite which would in their (probably correct) opinion
 have the cleanups start from ground zero again. Secondly, we've got a
 set of use cases and add ons which grew up around code in staging that
 act as a bit of a barrier to ABI/API evolution, even as they help to
 demonstrate the problems.
 
 I think the first process issue really crystallises the problem we're
 having in staging:  we need to get the design approximately right before
 we start on the code cleanups.  What I think this means is that we start
 on the list where the people who understand the design issues reside
 then, when they're happy with the design, we can begin cleaning it up
 afterwards if necessary.  I don't think this is hard and fast: there is,
 of course, code so bad that even the experts can't penetrate it to see
 the design without having their eyes bleed but we should at least always
 try to begin with design.


Hi James --

I think you've hit the nail on the head, generalizing this interminable
debate into a process problem that needs to be solved more generally.
Thanks for your insight!

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


[PATCH 00/20] staging: comedi: s626: cleanup board attach

2012-09-24 Thread H Hartley Sweeten
Start cleaning up this driver by reworking the board attach to use
the comedi PCI auto config mechanism and cleanup all the attach code.

H Hartley Sweeten (20):
  staging: comedi: s626: remove boardinfo
  staging: comedi: s626: use attach_pci callback
  staging: comedi: s626: store the pci_dev in the comedi_device
  staging: comedi: s626: use dev-board_name for resource name
  staging: comedi: s626: remove unneeded local variable in attach_pci()
  staging: comedi: s626: remove 'got_regions' from private data
  staging: comedi: s626: cleanup ioremap()
  staging: comedi: s626: remove unnecessary checks of 'devpriv-base_addr'
  staging: comedi: s626: factor out the dma buffer allocation
  staging: comedi: s626: cleanup request_irq in s626_attach_pci()
  staging: comedi: s626: factor out the board init code
  staging: comedi: s626: remove unneeded clear of private data
  staging: comedi: s626: add final attach message
  staging: comedi: s626: remove 'allocatedBuf' from private data
  staging: comedi: s626: #if 0 out the SAA7146 BUG WORKAROUND
  staging: comedi: s626: remove 'IsBoardRevA' comment
  staging: comedi: s626: remove 'ChargeEnabled' from private data
  staging: comedi: s626: remove 'WDInterval' from private data
  staging: comedi: s626: remove clear of kzalloc'ed data
  staging: comedi: s626: cleanup comments in s626_initialize()

 drivers/staging/comedi/drivers/s626.c | 690 ++
 drivers/staging/comedi/drivers/s626.h |   1 -
 2 files changed, 283 insertions(+), 408 deletions(-)

-- 
1.7.11

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


[PATCH 01/20] staging: comedi: s626: remove boardinfo

2012-09-24 Thread H Hartley Sweeten
This driver only supports one board type. Move the used board info
out of the boardinfo struct and remove it.

Signed-off-by: H Hartley Sweeten hswee...@visionengravers.com
Cc: Ian Abbott abbo...@mev.co.uk
Cc: Greg Kroah-Hartman gre...@linuxfoundation.org
---
 drivers/staging/comedi/drivers/s626.c | 80 +--
 1 file changed, 21 insertions(+), 59 deletions(-)

diff --git a/drivers/staging/comedi/drivers/s626.c 
b/drivers/staging/comedi/drivers/s626.c
index f90578e..bac1445 100644
--- a/drivers/staging/comedi/drivers/s626.c
+++ b/drivers/staging/comedi/drivers/s626.c
@@ -82,40 +82,6 @@ INSN_CONFIG instructions:
 #define PCI_SUBVENDOR_ID_S626 0x6000
 #define PCI_SUBDEVICE_ID_S626 0x0272
 
-struct s626_board {
-   const char *name;
-   int vendor_id;
-   int device_id;
-   int subvendor_id;
-   int subdevice_id;
-   int ai_chans;
-   int ai_bits;
-   int ao_chans;
-   int ao_bits;
-   int dio_chans;
-   int dio_banks;
-   int enc_chans;
-};
-
-static const struct s626_board s626_boards[] = {
-   {
-.name = s626,
-.vendor_id = PCI_VENDOR_ID_S626,
-.device_id = PCI_DEVICE_ID_S626,
-.subvendor_id = PCI_SUBVENDOR_ID_S626,
-.subdevice_id = PCI_SUBDEVICE_ID_S626,
-.ai_chans = S626_ADC_CHANNELS,
-.ai_bits = 14,
-.ao_chans = S626_DAC_CHANNELS,
-.ao_bits = 13,
-.dio_chans = S626_DIO_CHANNELS,
-.dio_banks = S626_DIO_BANKS,
-.enc_chans = S626_ENCODER_CHANNELS,
-}
-};
-
-#define thisboard ((const struct s626_board *)dev-board_ptr)
-
 struct s626_private {
struct pci_dev *pdev;
void __iomem *base_addr;
@@ -2484,24 +2450,23 @@ static struct pci_dev *s626_find_pci(struct 
comedi_device *dev,
int slot = it-options[1];
int i;
 
-   for (i = 0; i  ARRAY_SIZE(s626_boards)  !pcidev; i++) {
-   do {
-   pcidev = pci_get_subsys(s626_boards[i].vendor_id,
-   s626_boards[i].device_id,
-   s626_boards[i].subvendor_id,
-   s626_boards[i].subdevice_id,
-   pcidev);
-
-   if ((bus || slot)  pcidev) {
-   /* matches requested bus/slot */
-   if (pcidev-bus-number == bus 
-   PCI_SLOT(pcidev-devfn) == slot)
-   break;
-   } else {
+   do {
+   pcidev = pci_get_subsys(PCI_VENDOR_ID_S626,
+   PCI_DEVICE_ID_S626,
+   PCI_SUBVENDOR_ID_S626,
+   PCI_SUBDEVICE_ID_S626,
+   pcidev);
+
+   if ((bus || slot)  pcidev) {
+   /* matches requested bus/slot */
+   if (pcidev-bus-number == bus 
+   PCI_SLOT(pcidev-devfn) == slot)
break;
-   }
-   } while (1);
-   }
+   } else {
+   break;
+   }
+   } while (1);
+
return pcidev;
 }
 
@@ -2581,8 +2546,7 @@ static int s626_attach(struct comedi_device *dev, struct 
comedi_devconfig *it)
 
}
 
-   dev-board_ptr = s626_boards;
-   dev-board_name = thisboard-name;
+   dev-board_name = dev-driver-driver_name;
 
ret = comedi_alloc_subdevices(dev, 6);
if (ret)
@@ -2610,12 +2574,10 @@ static int s626_attach(struct comedi_device *dev, 
struct comedi_devconfig *it)
/* we support single-ended (ground) and differential */
s-type = COMEDI_SUBD_AI;
s-subdev_flags = SDF_READABLE | SDF_DIFF | SDF_CMD_READ;
-   s-n_chan = thisboard-ai_chans;
+   s-n_chan = S626_ADC_CHANNELS;
s-maxdata = (0x  2);
s-range_table = s626_range_table;
-   s-len_chanlist = thisboard-ai_chans;  /* This is the maximum chanlist
-  length that the board can
-  handle */
+   s-len_chanlist = S626_ADC_CHANNELS;
s-insn_config = s626_ai_insn_config;
s-insn_read = s626_ai_insn_read;
s-do_cmd = s626_ai_cmd;
@@ -2626,7 +2588,7 @@ static int s626_attach(struct comedi_device *dev, struct 
comedi_devconfig *it)
/* analog output subdevice */
s-type = COMEDI_SUBD_AO;
s-subdev_flags = SDF_WRITABLE | SDF_READABLE;
-   s-n_chan = thisboard-ao_chans;
+   s-n_chan = S626_DAC_CHANNELS;
s-maxdata = (0x3fff);
s-range_table = range_bipolar10;
s-insn_write = s626_ao_winsn;
@@ -2672,7 +2634,7 @@ static int s626_attach(struct comedi_device *dev, struct 

[PATCH 02/20] staging: comedi: s626: use attach_pci callback

2012-09-24 Thread H Hartley Sweeten
Convert this PCI driver to use the comedi PCI auto config attach
mechanism by adding an 'attach_pci' callback function. Since the
driver does not require any external configuration options, and
the legacy 'attach' callback is not optional, remove it.

Signed-off-by: H Hartley Sweeten hswee...@visionengravers.com
Cc: Ian Abbott abbo...@mev.co.uk
Cc: Greg Kroah-Hartman gre...@linuxfoundation.org
---
 drivers/staging/comedi/drivers/s626.c | 45 ---
 1 file changed, 4 insertions(+), 41 deletions(-)

diff --git a/drivers/staging/comedi/drivers/s626.c 
b/drivers/staging/comedi/drivers/s626.c
index bac1445..eff7e96 100644
--- a/drivers/staging/comedi/drivers/s626.c
+++ b/drivers/staging/comedi/drivers/s626.c
@@ -32,11 +32,7 @@ Authors: Gianluca Palli gpa...@deis.unibo.it,
 Updated: Fri, 15 Feb 2008 10:28:42 +
 Status: experimental
 
-Configuration options:
-  [0] - PCI bus of device (optional)
-  [1] - PCI slot of device (optional)
-  If bus/slot is not specified, the first supported
-  PCI device found will be used.
+Configuration options: not applicable, uses PCI auto config
 
 INSN_CONFIG instructions:
   analog input:
@@ -2442,35 +2438,7 @@ static void CountersInit(struct comedi_device *dev)
}
 }
 
-static struct pci_dev *s626_find_pci(struct comedi_device *dev,
-struct comedi_devconfig *it)
-{
-   struct pci_dev *pcidev = NULL;
-   int bus = it-options[0];
-   int slot = it-options[1];
-   int i;
-
-   do {
-   pcidev = pci_get_subsys(PCI_VENDOR_ID_S626,
-   PCI_DEVICE_ID_S626,
-   PCI_SUBVENDOR_ID_S626,
-   PCI_SUBDEVICE_ID_S626,
-   pcidev);
-
-   if ((bus || slot)  pcidev) {
-   /* matches requested bus/slot */
-   if (pcidev-bus-number == bus 
-   PCI_SLOT(pcidev-devfn) == slot)
-   break;
-   } else {
-   break;
-   }
-   } while (1);
-
-   return pcidev;
-}
-
-static int s626_attach(struct comedi_device *dev, struct comedi_devconfig *it)
+static int s626_attach_pci(struct comedi_device *dev, struct pci_dev *pcidev)
 {
 /*   uint8_t   PollList; */
 /*   uint16_t  AdcData; */
@@ -2487,11 +2455,7 @@ static int s626_attach(struct comedi_device *dev, struct 
comedi_devconfig *it)
if (alloc_private(dev, sizeof(struct s626_private))  0)
return -ENOMEM;
 
-   devpriv-pdev = s626_find_pci(dev, it);
-   if (!devpriv-pdev) {
-   printk(KERN_ERR s626_attach: Board not present!!!\n);
-   return -ENODEV;
-   }
+   devpriv-pdev = pcidev;
 
result = comedi_pci_enable(devpriv-pdev, s626);
if (result  0) {
@@ -2932,7 +2896,6 @@ static void s626_detach(struct comedi_device *dev)
if (devpriv-pdev) {
if (devpriv-got_regions)
comedi_pci_disable(devpriv-pdev);
-   pci_dev_put(devpriv-pdev);
}
}
 }
@@ -2940,7 +2903,7 @@ static void s626_detach(struct comedi_device *dev)
 static struct comedi_driver s626_driver = {
.driver_name= s626,
.module = THIS_MODULE,
-   .attach = s626_attach,
+   .attach_pci = s626_attach_pci,
.detach = s626_detach,
 };
 
-- 
1.7.11

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


[PATCH 03/20] staging: comedi: s626: store the pci_dev in the comedi_device

2012-09-24 Thread H Hartley Sweeten
Use the hw_dev pointer in the comedi_device struct to hold the
pci_dev instead of carrying it in the private data.

Signed-off-by: H Hartley Sweeten hswee...@visionengravers.com
Cc: Ian Abbott abbo...@mev.co.uk
Cc: Greg Kroah-Hartman gre...@linuxfoundation.org
---
 drivers/staging/comedi/drivers/s626.c | 28 +++-
 1 file changed, 15 insertions(+), 13 deletions(-)

diff --git a/drivers/staging/comedi/drivers/s626.c 
b/drivers/staging/comedi/drivers/s626.c
index eff7e96..e30833f 100644
--- a/drivers/staging/comedi/drivers/s626.c
+++ b/drivers/staging/comedi/drivers/s626.c
@@ -79,7 +79,6 @@ INSN_CONFIG instructions:
 #define PCI_SUBDEVICE_ID_S626 0x0272
 
 struct s626_private {
-   struct pci_dev *pdev;
void __iomem *base_addr;
int got_regions;
short allocatedBuf;
@@ -1882,6 +1881,7 @@ static void WriteMISC2(struct comedi_device *dev, 
uint16_t NewImage)
 static void CloseDMAB(struct comedi_device *dev, struct bufferDMA *pdma,
  size_t bsize)
 {
+   struct pci_dev *pcidev = comedi_to_pci_dev(dev);
void *vbptr;
dma_addr_t vpptr;
 
@@ -1892,7 +1892,7 @@ static void CloseDMAB(struct comedi_device *dev, struct 
bufferDMA *pdma,
vbptr = pdma-LogicalBase;
vpptr = pdma-PhysicalBase;
if (vbptr) {
-   pci_free_consistent(devpriv-pdev, bsize, vbptr, vpptr);
+   pci_free_consistent(pcidev, bsize, vbptr, vpptr);
pdma-LogicalBase = NULL;
pdma-PhysicalBase = 0;
}
@@ -2452,19 +2452,19 @@ static int s626_attach_pci(struct comedi_device *dev, 
struct pci_dev *pcidev)
dma_addr_t appdma;
struct comedi_subdevice *s;
 
+   comedi_set_hw_dev(dev, pcidev-dev);
+
if (alloc_private(dev, sizeof(struct s626_private))  0)
return -ENOMEM;
 
-   devpriv-pdev = pcidev;
-
-   result = comedi_pci_enable(devpriv-pdev, s626);
+   result = comedi_pci_enable(pcidev, s626);
if (result  0) {
printk(KERN_ERR s626_attach: comedi_pci_enable fails\n);
return -ENODEV;
}
devpriv-got_regions = 1;
 
-   resourceStart = pci_resource_start(devpriv-pdev, 0);
+   resourceStart = pci_resource_start(pcidev, 0);
 
devpriv-base_addr = ioremap(resourceStart, SIZEOF_ADDRESS_SPACE);
if (devpriv-base_addr == NULL) {
@@ -2485,7 +2485,7 @@ static int s626_attach_pci(struct comedi_device *dev, 
struct pci_dev *pcidev)
devpriv-allocatedBuf = 0;
 
devpriv-ANABuf.LogicalBase =
-   pci_alloc_consistent(devpriv-pdev, DMABUF_SIZE, appdma);
+   pci_alloc_consistent(pcidev, DMABUF_SIZE, appdma);
 
if (devpriv-ANABuf.LogicalBase == NULL) {
printk(KERN_ERR s626_attach: DMA Memory mapping 
error\n);
@@ -2497,7 +2497,7 @@ static int s626_attach_pci(struct comedi_device *dev, 
struct pci_dev *pcidev)
devpriv-allocatedBuf++;
 
devpriv-RPSBuf.LogicalBase =
-   pci_alloc_consistent(devpriv-pdev, DMABUF_SIZE, appdma);
+   pci_alloc_consistent(pcidev, DMABUF_SIZE, appdma);
 
if (devpriv-RPSBuf.LogicalBase == NULL) {
printk(KERN_ERR s626_attach: DMA Memory mapping 
error\n);
@@ -2517,7 +2517,7 @@ static int s626_attach_pci(struct comedi_device *dev, 
struct pci_dev *pcidev)
return ret;
 
dev-iobase = (unsigned long)devpriv-base_addr;
-   dev-irq = devpriv-pdev-irq;
+   dev-irq = pcidev-irq;
 
/* set up interrupt handler */
if (dev-irq == 0) {
@@ -2869,6 +2869,8 @@ static int s626_attach_pci(struct comedi_device *dev, 
struct pci_dev *pcidev)
 
 static void s626_detach(struct comedi_device *dev)
 {
+   struct pci_dev *pcidev = comedi_to_pci_dev(dev);
+
if (devpriv) {
/* stop ai_command */
devpriv-ai_cmd_running = 0;
@@ -2893,10 +2895,10 @@ static void s626_detach(struct comedi_device *dev)
free_irq(dev-irq, dev);
if (devpriv-base_addr)
iounmap(devpriv-base_addr);
-   if (devpriv-pdev) {
-   if (devpriv-got_regions)
-   comedi_pci_disable(devpriv-pdev);
-   }
+   }
+   if (pcidev) {
+   if (devpriv-got_regions)
+   comedi_pci_disable(pcidev);
}
 }
 
-- 
1.7.11

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


[PATCH 04/20] staging: comedi: s626: use dev-board_name for resource name

2012-09-24 Thread H Hartley Sweeten
Instead of the literal string s626, use the dev-board_name for
the resource name when enabling the PCI device and requesting the
irq.

Signed-off-by: H Hartley Sweeten hswee...@visionengravers.com
Cc: Ian Abbott abbo...@mev.co.uk
Cc: Greg Kroah-Hartman gre...@linuxfoundation.org
---
 drivers/staging/comedi/drivers/s626.c | 7 +++
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/comedi/drivers/s626.c 
b/drivers/staging/comedi/drivers/s626.c
index e30833f..fb215b2 100644
--- a/drivers/staging/comedi/drivers/s626.c
+++ b/drivers/staging/comedi/drivers/s626.c
@@ -2453,11 +2453,12 @@ static int s626_attach_pci(struct comedi_device *dev, 
struct pci_dev *pcidev)
struct comedi_subdevice *s;
 
comedi_set_hw_dev(dev, pcidev-dev);
+   dev-board_name = dev-driver-driver_name;
 
if (alloc_private(dev, sizeof(struct s626_private))  0)
return -ENOMEM;
 
-   result = comedi_pci_enable(pcidev, s626);
+   result = comedi_pci_enable(pcidev, dev-board_name);
if (result  0) {
printk(KERN_ERR s626_attach: comedi_pci_enable fails\n);
return -ENODEV;
@@ -2510,8 +2511,6 @@ static int s626_attach_pci(struct comedi_device *dev, 
struct pci_dev *pcidev)
 
}
 
-   dev-board_name = dev-driver-driver_name;
-
ret = comedi_alloc_subdevices(dev, 6);
if (ret)
return ret;
@@ -2524,7 +2523,7 @@ static int s626_attach_pci(struct comedi_device *dev, 
struct pci_dev *pcidev)
printk(KERN_ERR  unknown irq (bad)\n);
} else {
ret = request_irq(dev-irq, s626_irq_handler, IRQF_SHARED,
- s626, dev);
+ dev-board_name, dev);
 
if (ret  0) {
printk(KERN_ERR  irq not available\n);
-- 
1.7.11

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


[PATCH 05/20] staging: comedi: s626: remove unneeded local variable in attach_pci()

2012-09-24 Thread H Hartley Sweeten
The 'result' variable is only used to check the return from
comedi_pci_enable(). Just reuse the 'ret' variable.

Also, remove the kernel noise and use the error code from
comedi_pci_enable() instead of returning -ENODEV.

Signed-off-by: H Hartley Sweeten hswee...@visionengravers.com
Cc: Ian Abbott abbo...@mev.co.uk
Cc: Greg Kroah-Hartman gre...@linuxfoundation.org
---
 drivers/staging/comedi/drivers/s626.c | 9 +++--
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/comedi/drivers/s626.c 
b/drivers/staging/comedi/drivers/s626.c
index fb215b2..93e55c3 100644
--- a/drivers/staging/comedi/drivers/s626.c
+++ b/drivers/staging/comedi/drivers/s626.c
@@ -2445,7 +2445,6 @@ static int s626_attach_pci(struct comedi_device *dev, 
struct pci_dev *pcidev)
 /*   uint16_t  StartVal; */
 /*   uint16_t  index; */
 /*   unsigned int data[16]; */
-   int result;
int i;
int ret;
resource_size_t resourceStart;
@@ -2458,11 +2457,9 @@ static int s626_attach_pci(struct comedi_device *dev, 
struct pci_dev *pcidev)
if (alloc_private(dev, sizeof(struct s626_private))  0)
return -ENOMEM;
 
-   result = comedi_pci_enable(pcidev, dev-board_name);
-   if (result  0) {
-   printk(KERN_ERR s626_attach: comedi_pci_enable fails\n);
-   return -ENODEV;
-   }
+   ret = comedi_pci_enable(pcidev, dev-board_name);
+   if (ret)
+   return ret;
devpriv-got_regions = 1;
 
resourceStart = pci_resource_start(pcidev, 0);
-- 
1.7.11

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


[PATCH 06/20] staging: comedi: s626: remove 'got_regions' from private data

2012-09-24 Thread H Hartley Sweeten
This variable is only used as a flag to indicate that the pci device
has been enabled and needs to be disabled in the detach. Use the
comedi_device 'iobase' for this and remove the private data variable.

Signed-off-by: H Hartley Sweeten hswee...@visionengravers.com
Cc: Ian Abbott abbo...@mev.co.uk
Cc: Greg Kroah-Hartman gre...@linuxfoundation.org
---
 drivers/staging/comedi/drivers/s626.c | 6 ++
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/comedi/drivers/s626.c 
b/drivers/staging/comedi/drivers/s626.c
index 93e55c3..12709b0 100644
--- a/drivers/staging/comedi/drivers/s626.c
+++ b/drivers/staging/comedi/drivers/s626.c
@@ -80,7 +80,6 @@ INSN_CONFIG instructions:
 
 struct s626_private {
void __iomem *base_addr;
-   int got_regions;
short allocatedBuf;
uint8_t ai_cmd_running; /*  ai_cmd is running */
uint8_t ai_continous;   /*  continous acquisition */
@@ -2460,7 +2459,7 @@ static int s626_attach_pci(struct comedi_device *dev, 
struct pci_dev *pcidev)
ret = comedi_pci_enable(pcidev, dev-board_name);
if (ret)
return ret;
-   devpriv-got_regions = 1;
+   dev-iobase = 1;/* detach needs this */
 
resourceStart = pci_resource_start(pcidev, 0);
 
@@ -2512,7 +2511,6 @@ static int s626_attach_pci(struct comedi_device *dev, 
struct pci_dev *pcidev)
if (ret)
return ret;
 
-   dev-iobase = (unsigned long)devpriv-base_addr;
dev-irq = pcidev-irq;
 
/* set up interrupt handler */
@@ -2893,7 +2891,7 @@ static void s626_detach(struct comedi_device *dev)
iounmap(devpriv-base_addr);
}
if (pcidev) {
-   if (devpriv-got_regions)
+   if (dev-iobase)
comedi_pci_disable(pcidev);
}
 }
-- 
1.7.11

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


[PATCH 07/20] staging: comedi: s626: cleanup ioremap()

2012-09-24 Thread H Hartley Sweeten
The local variable 'resourceStart' is only used in the ioremap()
to hold the PCI bar 0 base address. Just use the pci_resource_start()
directly in the ioremap().

Also, instead of assuming the resource size for the ioremap, use
pci_resource_len() to get the actual size.

Remove the kernel noise when the ioremap fails and change the error
code from -ENODEV to -ENOMEM.

Signed-off-by: H Hartley Sweeten hswee...@visionengravers.com
Cc: Ian Abbott abbo...@mev.co.uk
Cc: Greg Kroah-Hartman gre...@linuxfoundation.org
---
 drivers/staging/comedi/drivers/s626.c | 12 
 drivers/staging/comedi/drivers/s626.h |  1 -
 2 files changed, 4 insertions(+), 9 deletions(-)

diff --git a/drivers/staging/comedi/drivers/s626.c 
b/drivers/staging/comedi/drivers/s626.c
index 12709b0..6f6c808 100644
--- a/drivers/staging/comedi/drivers/s626.c
+++ b/drivers/staging/comedi/drivers/s626.c
@@ -2446,7 +2446,6 @@ static int s626_attach_pci(struct comedi_device *dev, 
struct pci_dev *pcidev)
 /*   unsigned int data[16]; */
int i;
int ret;
-   resource_size_t resourceStart;
dma_addr_t appdma;
struct comedi_subdevice *s;
 
@@ -2461,13 +2460,10 @@ static int s626_attach_pci(struct comedi_device *dev, 
struct pci_dev *pcidev)
return ret;
dev-iobase = 1;/* detach needs this */
 
-   resourceStart = pci_resource_start(pcidev, 0);
-
-   devpriv-base_addr = ioremap(resourceStart, SIZEOF_ADDRESS_SPACE);
-   if (devpriv-base_addr == NULL) {
-   printk(KERN_ERR s626_attach: IOREMAP failed\n);
-   return -ENODEV;
-   }
+   devpriv-base_addr = ioremap(pci_resource_start(pcidev, 0),
+pci_resource_len(pcidev, 0));
+   if (!devpriv-base_addr)
+   return -ENOMEM;
 
if (devpriv-base_addr) {
/* disable master interrupt */
diff --git a/drivers/staging/comedi/drivers/s626.h 
b/drivers/staging/comedi/drivers/s626.h
index 8a8f196..ff4b3a5 100644
--- a/drivers/staging/comedi/drivers/s626.h
+++ b/drivers/staging/comedi/drivers/s626.h
@@ -73,7 +73,6 @@
 #include linux/slab.h
 
 #define S626_SIZE 0x0200
-#define SIZEOF_ADDRESS_SPACE   0x0200
 #define DMABUF_SIZE4096/*  4k pages */
 
 #define S626_ADC_CHANNELS   16
-- 
1.7.11

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


[PATCH 09/20] staging: comedi: s626: factor out the dma buffer allocation

2012-09-24 Thread H Hartley Sweeten
To make the attach a bit cleaner, factor the dma buffer allocation
out of attach_pci() into a new function.

Signed-off-by: H Hartley Sweeten hswee...@visionengravers.com
Cc: Ian Abbott abbo...@mev.co.uk
Cc: Greg Kroah-Hartman gre...@linuxfoundation.org
---
 drivers/staging/comedi/drivers/s626.c | 57 ++-
 1 file changed, 30 insertions(+), 27 deletions(-)

diff --git a/drivers/staging/comedi/drivers/s626.c 
b/drivers/staging/comedi/drivers/s626.c
index a9d78c7..61bb8ab 100644
--- a/drivers/staging/comedi/drivers/s626.c
+++ b/drivers/staging/comedi/drivers/s626.c
@@ -2437,6 +2437,33 @@ static void CountersInit(struct comedi_device *dev)
}
 }
 
+static int s626_allocate_dma_buffers(struct comedi_device *dev)
+{
+   struct pci_dev *pcidev = comedi_to_pci_dev(dev);
+   void *addr;
+   dma_addr_t appdma;
+
+   devpriv-allocatedBuf = 0;
+
+   addr = pci_alloc_consistent(pcidev, DMABUF_SIZE, appdma);
+   if (!addr)
+   return -ENOMEM;
+   devpriv-ANABuf.LogicalBase = addr;
+   devpriv-ANABuf.PhysicalBase = appdma;
+
+   devpriv-allocatedBuf++;
+
+   addr = pci_alloc_consistent(pcidev, DMABUF_SIZE, appdma);
+   if (!addr)
+   return -ENOMEM;
+   devpriv-RPSBuf.LogicalBase = addr;
+   devpriv-RPSBuf.PhysicalBase = appdma;
+
+   devpriv-allocatedBuf++;
+
+   return 0;
+}
+
 static int s626_attach_pci(struct comedi_device *dev, struct pci_dev *pcidev)
 {
 /*   uint8_t   PollList; */
@@ -2446,7 +2473,6 @@ static int s626_attach_pci(struct comedi_device *dev, 
struct pci_dev *pcidev)
 /*   unsigned int data[16]; */
int i;
int ret;
-   dma_addr_t appdma;
struct comedi_subdevice *s;
 
comedi_set_hw_dev(dev, pcidev-dev);
@@ -2473,32 +2499,9 @@ static int s626_attach_pci(struct comedi_device *dev, 
struct pci_dev *pcidev)
 
/* DMA FIXME DMA// */
 
-   /* adc buffer allocation */
-   devpriv-allocatedBuf = 0;
-
-   devpriv-ANABuf.LogicalBase =
-   pci_alloc_consistent(pcidev, DMABUF_SIZE, appdma);
-
-   if (devpriv-ANABuf.LogicalBase == NULL) {
-   printk(KERN_ERR s626_attach: DMA Memory mapping error\n);
-   return -ENOMEM;
-   }
-
-   devpriv-ANABuf.PhysicalBase = appdma;
-
-   devpriv-allocatedBuf++;
-
-   devpriv-RPSBuf.LogicalBase =
-   pci_alloc_consistent(pcidev, DMABUF_SIZE, appdma);
-
-   if (devpriv-RPSBuf.LogicalBase == NULL) {
-   printk(KERN_ERR s626_attach: DMA Memory mapping error\n);
-   return -ENOMEM;
-   }
-
-   devpriv-RPSBuf.PhysicalBase = appdma;
-
-   devpriv-allocatedBuf++;
+   ret = s626_allocate_dma_buffers(dev);
+   if (ret)
+   return ret;
 
ret = comedi_alloc_subdevices(dev, 6);
if (ret)
-- 
1.7.11

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


[PATCH 08/20] staging: comedi: s626: remove unnecessary checks of 'devpriv-base_addr'

2012-09-24 Thread H Hartley Sweeten
'devpriv-base_addr' is valid from this point on in the attach_pci()
function. Remove the unnecessary checks.

Signed-off-by: H Hartley Sweeten hswee...@visionengravers.com
Cc: Ian Abbott abbo...@mev.co.uk
Cc: Greg Kroah-Hartman gre...@linuxfoundation.org
---
 drivers/staging/comedi/drivers/s626.c | 51 +--
 1 file changed, 24 insertions(+), 27 deletions(-)

diff --git a/drivers/staging/comedi/drivers/s626.c 
b/drivers/staging/comedi/drivers/s626.c
index 6f6c808..a9d78c7 100644
--- a/drivers/staging/comedi/drivers/s626.c
+++ b/drivers/staging/comedi/drivers/s626.c
@@ -2465,43 +2465,40 @@ static int s626_attach_pci(struct comedi_device *dev, 
struct pci_dev *pcidev)
if (!devpriv-base_addr)
return -ENOMEM;
 
-   if (devpriv-base_addr) {
-   /* disable master interrupt */
-   writel(0, devpriv-base_addr + P_IER);
+   /* disable master interrupt */
+   writel(0, devpriv-base_addr + P_IER);
 
-   /* soft reset */
-   writel(MC1_SOFT_RESET, devpriv-base_addr + P_MC1);
+   /* soft reset */
+   writel(MC1_SOFT_RESET, devpriv-base_addr + P_MC1);
 
-   /* DMA FIXME DMA// */
+   /* DMA FIXME DMA// */
 
-   /* adc buffer allocation */
-   devpriv-allocatedBuf = 0;
+   /* adc buffer allocation */
+   devpriv-allocatedBuf = 0;
 
-   devpriv-ANABuf.LogicalBase =
-   pci_alloc_consistent(pcidev, DMABUF_SIZE, appdma);
+   devpriv-ANABuf.LogicalBase =
+   pci_alloc_consistent(pcidev, DMABUF_SIZE, appdma);
 
-   if (devpriv-ANABuf.LogicalBase == NULL) {
-   printk(KERN_ERR s626_attach: DMA Memory mapping 
error\n);
-   return -ENOMEM;
-   }
-
-   devpriv-ANABuf.PhysicalBase = appdma;
+   if (devpriv-ANABuf.LogicalBase == NULL) {
+   printk(KERN_ERR s626_attach: DMA Memory mapping error\n);
+   return -ENOMEM;
+   }
 
-   devpriv-allocatedBuf++;
+   devpriv-ANABuf.PhysicalBase = appdma;
 
-   devpriv-RPSBuf.LogicalBase =
-   pci_alloc_consistent(pcidev, DMABUF_SIZE, appdma);
+   devpriv-allocatedBuf++;
 
-   if (devpriv-RPSBuf.LogicalBase == NULL) {
-   printk(KERN_ERR s626_attach: DMA Memory mapping 
error\n);
-   return -ENOMEM;
-   }
+   devpriv-RPSBuf.LogicalBase =
+   pci_alloc_consistent(pcidev, DMABUF_SIZE, appdma);
 
-   devpriv-RPSBuf.PhysicalBase = appdma;
+   if (devpriv-RPSBuf.LogicalBase == NULL) {
+   printk(KERN_ERR s626_attach: DMA Memory mapping error\n);
+   return -ENOMEM;
+   }
 
-   devpriv-allocatedBuf++;
+   devpriv-RPSBuf.PhysicalBase = appdma;
 
-   }
+   devpriv-allocatedBuf++;
 
ret = comedi_alloc_subdevices(dev, 6);
if (ret)
@@ -2599,7 +2596,7 @@ static int s626_attach_pci(struct comedi_device *dev, 
struct pci_dev *pcidev)
/* stop ai_command */
devpriv-ai_cmd_running = 0;
 
-   if (devpriv-base_addr  (devpriv-allocatedBuf == 2)) {
+   if (devpriv-allocatedBuf == 2) {
dma_addr_t pPhysBuf;
uint16_t chan;
 
-- 
1.7.11

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


[PATCH 10/20] staging: comedi: s626: cleanup request_irq in s626_attach_pci()

2012-09-24 Thread H Hartley Sweeten
Only set dev-irq if request_irq is successfull.

Remove the kernel message noise.

Signed-off-by: H Hartley Sweeten hswee...@visionengravers.com
Cc: Ian Abbott abbo...@mev.co.uk
Cc: Greg Kroah-Hartman gre...@linuxfoundation.org
---
 drivers/staging/comedi/drivers/s626.c | 23 ---
 1 file changed, 8 insertions(+), 15 deletions(-)

diff --git a/drivers/staging/comedi/drivers/s626.c 
b/drivers/staging/comedi/drivers/s626.c
index 61bb8ab..4ad3f27 100644
--- a/drivers/staging/comedi/drivers/s626.c
+++ b/drivers/staging/comedi/drivers/s626.c
@@ -2503,25 +2503,18 @@ static int s626_attach_pci(struct comedi_device *dev, 
struct pci_dev *pcidev)
if (ret)
return ret;
 
-   ret = comedi_alloc_subdevices(dev, 6);
-   if (ret)
-   return ret;
-
-   dev-irq = pcidev-irq;
-
-   /* set up interrupt handler */
-   if (dev-irq == 0) {
-   printk(KERN_ERR  unknown irq (bad)\n);
-   } else {
-   ret = request_irq(dev-irq, s626_irq_handler, IRQF_SHARED,
+   if (pcidev-irq) {
+   ret = request_irq(pcidev-irq, s626_irq_handler, IRQF_SHARED,
  dev-board_name, dev);
 
-   if (ret  0) {
-   printk(KERN_ERR  irq not available\n);
-   dev-irq = 0;
-   }
+   if (ret == 0)
+   dev-irq = pcidev-irq;
}
 
+   ret = comedi_alloc_subdevices(dev, 6);
+   if (ret)
+   return ret;
+
s = dev-subdevices + 0;
/* analog input subdevice */
dev-read_subdev = s;
-- 
1.7.11

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


[PATCH 11/20] staging: comedi: s626: factor out the board init code

2012-09-24 Thread H Hartley Sweeten
To make the attach a bit cleaner, factor the board init code
out of attach_pci() into a new function.

Signed-off-by: H Hartley Sweeten hswee...@visionengravers.com
Cc: Ian Abbott abbo...@mev.co.uk
Cc: Greg Kroah-Hartman gre...@linuxfoundation.org
---
 drivers/staging/comedi/drivers/s626.c | 246 +-
 1 file changed, 126 insertions(+), 120 deletions(-)

diff --git a/drivers/staging/comedi/drivers/s626.c 
b/drivers/staging/comedi/drivers/s626.c
index 4ad3f27..cbae8e4 100644
--- a/drivers/staging/comedi/drivers/s626.c
+++ b/drivers/staging/comedi/drivers/s626.c
@@ -2464,7 +2464,7 @@ static int s626_allocate_dma_buffers(struct comedi_device 
*dev)
return 0;
 }
 
-static int s626_attach_pci(struct comedi_device *dev, struct pci_dev *pcidev)
+static void s626_initialize(struct comedi_device *dev)
 {
 /*   uint8_t   PollList; */
 /*   uint16_t  AdcData; */
@@ -2472,125 +2472,6 @@ static int s626_attach_pci(struct comedi_device *dev, 
struct pci_dev *pcidev)
 /*   uint16_t  index; */
 /*   unsigned int data[16]; */
int i;
-   int ret;
-   struct comedi_subdevice *s;
-
-   comedi_set_hw_dev(dev, pcidev-dev);
-   dev-board_name = dev-driver-driver_name;
-
-   if (alloc_private(dev, sizeof(struct s626_private))  0)
-   return -ENOMEM;
-
-   ret = comedi_pci_enable(pcidev, dev-board_name);
-   if (ret)
-   return ret;
-   dev-iobase = 1;/* detach needs this */
-
-   devpriv-base_addr = ioremap(pci_resource_start(pcidev, 0),
-pci_resource_len(pcidev, 0));
-   if (!devpriv-base_addr)
-   return -ENOMEM;
-
-   /* disable master interrupt */
-   writel(0, devpriv-base_addr + P_IER);
-
-   /* soft reset */
-   writel(MC1_SOFT_RESET, devpriv-base_addr + P_MC1);
-
-   /* DMA FIXME DMA// */
-
-   ret = s626_allocate_dma_buffers(dev);
-   if (ret)
-   return ret;
-
-   if (pcidev-irq) {
-   ret = request_irq(pcidev-irq, s626_irq_handler, IRQF_SHARED,
- dev-board_name, dev);
-
-   if (ret == 0)
-   dev-irq = pcidev-irq;
-   }
-
-   ret = comedi_alloc_subdevices(dev, 6);
-   if (ret)
-   return ret;
-
-   s = dev-subdevices + 0;
-   /* analog input subdevice */
-   dev-read_subdev = s;
-   /* we support single-ended (ground) and differential */
-   s-type = COMEDI_SUBD_AI;
-   s-subdev_flags = SDF_READABLE | SDF_DIFF | SDF_CMD_READ;
-   s-n_chan = S626_ADC_CHANNELS;
-   s-maxdata = (0x  2);
-   s-range_table = s626_range_table;
-   s-len_chanlist = S626_ADC_CHANNELS;
-   s-insn_config = s626_ai_insn_config;
-   s-insn_read = s626_ai_insn_read;
-   s-do_cmd = s626_ai_cmd;
-   s-do_cmdtest = s626_ai_cmdtest;
-   s-cancel = s626_ai_cancel;
-
-   s = dev-subdevices + 1;
-   /* analog output subdevice */
-   s-type = COMEDI_SUBD_AO;
-   s-subdev_flags = SDF_WRITABLE | SDF_READABLE;
-   s-n_chan = S626_DAC_CHANNELS;
-   s-maxdata = (0x3fff);
-   s-range_table = range_bipolar10;
-   s-insn_write = s626_ao_winsn;
-   s-insn_read = s626_ao_rinsn;
-
-   s = dev-subdevices + 2;
-   /* digital I/O subdevice */
-   s-type = COMEDI_SUBD_DIO;
-   s-subdev_flags = SDF_WRITABLE | SDF_READABLE;
-   s-n_chan = 16;
-   s-maxdata = 1;
-   s-io_bits = 0x;
-   s-private = dio_private_A;
-   s-range_table = range_digital;
-   s-insn_config = s626_dio_insn_config;
-   s-insn_bits = s626_dio_insn_bits;
-
-   s = dev-subdevices + 3;
-   /* digital I/O subdevice */
-   s-type = COMEDI_SUBD_DIO;
-   s-subdev_flags = SDF_WRITABLE | SDF_READABLE;
-   s-n_chan = 16;
-   s-maxdata = 1;
-   s-io_bits = 0x;
-   s-private = dio_private_B;
-   s-range_table = range_digital;
-   s-insn_config = s626_dio_insn_config;
-   s-insn_bits = s626_dio_insn_bits;
-
-   s = dev-subdevices + 4;
-   /* digital I/O subdevice */
-   s-type = COMEDI_SUBD_DIO;
-   s-subdev_flags = SDF_WRITABLE | SDF_READABLE;
-   s-n_chan = 16;
-   s-maxdata = 1;
-   s-io_bits = 0x;
-   s-private = dio_private_C;
-   s-range_table = range_digital;
-   s-insn_config = s626_dio_insn_config;
-   s-insn_bits = s626_dio_insn_bits;
-
-   s = dev-subdevices + 5;
-   /* encoder (counter) subdevice */
-   s-type = COMEDI_SUBD_COUNTER;
-   s-subdev_flags = SDF_WRITABLE | SDF_READABLE | SDF_LSAMPL;
-   s-n_chan = S626_ENCODER_CHANNELS;
-   s-private = enc_private_data;
-   s-insn_config = s626_enc_insn_config;
-   s-insn_read = s626_enc_insn_read;
-   s-insn_write = s626_enc_insn_write;
-   s-maxdata = 0xff;
-   s-range_table = range_unknown;
-
-   /* stop ai_command */
-   devpriv-ai_cmd_running = 0;
 
   

[PATCH 12/20] staging: comedi: s626: remove unneeded clear of private data

2012-09-24 Thread H Hartley Sweeten
The private data is kzalloc'ed. All the variables in it are
initially '0'.

Signed-off-by: H Hartley Sweeten hswee...@visionengravers.com
Cc: Ian Abbott abbo...@mev.co.uk
Cc: Greg Kroah-Hartman gre...@linuxfoundation.org
---
 drivers/staging/comedi/drivers/s626.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/drivers/staging/comedi/drivers/s626.c 
b/drivers/staging/comedi/drivers/s626.c
index cbae8e4..f4251ac 100644
--- a/drivers/staging/comedi/drivers/s626.c
+++ b/drivers/staging/comedi/drivers/s626.c
@@ -2848,9 +2848,6 @@ static int s626_attach_pci(struct comedi_device *dev, 
struct pci_dev *pcidev)
s-maxdata = 0xff;
s-range_table = range_unknown;
 
-   /* stop ai_command */
-   devpriv-ai_cmd_running = 0;
-
s626_initialize(dev);
 
return 1;
-- 
1.7.11

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


RE: [RFC] mm: add support for zsmalloc and zcache

2012-09-24 Thread Dan Magenheimer
 From: Mel Gorman [mailto:mgor...@suse.de]
 Subject: Re: [RFC] mm: add support for zsmalloc and zcache
 
 On Sat, Sep 22, 2012 at 02:18:44PM -0700, Dan Magenheimer wrote:
   From: Mel Gorman [mailto:mgor...@suse.de]
   Subject: Re: [RFC] mm: add support for zsmalloc and zcache
  
   On Fri, Sep 21, 2012 at 01:35:15PM -0700, Dan Magenheimer wrote:
 From: Seth Jennings [mailto:sjenn...@linux.vnet.ibm.com]
 Subject: Re: [RFC] mm: add support for zsmalloc and zcache
The two proposals:
A) Recreate all the work done for zcache2 as a proper sequence of
   independent patches and apply them to zcache1. (Seth/Konrad)
B) Add zsmalloc back in to zcache2 as an alternative allocator
   for frontswap pages. (Dan)
  
   Throwing it out there but 
  
   C) Merge both, but freeze zcache1 except for critical fixes. Only allow
  future work on zcache2. Document limitations of zcache1 and
  workarounds until zcache2 is fully production ready.
 
 What would the impact be if zcache2 and zcache1 were mutually exclusive
 in Kconfig and the naming was as follows?
 
 CONFIG_ZCACHE_DEPRECATED  (zcache1)
 CONFIG_ZCACHE (zcache2)
 
 That would make it absolutely clear to distributions which one they should
 be enabling and also make it clear that all future development happen
 on zcache2.
 
 I know it looks insane to promote something that is instantly deprecated
 but none of the other alternatives seem to be gaining traction either.
 This would at least allow the people who are currently heavily behind
 zcache1 to continue supporting it and applying critical fixes until they
 move to zcache2.

Just wondering... how, in your opinion, is this different from
leaving zcache1 (or even both) in staging?  Tainting occurs
either way, it's just a matter of whether or not there is a message
logged by the kernel that it is officially tainted, right?

However, it _is_ another attempt at compromise and, if this
is the only solution that allows the debate to end, and it
is agreed on by whatever maintainer is committed to pull
both (be it you, or Andrew, or Konrad, or Linux), I would
agree to your C-prime proposal.
 
  I use the terms zcache1 and zcache2 only to clarify which
  codebase, not because they are dramatically different. I estimate
  that 85%-90% of the code in zcache1 and zcache2 is identical, not
  counting the allocator or comments/whitespace/janitorial!
 
 If 85-90% of the code is identicial then they really should be sharing
 the code rather than making copies. That will result in some monolithic
 patches but it's unavoidable. I expect it would end up looking like
 
 Patch 1   promote zcache1
 Patch 2   promote zcache2
 Patch 3   move shared code for zcache1,zcache2 to common files
 
 If the shared code is really shared and not copied it may reduce some of
 the friction between the camps.

This part I would object to... at least I would object to signing
up to do Patch 3 myself.  Seems like a lot of busywork if zcache1
is truly deprecated.

 zcache1 does appear to have a few snarls that would make me wary of having
 to support it. I don't know if zcache2 suffers the same problems or not
 as I have not read it.
 
 Unfortunately, I'm not going to get the chance to review [zcache2] in the
 short-term. However, if zcache1 and zcache2 shared code in common files
 it would at least reduce the amount of new code I have to read :)

Understood, which re-emphasizes my point about how the presence
of both reduces the (to date, very limited) MM developer time available
for either.

  Seth (and IBM) seems to have a bee in his bonnet that the existing
  zcache1 code _must_ be promoted _soon_ with as little change as possible.
  Other than the fact that he didn't like my patching approach [1],
  the only technical objection Seth has raised to zcache2 is that he
  thinks zsmalloc is the best choice of allocator [2] for his limited
  benchmarking [3].
 
 FWIW, I would fear that kernbench is not that interesting a benchmark for
 something like zcache. From an MM perspective, I would be wary that the
 data compresses too well and fits too neatly in the different buckets and
 make zsmalloc appear to behave much better than it would for a more general
 workload.  Of greater concern is that the allocations for zcache would be
 too short lived to measure if external fragmentation was a real problem
 or not. This is pure guesswork as I didn't read zsmalloc but this is the
 sort of problem I'd be looking out for if I did review it. In practice,
 I would probably prefer to depend on zbud because it avoids the external
 fragmentation problem even if it wasted memory but that's just me being
 cautious.

Your well-honed intuition is IMHO exactly right.

But my compromise proposal would allow the allocator decision to be delayed
until a broader set of workloads are brought to bear.

  I've offered to put zsmalloc back in to zcache2 as an optional
  (even default) 

[PATCH 13/20] staging: comedi: s626: add final attach message

2012-09-24 Thread H Hartley Sweeten
Add a simple dev_info() message after a successfull attach.
Change the final return to '0' to indicate success.

Signed-off-by: H Hartley Sweeten hswee...@visionengravers.com
Cc: Ian Abbott abbo...@mev.co.uk
Cc: Greg Kroah-Hartman gre...@linuxfoundation.org
---
 drivers/staging/comedi/drivers/s626.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/comedi/drivers/s626.c 
b/drivers/staging/comedi/drivers/s626.c
index f4251ac..07ff93b 100644
--- a/drivers/staging/comedi/drivers/s626.c
+++ b/drivers/staging/comedi/drivers/s626.c
@@ -2850,7 +2850,9 @@ static int s626_attach_pci(struct comedi_device *dev, 
struct pci_dev *pcidev)
 
s626_initialize(dev);
 
-   return 1;
+   dev_info(dev-class_dev, %s attached\n, dev-board_name);
+
+   return 0;
 }
 
 static void s626_detach(struct comedi_device *dev)
-- 
1.7.11

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


[PATCH 14/20] staging: comedi: s626: remove 'allocatedBuf' from private data

2012-09-24 Thread H Hartley Sweeten
This variable is only used to count the number of dma buffers
allocated during the attach. If an allocation fails, the attach
function exits with -ENOMEM. When this variable is checked later
it will always be == 2. Just remove the variable and the check.

This allows bringing the code back an indent level in
s626_initialize(). Note, coding style issues in this function
are not addressed yet.

Signed-off-by: H Hartley Sweeten hswee...@visionengravers.com
Cc: Ian Abbott abbo...@mev.co.uk
Cc: Greg Kroah-Hartman gre...@linuxfoundation.org
---
 drivers/staging/comedi/drivers/s626.c | 399 +-
 1 file changed, 194 insertions(+), 205 deletions(-)

diff --git a/drivers/staging/comedi/drivers/s626.c 
b/drivers/staging/comedi/drivers/s626.c
index 07ff93b..cd09c37 100644
--- a/drivers/staging/comedi/drivers/s626.c
+++ b/drivers/staging/comedi/drivers/s626.c
@@ -80,7 +80,6 @@ INSN_CONFIG instructions:
 
 struct s626_private {
void __iomem *base_addr;
-   short allocatedBuf;
uint8_t ai_cmd_running; /*  ai_cmd is running */
uint8_t ai_continous;   /*  continous acquisition */
int ai_sample_count;/*  number of samples to acquire */
@@ -2443,24 +2442,18 @@ static int s626_allocate_dma_buffers(struct 
comedi_device *dev)
void *addr;
dma_addr_t appdma;
 
-   devpriv-allocatedBuf = 0;
-
addr = pci_alloc_consistent(pcidev, DMABUF_SIZE, appdma);
if (!addr)
return -ENOMEM;
devpriv-ANABuf.LogicalBase = addr;
devpriv-ANABuf.PhysicalBase = appdma;
 
-   devpriv-allocatedBuf++;
-
addr = pci_alloc_consistent(pcidev, DMABUF_SIZE, appdma);
if (!addr)
return -ENOMEM;
devpriv-RPSBuf.LogicalBase = addr;
devpriv-RPSBuf.PhysicalBase = appdma;
 
-   devpriv-allocatedBuf++;
-
return 0;
 }
 
@@ -2471,117 +2464,116 @@ static void s626_initialize(struct comedi_device *dev)
 /*   uint16_t  StartVal; */
 /*   uint16_t  index; */
 /*   unsigned int data[16]; */
+   dma_addr_t pPhysBuf;
+   uint16_t chan;
int i;
 
-   if (devpriv-allocatedBuf == 2) {
-   dma_addr_t pPhysBuf;
-   uint16_t chan;
-
-   /*  enab DEBI and audio pins, enable I2C interface. */
-   MC_ENABLE(P_MC1, MC1_DEBI | MC1_AUDIO | MC1_I2C);
-   /*  Configure DEBI operating mode. */
-   WR7146(P_DEBICFG, DEBI_CFG_SLAVE16  /*  Local bus is 16 */
-  /*  bits wide. */
-  | (DEBI_TOUT  DEBI_CFG_TOUT_BIT)
-
-  /*  Declare DEBI */
-  /*  transfer timeout */
-  /*  interval. */
-  |DEBI_SWAP   /*  Set up byte lane */
-  /*  steering. */
-  | DEBI_CFG_INTEL);   /*  Intel-compatible */
-   /*  local bus (DEBI */
-   /*  never times out). */
-
-   /* DEBI INIT S626 WR7146( P_DEBICFG, DEBI_CFG_INTEL | 
DEBI_CFG_TOQ */
-   /* | DEBI_CFG_INCQ| DEBI_CFG_16Q); //end */
-
-   /*  Paging is disabled. */
-   WR7146(P_DEBIPAGE, DEBI_PAGE_DISABLE);  /*  Disable MMU paging. 
*/
-
-   /*  Init GPIO so that ADC Start* is negated. */
-   WR7146(P_GPIO, GPIO_BASE | GPIO1_HI);
-
-   /* IsBoardRevA is a boolean that indicates whether the board is 
RevA.
-*
-* VERSION 2.01 CHANGE: REV A  B BOARDS NOW SUPPORTED BY 
DYNAMIC
-* EEPROM ADDRESS SELECTION.  Initialize the I2C interface, 
which
-* is used to access the onboard serial EEPROM.  The EEPROM's 
I2C
-* DeviceAddress is hardwired to a value that is dependent on 
the
-* 626 board revision.  On all board revisions, the EEPROM 
stores
-* TrimDAC calibration constants for analog I/O.  On RevB and
-* higher boards, the DeviceAddress is hardwired to 0 to enable
-* the EEPROM to also store the PCI SubVendorID and SubDeviceID;
-* this is the address at which the SAA7146 expects a
-* configuration EEPROM to reside.  On RevA boards, the EEPROM
-* device address, which is hardwired to 4, prevents the SAA7146
-* from retrieving PCI sub-IDs, so the SAA7146 uses its built-in
-* default values, instead.
-*/
 
-   /* devpriv-I2Cards= IsBoardRevA ? 0xA8 : 0xA0; // Set I2C 
EEPROM */
-   /*  DeviceType (0xA0) */
-   /*  and DeviceAddress1. */
+   /*  enab DEBI and audio pins, enable I2C interface. */
+   MC_ENABLE(P_MC1, MC1_DEBI | MC1_AUDIO | MC1_I2C);
+   /*  Configure DEBI operating mode. */
+   WR7146(P_DEBICFG, DEBI_CFG_SLAVE16  /*  Local bus is 16 */
+  /*  bits wide. */
+  | (DEBI_TOUT  

[PATCH 15/20] staging: comedi: s626: #if 0 out the SAA7146 BUG WORKAROUND

2012-09-24 Thread H Hartley Sweeten
Until it's determined if this workaround can be removed, block
out the code with an #if 0/#endif and remove the individual
comments on each line.

Signed-off-by: H Hartley Sweeten hswee...@visionengravers.com
Cc: Ian Abbott abbo...@mev.co.uk
Cc: Greg Kroah-Hartman gre...@linuxfoundation.org
---
 drivers/staging/comedi/drivers/s626.c | 78 +++
 1 file changed, 42 insertions(+), 36 deletions(-)

diff --git a/drivers/staging/comedi/drivers/s626.c 
b/drivers/staging/comedi/drivers/s626.c
index cd09c37..4315892 100644
--- a/drivers/staging/comedi/drivers/s626.c
+++ b/drivers/staging/comedi/drivers/s626.c
@@ -2459,16 +2459,10 @@ static int s626_allocate_dma_buffers(struct 
comedi_device *dev)
 
 static void s626_initialize(struct comedi_device *dev)
 {
-/*   uint8_t   PollList; */
-/*   uint16_t  AdcData; */
-/*   uint16_t  StartVal; */
-/*   uint16_t  index; */
-/*   unsigned int data[16]; */
dma_addr_t pPhysBuf;
uint16_t chan;
int i;
 
-
/*  enab DEBI and audio pins, enable I2C interface. */
MC_ENABLE(P_MC1, MC1_DEBI | MC1_AUDIO | MC1_I2C);
/*  Configure DEBI operating mode. */
@@ -2568,38 +2562,50 @@ static void s626_initialize(struct comedi_device *dev)
/*  RPS program performs no explicit mem writes. */
WR7146(P_RPS1_TOUT, 0); /*  Disable RPS timeouts. */
 
-   /* SAA7146 BUG WORKAROUND.  Initialize SAA7146 ADC interface
-* to a known state by invoking ADCs until FB BUFFER 1
-* register shows that it is correctly receiving ADC data.
-* This is necessary because the SAA7146 ADC interface does
-* not start up in a defined state after a PCI reset.
+#if 0
+   /*
+* SAA7146 BUG WORKAROUND
+*
+* Initialize SAA7146 ADC interface to a known state by
+* invoking ADCs until FB BUFFER 1 register shows that it
+* is correctly receiving ADC data. This is necessary
+* because the SAA7146 ADC interface does not start up in
+* a defined state after a PCI reset.
 */
 
-/* PollList = EOPL;// Create a simple polling */
-/* // list for analog input */
-/* // channel 0. */
-/* ResetADC( dev, PollList ); */
-
-/* s626_ai_rinsn(dev,dev-subdevices,NULL,data); //( AdcData ); // */
-/* //Get initial ADC */
-/* //value. */
-
-/* StartVal = data[0]; */
-
-/* // VERSION 2.01 CHANGE: TIMEOUT ADDED TO PREVENT HANGED EXECUTION. */
-/* // Invoke ADCs until the new ADC value differs from the initial */
-/* // value or a timeout occurs.  The timeout protects against the */
-/* // possibility that the driver is restarting and the ADC data is a */
-/* // fixed value resulting from the applied ADC analog input being */
-/* // unusually quiet or at the rail. */
-
-/* for ( index = 0; index  500; index++ ) */
-/*   { */
-/* s626_ai_rinsn(dev,dev-subdevices,NULL,data); */
-/* AdcData = data[0];  //ReadADC(  AdcData ); */
-/* if ( AdcData != StartVal ) */
-/* break; */
-/*   } */
+   {
+   uint8_t PollList;
+   uint16_t AdcData;
+   uint16_t StartVal;
+   uint16_t index;
+   unsigned int data[16];
+
+   /* Create a simple polling list for analog input channel 0 */
+   PollList = EOPL;
+   ResetADC(dev, PollList);
+
+   /* Get initial ADC value */
+   s626_ai_rinsn(dev, dev-subdevices, NULL, data);
+   StartVal = data[0];
+
+   /*
+* VERSION 2.01 CHANGE: TIMEOUT ADDED TO PREVENT HANGED EXECUTION.
+*
+* Invoke ADCs until the new ADC value differs from the initial
+* value or a timeout occurs.  The timeout protects against the
+* possibility that the driver is restarting and the ADC data is a
+* fixed value resulting from the applied ADC analog input being
+* unusually quiet or at the rail.
+*/
+   for (index = 0; index  500; index++) {
+   s626_ai_rinsn(dev, dev-subdevices, NULL, data);
+   AdcData = data[0];
+   if (AdcData != StartVal)
+   break;
+   }
+
+   }
+#endif /* SAA7146 BUG WORKAROUND */
 
/*  end initADC */
 
-- 
1.7.11

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


[PATCH 16/20] staging: comedi: s626: remove 'IsBoardRevA' comment

2012-09-24 Thread H Hartley Sweeten
IsBoardRevA is not defined in the driver. Remove the comment
about it.

Signed-off-by: H Hartley Sweeten hswee...@visionengravers.com
Cc: Ian Abbott abbo...@mev.co.uk
Cc: Greg Kroah-Hartman gre...@linuxfoundation.org
---
 drivers/staging/comedi/drivers/s626.c | 25 ++---
 1 file changed, 2 insertions(+), 23 deletions(-)

diff --git a/drivers/staging/comedi/drivers/s626.c 
b/drivers/staging/comedi/drivers/s626.c
index 4315892..e67e129 100644
--- a/drivers/staging/comedi/drivers/s626.c
+++ b/drivers/staging/comedi/drivers/s626.c
@@ -2488,29 +2488,8 @@ static void s626_initialize(struct comedi_device *dev)
/*  Init GPIO so that ADC Start* is negated. */
WR7146(P_GPIO, GPIO_BASE | GPIO1_HI);
 
-   /* IsBoardRevA is a boolean that indicates whether the board is RevA.
-*
-* VERSION 2.01 CHANGE: REV A  B BOARDS NOW SUPPORTED BY DYNAMIC
-* EEPROM ADDRESS SELECTION.  Initialize the I2C interface, which
-* is used to access the onboard serial EEPROM.  The EEPROM's I2C
-* DeviceAddress is hardwired to a value that is dependent on the
-* 626 board revision.  On all board revisions, the EEPROM stores
-* TrimDAC calibration constants for analog I/O.  On RevB and
-* higher boards, the DeviceAddress is hardwired to 0 to enable
-* the EEPROM to also store the PCI SubVendorID and SubDeviceID;
-* this is the address at which the SAA7146 expects a
-* configuration EEPROM to reside.  On RevA boards, the EEPROM
-* device address, which is hardwired to 4, prevents the SAA7146
-* from retrieving PCI sub-IDs, so the SAA7146 uses its built-in
-* default values, instead.
-*/
-
-   /* devpriv-I2Cards= IsBoardRevA ? 0xA8 : 0xA0; // Set I2C EEPROM */
-   /*  DeviceType (0xA0) */
-   /*  and DeviceAddress1. */
-
-   devpriv-I2CAdrs = 0xA0;/*  I2C device address for onboard */
-   /*  eeprom(revb) */
+   /* I2C device address for onboard eeprom (revb) */
+   devpriv-I2CAdrs = 0xA0;
 
/*  Issue an I2C ABORT command to halt any I2C operation in */
/* progress and reset BUSY flag. */
-- 
1.7.11

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


[PATCH 18/20] staging: comedi: s626: remove 'WDInterval' from private data

2012-09-24 Thread H Hartley Sweeten
This variable is never used in the driver. Just remove it.

Signed-off-by: H Hartley Sweeten hswee...@visionengravers.com
Cc: Ian Abbott abbo...@mev.co.uk
Cc: Greg Kroah-Hartman gre...@linuxfoundation.org
---
 drivers/staging/comedi/drivers/s626.c | 7 ---
 1 file changed, 7 deletions(-)

diff --git a/drivers/staging/comedi/drivers/s626.c 
b/drivers/staging/comedi/drivers/s626.c
index 4eb1a67..0b89737 100644
--- a/drivers/staging/comedi/drivers/s626.c
+++ b/drivers/staging/comedi/drivers/s626.c
@@ -99,7 +99,6 @@ struct s626_private {
uint16_t Dacpol;/* Image of DAC polarity register. */
uint8_t TrimSetpoint[12];   /* Images of TrimDAC setpoints */
/* Charge Enabled (0 or WRMISC2_CHARGE_ENABLE). */
-   uint16_t WDInterval;/* Image of MISC2 watchdog interval control 
bits. */
uint32_t I2CAdrs;
/* I2C device address for onboard EEPROM (board rev dependent). */
/*   short I2Cards; */
@@ -2666,12 +2665,6 @@ static void s626_initialize(struct comedi_device *dev)
for (chan = 0; chan  S626_DAC_CHANNELS; chan++)
SetDAC(dev, chan, 0);
 
-   /* Init image of watchdog timer interval in WRMISC2.  This image
-* maintains the value of the control bits of MISC2 are
-* continuously reset to zero as long as the WD timer is disabled.
-*/
-   devpriv-WDInterval = 0;
-
/* Init Counter Interrupt enab mask for RDMISC2.  This mask is
 * applied against MISC2 when testing to determine which timer
 * events are requesting interrupt service.
-- 
1.7.11

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


[PATCH 19/20] staging: comedi: s626: remove clear of kzalloc'ed data

2012-09-24 Thread H Hartley Sweeten
The private data is kzalloc'ed. There is no need to set any
of the initial data to '0'.

Signed-off-by: H Hartley Sweeten hswee...@visionengravers.com
Cc: Ian Abbott abbo...@mev.co.uk
Cc: Greg Kroah-Hartman gre...@linuxfoundation.org
---
 drivers/staging/comedi/drivers/s626.c | 6 --
 1 file changed, 6 deletions(-)

diff --git a/drivers/staging/comedi/drivers/s626.c 
b/drivers/staging/comedi/drivers/s626.c
index 0b89737..6f1705b 100644
--- a/drivers/staging/comedi/drivers/s626.c
+++ b/drivers/staging/comedi/drivers/s626.c
@@ -2665,12 +2665,6 @@ static void s626_initialize(struct comedi_device *dev)
for (chan = 0; chan  S626_DAC_CHANNELS; chan++)
SetDAC(dev, chan, 0);
 
-   /* Init Counter Interrupt enab mask for RDMISC2.  This mask is
-* applied against MISC2 when testing to determine which timer
-* events are requesting interrupt service.
-*/
-   devpriv-CounterIntEnabs = 0;
-
/*  Init counters. */
CountersInit(dev);
 
-- 
1.7.11

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


[PATCH 20/20] staging: comedi: s626: cleanup comments in s626_initialize()

2012-09-24 Thread H Hartley Sweeten
Cleanup the comments to follow the coding style of the kernel.

Signed-off-by: H Hartley Sweeten hswee...@visionengravers.com
Cc: Ian Abbott abbo...@mev.co.uk
Cc: Greg Kroah-Hartman gre...@linuxfoundation.org
---
 drivers/staging/comedi/drivers/s626.c | 169 ++
 1 file changed, 88 insertions(+), 81 deletions(-)

diff --git a/drivers/staging/comedi/drivers/s626.c 
b/drivers/staging/comedi/drivers/s626.c
index 6f1705b..e1d10f3 100644
--- a/drivers/staging/comedi/drivers/s626.c
+++ b/drivers/staging/comedi/drivers/s626.c
@@ -2461,83 +2461,80 @@ static void s626_initialize(struct comedi_device *dev)
uint16_t chan;
int i;
 
-   /*  enab DEBI and audio pins, enable I2C interface. */
+   /* Enable DEBI and audio pins, enable I2C interface */
MC_ENABLE(P_MC1, MC1_DEBI | MC1_AUDIO | MC1_I2C);
-   /*  Configure DEBI operating mode. */
-   WR7146(P_DEBICFG, DEBI_CFG_SLAVE16  /*  Local bus is 16 */
-  /*  bits wide. */
-  | (DEBI_TOUT  DEBI_CFG_TOUT_BIT)
-
-  /*  Declare DEBI */
-  /*  transfer timeout */
-  /*  interval. */
-  |DEBI_SWAP   /*  Set up byte lane */
-  /*  steering. */
-  | DEBI_CFG_INTEL);   /*  Intel-compatible */
-   /*  local bus (DEBI */
-   /*  never times out). */
-
-   /* DEBI INIT S626 WR7146( P_DEBICFG, DEBI_CFG_INTEL | DEBI_CFG_TOQ */
-   /* | DEBI_CFG_INCQ| DEBI_CFG_16Q); //end */
-
-   /*  Paging is disabled. */
-   WR7146(P_DEBIPAGE, DEBI_PAGE_DISABLE);  /*  Disable MMU paging. */
-
-   /*  Init GPIO so that ADC Start* is negated. */
+
+   /*
+*  Configure DEBI operating mode
+*
+*   Local bus is 16 bits wide
+*   Declare DEBI transfer timeout interval
+*   Set up byte lane steering
+*   Intel-compatible local bus (DEBI never times out)
+*/
+   WR7146(P_DEBICFG, DEBI_CFG_SLAVE16 |
+ (DEBI_TOUT  DEBI_CFG_TOUT_BIT) |
+ DEBI_SWAP | DEBI_CFG_INTEL);
+
+   /* Disable MMU paging */
+   WR7146(P_DEBIPAGE, DEBI_PAGE_DISABLE);
+
+   /* Init GPIO so that ADC Start* is negated */
WR7146(P_GPIO, GPIO_BASE | GPIO1_HI);
 
/* I2C device address for onboard eeprom (revb) */
devpriv-I2CAdrs = 0xA0;
 
-   /*  Issue an I2C ABORT command to halt any I2C operation in */
-   /* progress and reset BUSY flag. */
+   /*
+* Issue an I2C ABORT command to halt any I2C
+* operation in progress and reset BUSY flag.
+*/
WR7146(P_I2CSTAT, I2C_CLKSEL | I2C_ABORT);
-   /*  Write I2C control: abort any I2C activity. */
MC_ENABLE(P_MC2, MC2_UPLD_IIC);
-   /*  Invoke command  upload */
while ((RR7146(P_MC2)  MC2_UPLD_IIC) == 0)
;
-   /*  and wait for upload to complete. */
 
-   /* Per SAA7146 data sheet, write to STATUS reg twice to
-* reset all  I2C error flags. */
+   /*
+* Per SAA7146 data sheet, write to STATUS
+* reg twice to reset all  I2C error flags.
+*/
for (i = 0; i  2; i++) {
WR7146(P_I2CSTAT, I2C_CLKSEL);
-   /*  Write I2C control: reset  error flags. */
-   MC_ENABLE(P_MC2, MC2_UPLD_IIC); /*  Invoke command upload */
+   MC_ENABLE(P_MC2, MC2_UPLD_IIC);
while (!MC_TEST(P_MC2, MC2_UPLD_IIC))
;
-   /* and wait for upload to complete. */
}
 
-   /* Init audio interface functional attributes: set DAC/ADC
+   /*
+* Init audio interface functional attributes: set DAC/ADC
 * serial clock rates, invert DAC serial clock so that
 * DAC data setup times are satisfied, enable DAC serial
 * clock out.
 */
-
WR7146(P_ACON2, ACON2_INIT);
 
-   /* Set up TSL1 slot list, which is used to control the
+   /*
+* Set up TSL1 slot list, which is used to control the
 * accumulation of ADC data: RSD1 = shift data in on SD1.
-* SIB_A1  = store data uint8_t at next available location in
-* FB BUFFER1  register. */
+* SIB_A1  = store data uint8_t at next available location
+* in FB BUFFER1 register.
+*/
WR7146(P_TSL1, RSD1 | SIB_A1);
-   /*  Fetch ADC high data uint8_t. */
WR7146(P_TSL1 + 4, RSD1 | SIB_A1 | EOS);
-   /*  Fetch ADC low data uint8_t; end of TSL1. */
 
-   /*  enab TSL1 slot list so that it executes all the time. */
+   /* Enable TSL1 slot list so that it executes all the time */
WR7146(P_ACON1, ACON1_ADCSTART);
 
-   /*  Initialize RPS registers used for ADC. */
-
-   /* Physical start of RPS program. */
-   WR7146(P_RPSADDR1, (uint32_t) devpriv-RPSBuf.PhysicalBase);
+   /*
+* Initialize RPS registers used for ADC
+*/
 
+   /* Physical 

RE: [PATCH 16/17] staging: comedi: s526: remove struct s526GPCTConfig

2012-09-24 Thread H Hartley Sweeten
On Saturday, September 22, 2012 6:11 AM, Dan Carpenter wrote:
 On Wed, Sep 19, 2012 at 03:12:54PM -0700, H Hartley Sweeten wrote:
 +case INSN_CONFIG_GPCT_PULSE_TRAIN_GENERATOR:
  /* data[0] contains the PULSE_WIDTH
 data[1] contains the PULSE_PERIOD
 @pre PULSE_PERIOD  PULSE_WIDTH  0
 The above periods must be expressed as a multiple of the
 pulse frequency on the selected source
   */
 -if ((data[1]  data[0])  (data[0]  0)) {
 -devpriv-s526_gpct_config[chan].data[0] = data[0];
 -devpriv-s526_gpct_config[chan].data[1] = data[1];
 -} else {
 +if ((data[1]  data[0]) || !data[0])
 ^
 Should this be:
   if ((data[1] = data[0] ...
 That would match the original code better.

Oops.. Good catch.

I just posted a patch to fix this.

Thanks,
Hartley

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


[PATCH] staging: dgrp: fix potential call to strncpy with a negative number

2012-09-24 Thread Bill Pemberton
In dgrp_receive() there is:

   desclen = ((plen - 12)  MAX_DESC_LEN) ? MAX_DESC_LEN :
plen - 12;
   strncpy(nd-nd_ps_desc, b + 12, desclen);

However, it's possible for plen to be = 12 here so we'd be passing a
negative number into the strncpy().  Fix this to not make the strncpy
call and report an error if desclen is = 0

Reported-by: Dan Carpenter dan.carpen...@oracle.com
Signed-off-by: Bill Pemberton wf...@virginia.edu
---
 drivers/staging/dgrp/dgrp_net_ops.c | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/drivers/staging/dgrp/dgrp_net_ops.c 
b/drivers/staging/dgrp/dgrp_net_ops.c
index d9d6b67..ab839ea 100644
--- a/drivers/staging/dgrp/dgrp_net_ops.c
+++ b/drivers/staging/dgrp/dgrp_net_ops.c
@@ -3156,6 +3156,12 @@ check_query:
nd-nd_hw_id = b[6];
desclen = ((plen - 12)  
MAX_DESC_LEN) ? MAX_DESC_LEN :
plen - 12;
+
+   if (desclen = 0) {
+   error = Response 
Packet desclen error;
+   goto prot_error;
+   }
+
strncpy(nd-nd_ps_desc, b + 12, 
desclen);
nd-nd_ps_desc[desclen] = 0;
}
-- 
1.7.12

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


RE: [PATCH] staging: comedi: gsc_hpdi: make internal functions static

2012-09-24 Thread H Hartley Sweeten
On Monday, September 24, 2012 7:48 AM, Ian Abbott wrote:
 This module does not export any symbols so declare all the functions as
 `static`.  Some of them are currently unused but might get used in the
 future, so tag them as `__maybe_unused` for now to get rid of compiler
 warnings.

 Signed-off-by: Ian Abbott abbo...@mev.co.uk
 ---
  drivers/staging/comedi/drivers/gsc_hpdi.c | 41 
 +--
  1 file changed, 22 insertions(+), 19 deletions(-)

 diff --git a/drivers/staging/comedi/drivers/gsc_hpdi.c 
 b/drivers/staging/comedi/drivers/gsc_hpdi.c
 index 5d3fa71..5fbd827 100644
 --- a/drivers/staging/comedi/drivers/gsc_hpdi.c
 +++ b/drivers/staging/comedi/drivers/gsc_hpdi.c
 @@ -104,7 +104,7 @@ enum hpdi_registers {
   INTERRUPT_POLARITY_REG = 0x54,
  };
  
 -int command_channel_valid(unsigned int channel)
 +static int command_channel_valid(unsigned int channel)
  {
   if (channel == 0 || channel  6) {
   printk(KERN_WARNING

Ian,

Many of these should either just be removed or converted to macros.
Then the __maybe_unused would not be needed. This one could just
be something like:

#define CMD_CHAN_VALID(x)   x)  0)  ((x) = 6)) ? 1 : 0)

 @@ -119,17 +119,18 @@ int command_channel_valid(unsigned int channel)
  enum firmware_revision_bits {
   FEATURES_REG_PRESENT_BIT = 0x8000,
  };
 -int firmware_revision(uint32_t fwr_bits)
 +
 +static int __maybe_unused firmware_revision(uint32_t fwr_bits)
  {
   return fwr_bits  0xff;
  }

#define FIRMWARE_REV(x) ((x)  0xff)
 
 -int pcb_revision(uint32_t fwr_bits)
 +static int __maybe_unused pcb_revision(uint32_t fwr_bits)
  {
   return (fwr_bits  8)  0xff;
  }
 
#define PCB_REV(x)  (((x)  8)  0xff)

 -int hpdi_subid(uint32_t fwr_bits)
 +static int __maybe_unused hpdi_subid(uint32_t fwr_bits)
  {
   return (fwr_bits  16)  0xff;
  }

#define HPDI_SUBID(x)   (((x)  16)  0xff)

 @@ -147,8 +148,9 @@ enum board_control_bits {
   CABLE_THROTTLE_ENABLE_BIT = 0x20,
   TEST_MODE_ENABLE_BIT = 0x8000,
  };
 -uint32_t command_discrete_output_bits(unsigned int channel, int output,
 -   int output_value)
 +
 +static uint32_t __maybe_unused
 +command_discrete_output_bits(unsigned int channel, int output, int 
 output_value)
  {
   uint32_t bits = 0;
  
 @@ -182,24 +184,24 @@ enum board_status_bits {
   RX_OVERRUN_BIT = 0x80,
  };

This one is a bit messy to be a macro. It's also not used so 
maybe just remove it.

  
 -uint32_t almost_full_bits(unsigned int num_words)
 +static uint32_t almost_full_bits(unsigned int num_words)
  {
 -/* XXX need to add or subtract one? */
 + /* XXX need to add or subtract one? */
   return (num_words  16)  0xff;
  }

#deifne ALMOST_FULL_BITS(x) (((x)  16)  0xff)

  
 -uint32_t almost_empty_bits(unsigned int num_words)
 +static uint32_t almost_empty_bits(unsigned int num_words)
  {
   return num_words  0x;
  }

#define ALMOST_EMPTY_BITS(x)((x)  0x)
 
 -unsigned int almost_full_num_words(uint32_t bits)
 +static unsigned int __maybe_unused almost_full_num_words(uint32_t bits)
  {
 -/* XXX need to add or subtract one? */
 + /* XXX need to add or subtract one? */
   return (bits  16)  0x;
  }

#define ALMOST_FULL_NUM_WORDS(x)(((x)  16)  0x)
 
 -unsigned int almost_empty_num_words(uint32_t bits)
 +static unsigned int __maybe_unused almost_empty_num_words(uint32_t bits)
  {
   return bits  0x;
  }

#define ALMOST_EMPTY_NUM_WORDS(x)   ((x)  0x)

 @@ -225,39 +227,40 @@ enum interrupt_sources {
   RX_ALMOST_FULL_INTR = 14,
   RX_FULL_INTR = 15,
  };
 -int command_intr_source(unsigned int channel)
 +
 +static int __maybe_unused command_intr_source(unsigned int channel)
  {
   if (command_channel_valid(channel) == 0)
   channel = 1;
   return channel + 1;
  }

#define CMD_INTR_SOURCE(x)  (CMD_CHAN_VALID(x) ? ((x) + 1) : 1)

 -uint32_t intr_bit(int interrupt_source)
 +static uint32_t intr_bit(int interrupt_source)
  {
   return 0x1  interrupt_source;
  }
 
#define INTR_BIT(x) (1  (x))

 -uint32_t tx_clock_divisor_bits(unsigned int divisor)
 +static uint32_t __maybe_unused tx_clock_divisor_bits(unsigned int divisor)
  {
   return divisor  0xff;
  }

#define TX_CLK_DIV(x)   ((x)  0xff)
 
 -unsigned int fifo_size(uint32_t fifo_size_bits)
 +static unsigned int fifo_size(uint32_t fifo_size_bits)
  {
   return fifo_size_bits  0xf;
  }
 
#define FIFO_SIZE(x)((x)  0x f)

 -unsigned int fifo_words(uint32_t fifo_words_bits)
 +static unsigned int __maybe_unused fifo_words(uint32_t fifo_words_bits)
  {
   return fifo_words_bits  0xf;
  }
 
#define FIFO_WORDS(x)   ((x)  0xf)

 -uint32_t intr_edge_bit(int interrupt_source)
 +static uint32_t __maybe_unused intr_edge_bit(int interrupt_source)
  {
   return 0x1  interrupt_source;
  }
 
#define INTR_EDGE_BIT(x)   

[PATCH] staging: comedi: s526: fix if() check in s526_gpct_winsn()

2012-09-24 Thread H Hartley Sweeten
This if() check was flipped from a test for valid data params
to a test for invalid params.

As pointed out by Dan Carpenter, the orignal test was:

if ((data[1]  data[0])  (data[0]  0)) {

the flipped test should be:

if (data[1] = data[0]) ...

Add the missing '='.

Signed-off-by: H Hartley Sweeten hswee...@visionengravers.com
Reported-by: Dan Carpenter dan.carpen...@oracle.com
Cc: Ian Abbott abbo...@mev.co.uk
Cc: Greg Kroah-Hartman gre...@linuxfoundation.org
---
 drivers/staging/comedi/drivers/s526.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/comedi/drivers/s526.c 
b/drivers/staging/comedi/drivers/s526.c
index 4ad6adf..a1e2562 100644
--- a/drivers/staging/comedi/drivers/s526.c
+++ b/drivers/staging/comedi/drivers/s526.c
@@ -376,7 +376,7 @@ static int s526_gpct_winsn(struct comedi_device *dev,
   The above periods must be expressed as a multiple of the
   pulse frequency on the selected source
 */
-   if ((data[1]  data[0]) || !data[0])
+   if ((data[1] = data[0]) || !data[0])
return -EINVAL;
 
/* Fall thru to write the PULSE_WIDTH */
-- 
1.7.11

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


RE: [PATCH] staging: comedi: ni_mio_common: always lock in ni_ai_poll()

2012-09-24 Thread H Hartley Sweeten
On Monday, September 24, 2012 8:28 AM, Ian Abbott wrote:
 `ni_ai_poll()` currently acquires (and later releases) the comedi
 device's spin-lock iff `in_interrupt()` returns 0.  However, it is only
 called during processing of a `COMEDI_POLL` ioctl so `in_interrupt()`
 will always return 0 in this case.  Remove this test and acquire/release
 the spin-lock unconditionally.  This eliminates a sparse warning about
 different lock contexts for basic block.

Ian,

How can you guarantee that the user space COMEDI_POLL ioctl wil
never happen when this driver is handling its interrupt?

Maybe a better solution would be for ni_ai_poll() to just return 
-EBUSY if it is in_interrupt().

Regards,
Hartley

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


RE: [PATCH 1/2] staging: comedi: s626: don't dereference insn-data

2012-09-24 Thread H Hartley Sweeten
On Monday, September 24, 2012 9:21 AM, Ian Abbott wrote:
 
 `s626_enc_insn_config()` is incorrectly dereferencing `insn-data` which
 is a pointer to user memory.  It should be dereferencing the separate
 `data` parameter that points to a copy of the data in kernel memory.

 Cc: sta...@vger.kernel.org
 Signed-off-by: Ian Abbott abbo...@mev.co.uk
 ---
  drivers/staging/comedi/drivers/s626.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

 diff --git a/drivers/staging/comedi/drivers/s626.c 
 b/drivers/staging/comedi/drivers/s626.c
 index f90578e..2b03b68 100644
 --- a/drivers/staging/comedi/drivers/s626.c
 +++ b/drivers/staging/comedi/drivers/s626.c
 @@ -1868,7 +1868,7 @@ static int s626_enc_insn_config(struct comedi_device 
 *dev,
   /*   (data==NULL) ? (Preloadvalue=0) : (Preloadvalue=data[0]); */
  
   k-SetMode(dev, k, Setup, TRUE);
 - Preload(dev, k, *(insn-data));
 + Preload(dev, k, data[0]);
   k-PulseIndex(dev, k);
   SetLatchSource(dev, k, valueSrclatch);
   k-SetEnable(dev, k, (uint16_t) (enab != 0));

Hmm.. Thought I fixed this last week.. Oh well..

Reviewed-by: H Hartley Sweeten hswee...@visionengravers.com

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


RE: [PATCH] staging: comedi: jr3_pci: add __iomem tags

2012-09-24 Thread H Hartley Sweeten
On Monday, September 24, 2012 9:47 AM, Ian Abbott wrote:
 On 2012-09-24 17:38, H Hartley Sweeten wrote:
  On Monday, September 24, 2012 7:20 AM, Ian Abbott wrote:
  Tag pointers to remapped I/O memory with `__iomem` and remove the
  `volatile` qualifiers.  Fix the single place in `jr3_pci_attach()` where
  an I/O memory pointer is being dereferenced directly to use the
  appropriate I/O memory access function.
 
  Signed-off-by: Ian Abbott abbo...@mev.co.uk

 Ian,

 I don't think this is _completely_ right.

 ---
   drivers/staging/comedi/drivers/jr3_pci.c | 35 
 
   drivers/staging/comedi/drivers/jr3_pci.h | 12 +--
   2 files changed, 24 insertions(+), 23 deletions(-)

 diff --git a/drivers/staging/comedi/drivers/jr3_pci.c 
 b/drivers/staging/comedi/drivers/jr3_pci.c
 index 360107c..5b193ef 100644
 --- a/drivers/staging/comedi/drivers/jr3_pci.c
 +++ b/drivers/staging/comedi/drivers/jr3_pci.c
 @@ -62,7 +62,7 @@ struct jr3_pci_dev_private {

 struct pci_dev *pci_dev;
 int pci_enabled;
 -   volatile struct jr3_t *iobase;
 +   struct jr3_t __iomem *iobase;

 The ioremap'ed pci base address is a 'void __iomem *'. This is casting
 it to a 'struct jr3_t __iomem *'. Which still leaves this driver with the
 goofy indirect i/o using the struct instead of normal read[lwb]/write[lwb]
 calls.

 Changing the iobase variable in the struct like you have done may
 get rid of the sparse warning but this drive is still pretty darn confusing.

 I think the struct itself needs to be removed an replaced with #define's
 for the memory map of the card. Then all the struct i/o access can be
 replaced with read*/write* calls as appropriate.

 It is actually using readl() and writel() throughout (mostly via its 
 `get_s16()`, `set_s16()`, get_u16()` and `set_u16()` functions), but 
 yes, the way the register offsets is determined is a bit goofy!

No. There are places like this:

/*  Reset DSP card */
devpriv-iobase-channel[0].reset = 0;

Which should be something like:

#define JR3_RESET_CHAN(x)   /* this needs to be determined */

writel(0, devpriv-iobase + JR3_RESET_CHAN(0));

Regards,
Hartley

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


Re: [PATCH 1/2] The tidspbridge driver does not compile anymore (Some OMAP34XX CPU definitions are missing). I Added a header file for these definitions.

2012-09-24 Thread Omar Ramirez Luna
Hi,

On Mon, Sep 24, 2012 at 1:54 PM, selso selso.liber...@gmail.com wrote:
 From: sli sli@SLI-V420.(none)


 Signed-off-by: sli sli@SLI-V420.(none)
 ---
  drivers/staging/tidspbridge/core/dsp-clock.c   |3 ++
  drivers/staging/tidspbridge/core/tiomap3430.c  |4 ++
  drivers/staging/tidspbridge/core/wdt.c |2 +-
  .../tidspbridge/include/dspbridge/omap34xx.h   |   33 
 
  4 files changed, 41 insertions(+), 1 deletions(-)
  create mode 100644 drivers/staging/tidspbridge/include/dspbridge/omap34xx.h

This is fixed with this patch:

https://patchwork.kernel.org/patch/1435311/

Thanks,

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


[PATCH] Staging:bcm: fix coding style error in InterfaceDld.c and InterfaceIdleMode.c

2012-09-24 Thread Gorskin Ilya
This is a patch to the InterfaceIdleMode.c, InterfaceDld.c files that
fixes up a coding style errors found by the checkpatch.pl tool

Signed-off-by: Ilya Gorskin reven...@gmail.com
---
 drivers/staging/bcm/InterfaceDld.c  |  16 +--
 drivers/staging/bcm/InterfaceIdleMode.c | 219 +---
 2 files changed, 99 insertions(+), 136 deletions(-)

diff --git a/drivers/staging/bcm/InterfaceDld.c 
b/drivers/staging/bcm/InterfaceDld.c
index 3a89e33..1810d4a 100644
--- a/drivers/staging/bcm/InterfaceDld.c
+++ b/drivers/staging/bcm/InterfaceDld.c
@@ -35,9 +35,9 @@ int InterfaceFileDownload(PVOID arg, struct file *flp, 
unsigned int on_chip_loc)
break;
}
/* BCM_DEBUG_PRINT_BUFFER(Adapter,DBG_TYPE_INITEXIT, MP_INIT,
-*DBG_LVL_ALL, buff,
-*MAX_TRANSFER_CTRL_BYTE_USB);
-*/
+   *   DBG_LVL_ALL, buff,
+   *   MAX_TRANSFER_CTRL_BYTE_USB);
+   */
errno = InterfaceWRM(psIntfAdapter, on_chip_loc, buff, len);
if (errno) {
BCM_DEBUG_PRINT(psIntfAdapter-psAdapter,
@@ -115,7 +115,7 @@ int InterfaceFileReadbackFromChip(PVOID arg, struct file 
*flp, unsigned int on_c
while (len) {
if (*(unsigned int *)buff_readback[len] != 
*(unsigned int *)buff[len]) {

BCM_DEBUG_PRINT(psIntfAdapter-psAdapter, DBG_TYPE_INITEXIT, MP_INIT, 
DBG_LVL_ALL, Firmware Download is not proper %d, fw_down);
-   
BCM_DEBUG_PRINT(psIntfAdapter-psAdapter, DBG_TYPE_INITEXIT, MP_INIT, 
DBG_LVL_ALL, Val from Binary %x, Val From Read Back %x , *(unsigned int 
*)buff[len], *(unsigned int*)buff_readback[len]);
+   
BCM_DEBUG_PRINT(psIntfAdapter-psAdapter, DBG_TYPE_INITEXIT, MP_INIT, 
DBG_LVL_ALL, Val from Binary %x, Val From Read Back %x , *(unsigned int 
*)buff[len], *(unsigned int *)buff_readback[len]);

BCM_DEBUG_PRINT(psIntfAdapter-psAdapter, DBG_TYPE_INITEXIT, MP_INIT, 
DBG_LVL_ALL, len =%x!!!, len);
Status = -EIO;
goto exit;
@@ -218,7 +218,7 @@ static int bcm_compare_buff_contents(unsigned char 
*readbackbuff, unsigned char
while (len) {
if (*(unsigned int *)readbackbuff[len] != *(unsigned 
int *)buff[len]) {
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_INITEXIT, 
MP_INIT, DBG_LVL_ALL, Firmware Download is not proper);
-   BCM_DEBUG_PRINT(Adapter, DBG_TYPE_INITEXIT, 
MP_INIT, DBG_LVL_ALL, Val from Binary %x, Val From Read Back %x , *(unsigned 
int *)buff[len], *(unsigned int*)readbackbuff[len]);
+   BCM_DEBUG_PRINT(Adapter, DBG_TYPE_INITEXIT, 
MP_INIT, DBG_LVL_ALL, Val from Binary %x, Val From Read Back %x , *(unsigned 
int *)buff[len], *(unsigned int *)readbackbuff[len]);
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_INITEXIT, 
MP_INIT, DBG_LVL_ALL, len =%x!!!, len);
retval = -EINVAL;
break;
@@ -235,9 +235,9 @@ int bcm_ioctl_fw_download(struct bcm_mini_adapter *Adapter, 
struct bcm_firmware_
PUCHAR buff = NULL;
 
/* Config File is needed for the Driver to download the Config file and
-* Firmware. Check for the Config file to be first to be sent from the
-* Application
-*/
+   * Firmware. Check for the Config file to be first to be sent from the
+   * Application
+   */
atomic_set(Adapter-uiMBupdate, FALSE);
if (!Adapter-bCfgDownloaded  psFwInfo-u32StartingAddress != 
CONFIG_BEGIN_ADDR) {
/* Can't Download Firmware. */
diff --git a/drivers/staging/bcm/InterfaceIdleMode.c 
b/drivers/staging/bcm/InterfaceIdleMode.c
index 4f2f490..de48630 100644
--- a/drivers/staging/bcm/InterfaceIdleMode.c
+++ b/drivers/staging/bcm/InterfaceIdleMode.c
@@ -42,161 +42,141 @@ send to f/w with in 200 ms after the Idle/Shutdown req 
issued
 */
 
 
-int InterfaceIdleModeRespond(struct bcm_mini_adapter *Adapter, unsigned int* 
puiBuffer)
+int InterfaceIdleModeRespond(struct bcm_mini_adapter *Adapter,
+   unsigned int *puiBuffer)
 {
int status = STATUS_SUCCESS;
unsigned intuiRegRead = 0;
int bytes;
 
-   BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, IDLE_MODE, 
DBG_LVL_ALL,SubType of Message :0x%X, ntohl(*puiBuffer));
+   BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, IDLE_MODE, DBG_LVL_ALL,
+   SubType of Message :0x%X, ntohl(*puiBuffer));
 
-   if(ntohl(*puiBuffer) == GO_TO_IDLE_MODE_PAYLOAD)

[PATCH 2/3] Staging:bcm: fix coding style error in InterfaceIsr.c

2012-09-24 Thread Gorskin Ilya
This is a patch to the InterfaceIsr.c file that
fixes up a coding style issues found by the checkpatch.pl tool

Signed-off-by: Ilya Gorskin reven...@gmail.com
---
 drivers/staging/bcm/InterfaceIsr.c | 178 +
 1 file changed, 102 insertions(+), 76 deletions(-)

diff --git a/drivers/staging/bcm/InterfaceIsr.c 
b/drivers/staging/bcm/InterfaceIsr.c
index 6ee3428..4f78451 100644
--- a/drivers/staging/bcm/InterfaceIsr.c
+++ b/drivers/staging/bcm/InterfaceIsr.c
@@ -11,101 +11,123 @@ static void read_int_callback(struct urb *urb/*, struct 
pt_regs *regs*/)
pr_info(PFX %s: interrupt status %d\n,
Adapter-dev-name, status);
 
-   if(Adapter-device_removed == TRUE)
-   {
-   BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, INTF_INIT, 
DBG_LVL_ALL,Device has Got Removed.);
+   if (Adapter-device_removed == TRUE) {
+   BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, INTF_INIT,
+   iDBG_LVL_ALL, Device has Got Removed.);
return ;
}
 
-   if(((Adapter-bPreparingForLowPowerMode == TRUE)  
(Adapter-bDoSuspend == TRUE)) ||
-   psIntfAdapter-bSuspended ||
-   psIntfAdapter-bPreparingForBusSuspend)
-   {
-   BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, INTF_INIT, 
DBG_LVL_ALL,Interrupt call back is called while suspending the device);
+   if (((Adapter-bPreparingForLowPowerMode == TRUE) 
+   (Adapter-bDoSuspend == TRUE)) ||
+   psIntfAdapter-bSuspended ||
+   psIntfAdapter-bPreparingForBusSuspend) {
+   BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, INTF_INIT,
+   DBG_LVL_ALL,
+   Interrupt call back is called
+   while suspending the device);
return ;
}
 
-   //BCM_DEBUG_PRINT(Adapter,DBG_TYPE_TX, NEXT_SEND, DBG_LVL_ALL, 
interrupt urb status %d, status);
+   /*BCM_DEBUG_PRINT(Adapter,DBG_TYPE_TX, NEXT_SEND, DBG_LVL_ALL,
+   * interrupt urb status %d, status);*/
switch (status) {
-   /* success */
-   case STATUS_SUCCESS:
-   if ( urb-actual_length )
-   {
-
-   if(psIntfAdapter-ulInterruptData[1]  0xFF)
-   {
-   BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, 
INTF_INIT, DBG_LVL_ALL, Got USIM interrupt);
+   /* success */
+   case STATUS_SUCCESS:
+   if (urb-actual_length) {
+
+   if (psIntfAdapter-ulInterruptData[1]  0xFF) {
+   BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS,
+   INTF_INIT, DBG_LVL_ALL,
+   Got USIM interrupt);
}
 
-   if(psIntfAdapter-ulInterruptData[1]  0xFF00)
-   {
+   if (psIntfAdapter-ulInterruptData[1]  0xFF00) {
atomic_set(Adapter-CurrNumFreeTxDesc,
-   (psIntfAdapter-ulInterruptData[1]  
0xFF00)  8);
-   atomic_set (Adapter-uiMBupdate, TRUE);
-   BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, 
INTF_INIT, DBG_LVL_ALL, TX mailbox contains %d,
-   
atomic_read(Adapter-CurrNumFreeTxDesc));
+   (psIntfAdapter-ulInterruptData[1] 
+   0xFF00)  8);
+   atomic_set(Adapter-uiMBupdate, TRUE);
+   BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS,
+   INTF_INIT, DBG_LVL_ALL,
+   TX mailbox contains %d,
+   atomic_read(Adapter-CurrNumFreeTxDesc));
}
-   if(psIntfAdapter-ulInterruptData[1]  16)
-   {
-   Adapter-CurrNumRecvDescs=
-   (psIntfAdapter-ulInterruptData[1]   
16);
-   BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, 
INTF_INIT, DBG_LVL_ALL,RX mailbox contains %d,
+   if (psIntfAdapter-ulInterruptData[1]  16) {
+   Adapter-CurrNumRecvDescs =
+   (psIntfAdapter-ulInterruptData[1]  16);
+   BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS,
+   INTF_INIT, DBG_LVL_ALL,
+   RX mailbox contains %d,
Adapter-CurrNumRecvDescs);

[PATCH 3/3] Staging:bcm: fix coding style error in InterfaceIsr.c

2012-09-24 Thread Gorskin Ilya
This is a patch to the InterfaceIsr.c file that
fixes up a coding style issues found by the checkpatch.pl tool

Signed-off-by: Ilya Gorskin reven...@gmail.com
---
 drivers/staging/bcm/InterfaceIsr.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/bcm/InterfaceIsr.c 
b/drivers/staging/bcm/InterfaceIsr.c
index 4f78451..0e68485 100644
--- a/drivers/staging/bcm/InterfaceIsr.c
+++ b/drivers/staging/bcm/InterfaceIsr.c
@@ -120,7 +120,7 @@ static void read_int_callback(struct urb *urb/*, struct 
pt_regs *regs*/)
urb-status = STATUS_SUCCESS ;
break ;
/*return;*/
-   default:
+   default:
/*This is required to check what is the defaults
* conditions when it occurs..*/
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, NEXT_SEND,
-- 
1.7.12

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