Re: [PATCH] drivers: staging: dgnc: Remove useless casting in dgnc_driver.c

2013-10-16 Thread Geyslan Gregório Bem
2013/10/16 Greg KH :
> On Wed, Oct 16, 2013 at 12:57:35PM -0300, Geyslan G. Bem wrote:
>> Casting (void *) value returned by kzalloc is useless
>> as mentioned in Documentation/CodingStyle, Chap 14.
>>
>> Signed-off-by: Geyslan G. Bem 
>> ---
>>  drivers/staging/dgnc/dgnc_driver.c | 6 ++
>>  1 file changed, 2 insertions(+), 4 deletions(-)
>
> This patch doesn't apply at all, what tree did you make it against?
>
> Please redo it (and your second one) against either the linux-next
> releases, or my staging-next branch of my staging.git tree on
> git.kernel.org.
>
> thanks,
>
> greg k-h

Hi Greg,

I was using the torvalds tree. I noted that yours is different from his.
So, downloading and soon sending the second patch against your staging
(https://git.kernel.org/cgit/linux/kernel/git/gregkh/staging.git/).

Thanks.

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


Re: [PATCH v2 1/3] imx-drm: Add mx6 hdmi transmitter support

2013-10-16 Thread Russell King - ARM Linux
On Wed, Oct 16, 2013 at 02:03:17PM -0700, Troy Kisky wrote:
> Freescale's kernel(imx_3.0.35_4.1.0) has this code
>
> video/mxc_hdmi.c-/* Workaround to clear the overflow condition */
> video/mxc_hdmi.c-static void mxc_hdmi_clear_overflow(void)
> video/mxc_hdmi.c-{
> video/mxc_hdmi.c-   int count;
> video/mxc_hdmi.c-   u8 val;
> video/mxc_hdmi.c-
> video/mxc_hdmi.c-   /* TMDS software reset */
> video/mxc_hdmi.c: hdmi_writeb((u8)~HDMI_MC_SWRSTZ_TMDSSWRST_REQ,  
> HDMI_MC_SWRSTZ);
> video/mxc_hdmi.c-
> video/mxc_hdmi.c-   val = hdmi_readb(HDMI_FC_INVIDCONF);
> video/mxc_hdmi.c-
> video/mxc_hdmi.c-   if (cpu_is_mx6dl()) {
> video/mxc_hdmi.c-hdmi_writeb(val, HDMI_FC_INVIDCONF);
> video/mxc_hdmi.c-return;
> video/mxc_hdmi.c-   }
> video/mxc_hdmi.c-
> video/mxc_hdmi.c-   for (count = 0 ; count < 5 ; count++)
> video/mxc_hdmi.c-   hdmi_writeb(val, HDMI_FC_INVIDCONF);
> video/mxc_hdmi.c-}
>
> So, perhaps you need to move the software reset first.

Just tried that - and yes, it does work (I'm on i.MX 6Solo for which
cpu_is_mx6dl() would return true.)  Well done!

Indeed yes, the workaround in the code Fabio has differs from the
procedure given in the errata.

Note that this gives a new problem: we shouldn't use cpu_is_mx6dl()
in drivers - differences like this should be specified via DT properties.
I think we need this to recognise both fsl,imx6q-hdmi and fsl,imx6dl-hdmi
so that this workaround can detect when its running on a Solo/DL SoC.

Well, I now have quite a pile of patches for the hdmi code. :(
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: A review of dm-writeboost

2013-10-16 Thread Dave Chinner
On Wed, Oct 16, 2013 at 09:17:40PM +0900, Akira Hayakawa wrote:
> Dave
> 
> > XFS shuts down because you've returned EIO to a log IO. That's a
> > fatal error. If you do the same to an ext4 journal write, it will do
> > the equivalent of shut down (e.g. complain and turn read-only).
> You mean block device should not return -EIO anyway if
> it doesn't want XFS to suddenly shut down?

Yes. EIO means an IO error has occurred. That causes failure paths
to be triggered in the upper layers.

I really don't understand what you are trying to achieve with this
"blockup" thing. If something goes wrong with the device, then you
*cannot recover* by sending EIO to any new IOs and then continuing
on at a later time as though nothing has happened. The moment a
filesystem gets EIO from a metadata write, it is likely to be
corrupted and if you continue onwards after that you simply
propagate the corruption.

> As Mikulas said, connection failure often be the cause of
> I/O error from the underlying devices.

Connection failure is *rarely* the cause of IO errors, except in
environments where SANs are in use. Even then multipathing makes
fatal connection failure a rare occurrence. Broken hardware is a
much more common cause of problems at the storage layers.

> That ext4 and XFS are both determine shutting down in
> erroneous journal writes is also due to the limitation of journal write?
> or just a compromise in implementation? This is just for my curiosity.

A failed, unrecoverable journal write violates the filesystem
consistency model of any journalling filesystem. Operations must be
stopped and the hardware and filesystem must be repaired, otherwise
loss of data will occur.

i.e. You're tellingthe filesystem that it's had a fatal IO error by
returning EIO, and the filesystems are treating it as though they've
seen a fatal IO error.


Simple rule: Don't complete IOs with EIO if you haven't had a fatal
IO error.

> struct wb_cache *cache = data;
> struct wb_device *wb = cache->wb;
> unsigned long intvl;
> 
> while (!kthread_should_stop()) {
> 
> wait_on_blockup();

Ugh. You should be using workqueue with timed work for this.

BTW, you're missing the handling needed by these kernel threads
for suspend-to-disk/ram

> [   68.825016] XFS (dm-3): Mounting Filesystem
> [   68.847027] XFS (dm-3): Ending clean mount
> [   72.100112] device-mapper: writeboost: err@dm_safe_io_internal() system is 
> blocked up on I/O error. set blockup to 0 after checkup.
> [   72.109702] device-mapper: writeboost: err@migrate_proc() system is 
> blocked up on I/O error. set blockup to 0 after checkup.
> [   72.812097] device-mapper: writeboost: err@modulator_proc() system is 
> blocked up on I/O error. set blockup to 0 after checkup.
> [   73.894429] Buffer I/O error on device dm-3, logical block 98354
> [   73.895824] lost page write due to I/O error on dm-3

Data IO has been lost due to EIOs. You've corrupted user files when
this error is emitted.

...

> [   73.930022] XFS (dm-3): metadata I/O error: block 0x40 
> ("xfs_buf_iodone_callbacks") error 5 numblks 16
> [   74.036759] XFS (dm-3): metadata I/O error: block 0x300c7f ("xlog_iodone") 
> error 5 numblks 64
> [   74.043456] XFS (dm-3): xfs_do_force_shutdown(0x2) called from line 1161 
> of file fs/xfs/xfs_log.c.  Return address = 0xa03a6417
> [   74.047556] XFS (dm-3): Log I/O Error Detected.  Shutting down filesystem
> [   74.049893] XFS (dm-3): Please umount the filesystem and rectify the 
> problem(s)
> [   74.051467] XFS (dm-3): metadata I/O error: block 0x300cbf ("xlog_iodone") 
> error 5 numblks 64
> [   74.053190] XFS (dm-3): xfs_do_force_shutdown(0x2) called from line 1161 
> of file fs/xfs/xfs_log.c.  Return address = 0xa03a6417

And these are all the log buffers containing uncommitted changes
being aborted due to EIO. The filesystem state in memory now doesn't
match the state on disk, and so it's effectively corrupt and shuts
down.



> [  100.052005] BUG: soft lockup - CPU#0 stuck for 23s! [kworker/0:1H:215]
...
> [  100.052005] RIP: 0010:[]  [] 
> do_raw_spin_lock+0x16/0x23
> [  100.052005] Workqueue: xfslogd xfs_buf_iodone_work [xfs]
> [  100.052005] Call Trace:
> [  100.052005]  [] ? xfs_buf_iodone+0x1b/0x49 [xfs]
> [  100.052005]  [] ? xfs_buf_do_callbacks+0x22/0x30 [xfs]
> [  100.052005]  [] ? xfs_buf_iodone_callbacks+0x16b/0x1c4 
> [xfs]
> [  100.052005]  [] ? process_one_work+0x191/0x294
> [  100.052005]  [] ? worker_thread+0x121/0x1e7
> [  100.052005]  [] ? rescuer_thread+0x269/0x269
> [  100.052005]  [] ? kthread+0x81/0x89
> [  100.052005]  [] ? __kthread_parkme+0x5d/0x5d
> [  100.052005]  [] ? ret_from_fork+0x7c/0xb0
> [  100.052005]  [] ? __kthread_parkme+0x5d/0x5d

You need to compile your kernel with framepointers enabled so we get
reliable stack traces. I think it's stuck on a spinlock in
xfs_buf_iodone, which would imply the AIL lock.

.

> [  100.244006] CPU: 2 PID: 3167 Comm: xfsaild/dm-

Re: [PATCH v2 1/3] imx-drm: Add mx6 hdmi transmitter support

2013-10-16 Thread Sascha Hauer
On Wed, Oct 16, 2013 at 08:02:11PM +0100, Russell King - ARM Linux wrote:
> On Wed, Oct 16, 2013 at 11:31:07AM -0700, Greg Kroah-Hartman wrote:
> > On Wed, Oct 16, 2013 at 07:07:35PM +0100, Russell King - ARM Linux wrote:
> > > Sorry, but I don't think imx-drm is driving the hardware correctly, and
> > > I know that Greg wants it moved out of drivers/staging, but frankly it
> > > seems to be far from ready for that.  Certainly the HDMI parts seems to
> > > be especially problematical.
> > 
> > I want it out of staging if it's working properly.  Yours is the first
> > report of it not working properly, and in fact, probably one of the
> > first users of the driver, as I haven't gotten any reports of it working
> > or not at all over the years.
> 
> Well, part of that is because I have this other thing called Armada DRM,
> which is a similar thing to imx-drm, except for the Marvell Dove SoCs,
> so it's been really quite easy to get a full Ubuntu 12.04 up and running
> on the IMX SoC I have here.
> 
> As part of that effort, I'm now using my Armada DRM Xorg driver with
> imx-drm to test this stuff out.  (Bearing in mind that IMX and Dove use
> the same Vivante GPU, there's some sense in getting my Xorg Armada DRM
> driver working on both.)
> 
> I'm not aware of there being any X drivers for imx-drm (google turns
> up nothing), which might be a reason why it hasn't been well tested
> and has also languished in drivers/staging for soo long.  Alternatively,
> maybe my google searching sucks, or it is out there somewhere but
> hidden from googlebot?

There is no X driver for imx-drm. I once tested it with the
xf86-modesetting driver which worked with a few patches back then. These
patches are now part of the modesetting driver.

We have a wrapper tool here which we use to configure the KMS part and
pass the framebuffers to QT.

> 
> To be fair, so far most of the problems I'm finding are with the HDMI
> addition to imx-drm rather than imx-drm itself: there's been the lockdep
> problem and the clock polarity problem which the HDMI stuff discovered.
> 
> Looking at the todo list for moving it out of staging, we have:
> 
> - get DRM Maintainer review for this code
> - Wait for common display framework to hit mainline and update the IPU
>   driver to use it. This will most probably make changes to the devicetree
>   bindings necessary.
> - Factor out more code to common helper functions
> - decide where to put the base driver. It is not specific to a subsystem
>   and would be used by DRM/KMS and media/V4L2
> 
> (1) is quite a difficult task: I'm waiting for a review of the Armada DRM
> stuff, which I'm hoping will make the next merge window.  Rob Clark is
> looking at that but has been distracted recently from completing it.

We have waited for quite a long time aswell before we decided to push
the imx-drm driver to staging to at least get more exposure for the
driver. The situation is, well... unsatisfying.

> 
> (2) CDF... has been around in RFC according to LWN.net but doesn't seem to
> make much in the way of progress from what I can see, despite there
> allegedly being "many developers show[ing] interest in the first RFC".
> CDF is over a year old now - first RFC 17 Aug 2012, second 22 Nov 2012,
> third 9 Aug 2013.

>From what I heard Laurent is still committed to mainline CDF.

> 
> (3) is an on-going effort and really isn't a reason for it to stay in
> staging.
> 
> (4) is probably the biggest issue.  The problem there is that the IMX
> display subsystem is very flexible: it's basically a set of DMA engines
> on the front, and behind that a fair number of modules implementing
> facilities like image rotation, display driving and image capture.
> Display driving alone involves setting up waveforms and writing some
> microcode to tell the thing what to do on certain events (like end
> of frame etc.)  Hence it doesn't fit well into any particular "Linux"
> subsystem.  In this regard, it's a victim of its own flexibility.
> 
> I think the biggest problem though is its complexity.  It doesn't fit
> into the "single device for a card" model which DRM has.  It's made
> up from several separate devices, which is all very well, but it leads
> to it having its own private "framework" to glue all the different
> devices together - which adds a layer of indirection and makes the code
> harder to understand.

I tried adding generic stuff to DRM to support this and failed badly due
to resistance of the maintainers. I didn't get much input what I should
do better or different (besides a general "make it a helper library").
Also nobody seemed to understand the problems I had with the multi device
nature of the i.MX IPU.

I think we made ourselves comfortable with being in the kernel, even if
it's only in staging. We should move forward instead and see how we get
the driver into the kernel.

Sascha

-- 
Pengutronix e.K.   | |
Industrial Linux Solutions | http

Re: [PATCH v2 1/3] imx-drm: Add mx6 hdmi transmitter support

2013-10-16 Thread Troy Kisky

On 10/16/2013 1:27 PM, Russell King - ARM Linux wrote:

On Wed, Oct 16, 2013 at 12:37:42PM -0700, Troy Kisky wrote:

On 10/16/2013 10:03 AM, Russell King - ARM Linux wrote:

On Tue, Oct 15, 2013 at 10:17:07AM -0300, Fabio Estevam wrote:

On Tue, Oct 15, 2013 at 10:10 AM, Russell King - ARM Linux
 wrote:

Another point on patch 1.  Sorry, I don't have patch 1 to reply to, it
seems it was deleted from linux-arm-kernel's moderation queue.

drm_mode_connector_attach_encoder() is called too early, before the
base.id field in the encoder has been initialised.  This causes the
connectors encoder array to be empty, and userspace KMS to fail.

There's also bugs in the CSC setting too - it runs off the end of the
array and gcc warns about this.  The code was clearly wrong.

You may wish to combine this patch with patch 1 to sort all that out.
For the patch below:

Signed-off-by: Russell King 
Tested-by: Russell King 

Thanks, Russell.

Will submit v3 when I am back to the office.

Okay, I still have a problem with HDMI: I have a magenta vertical line
down the left hand side of the frame, the displayed frame is shifted
right by the width of that line and the right hand side is missing some
pixels.

First off, the hsync position programmed into the HDMI registers appears
to be wrong.

I'm at a loss why imx-hdmi is obfuscated with a conversion from a
drm_display_mode structure to a fb_videomode.  This adds additional
confusion and additional opportunities for bugs; this is probably
exactly why the hsync position is wrong.

In CEA-861-B for 720p @60Hz:

DE: __^^^
HS: ___^^^___
   ^  ^  ^
   |  |  220 clocks
   |  40 clocks
   110 clocks

The IMX6 manual says HSYINCINDELAY0 is "Hsync active edge delay.  Integer
number of pixel clock cycles from de non-active edge".  So, this should be
110.  Yet it ends up being programmed as 220, leading to a magenta vertical
bar down the left hand side of the display.

Now, if you look at Documentation/fb/framebuffer.txt, in this case, the
right margin should be 110 clocks, hsync len should be 40 and the left
margin should be 220 clocks.

However, this is not what your conversion to a fb_videomode does.  It
reverses the left and right margin.  A similar confusion also exists
in the conversion of the upper/lower margins too.

The DRM model is this (for 720p @60Hz):

0 1280 1390 1430  1650
|===||---|--|
^   ^^   ^  ^
start   hdisplay hsync_start hsync_end htotal

The fb model is the same as the above but rotated:

left margindisplayedright margin hsync_len
|--|===||---|

So, the left margin is the bit between hsync_end and htotal, and the
right margin is the bit between hdisplay and hsync_start.  Exactly
the same analysis applies to the upper/lower margins.

What I suggest is that the use of fb_videomode is entirely killed off
in this driver to remove this layer of confusion and instead the DRM
model is stuck to within this DRM driver.

Now on to the next problem.  HSYNC/VSYNC polarity.

So, this is the mode which is set:

1280x720 (0x41)   74.2MHz +HSync +VSync *current +preferred
  h: width  1280 start 1390 end 1430 total 1650 skew0 clock   
45.0KHz
  v: height  720 start  725 end  730 total  750   clock   60.0Hz

Note the positive HSync and VSync polarity - this is correct, backed
up by CEA-861-B.

The IPU DI0 is configured thusly in its general control register:
0x264 = 0x26, which is what is set when the requested mode
has DRM_MODE_FLAG_PHSYNC and DRM_MODE_FLAG_PVSYNC flags set.

However, if we look at the HDMI config: 0x121000 = 0x18.  Active low
hsync/vsync.  This is quite obvious when you look at the code -
convert_to_video_timing() does *nothing* at all when converting the
sync polarities, which means hdmi_av_composer() doesn't program them
appropriately.  And yes, poking 0x78 into this register finally fixes
the problem.

Yet another reason why this silly conversion from one structure form
to another is a Very Bad Idea.  Until I found this, I was merely going
to send a patch to sort out convert_to_video_timing(), but quite frankly
I'm going to kill this thing off right now.

Another thing:

static int imx_hdmi_setup(struct imx_hdmi *hdmi, struct drm_display_mode *mode)
{
  int ret;
  convert_to_video_timing(&hdmi->fb_mode, mode);

  hdmi_disable_overflow_interrupts(hdmi);
   hdmi->vic = 6;

It's quite wrong to force every video mode set to be CEA mode 6.  IIRC,
There is a function in DRM which will tell you the CEA mode number.
Again, I'll fix this in my patch rewriting this bit of the driver to
be correct.

I'm also suspicious of the "HDMI Initialization Step" comments, because
they make no sense:

/* HDMI Initializ

[PATCH 3/4] Staging: xgifb: fix braces {} are not necessary for single statement blocks

2013-10-16 Thread Dhanunjaya Naidu Ravada
From: Dhanunjaya 

This is a patch to the vb_setmode.c file that fixes braces {}
are not necessary for single statement blocks warning found
by the checkpatch.pl tool

Signed-of-by: Dhanunjaya Naidu Ravada 
---
 drivers/staging/xgifb/vb_setmode.c | 11 ---
 1 file changed, 4 insertions(+), 7 deletions(-)

diff --git a/drivers/staging/xgifb/vb_setmode.c 
b/drivers/staging/xgifb/vb_setmode.c
index 46dea3f..400c726 100644
--- a/drivers/staging/xgifb/vb_setmode.c
+++ b/drivers/staging/xgifb/vb_setmode.c
@@ -845,11 +845,10 @@ static unsigned short XGI_GetVCLK2Ptr(unsigned short 
ModeIdIndex,
VCLKIndex = TVCLKBASE_315_25 + HiTVVCLK;
 
if (pVBInfo->SetFlag & TVSimuMode) {
-   if (modeflag & Charx8Dot) {
+   if (modeflag & Charx8Dot)
VCLKIndex = TVCLKBASE_315_25 + HiTVSimuVCLK;
-   } else {
+   else
VCLKIndex = TVCLKBASE_315_25 + HiTVTextVCLK;
-   }
}
 
/* 301lv */
@@ -5274,9 +5273,8 @@ void XGI_SenseCRT1(struct vb_device_info *pVBInfo)
 
outb(0x00, pVBInfo->P3c8);
 
-   for (i = 0; i < 256 * 3; i++) {
+   for (i = 0; i < 256 * 3; i++)
outb(0x0F, (pVBInfo->P3c8 + 1)); /* DAC_TEST_PARMS */
-   }
 
mdelay(1);
 
@@ -5291,9 +5289,8 @@ void XGI_SenseCRT1(struct vb_device_info *pVBInfo)
/* avoid display something, set BLACK DAC if not restore DAC */
outb(0x00, pVBInfo->P3c8);
 
-   for (i = 0; i < 256 * 3; i++) {
+   for (i = 0; i < 256 * 3; i++)
outb(0, (pVBInfo->P3c8 + 1));
-   }
 
xgifb_reg_set(pVBInfo->P3c4, 0x01, SR01);
xgifb_reg_set(pVBInfo->P3d4, 0x63, CR63);
-- 
1.8.1.2

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


Re: [PATCH v2 1/3] imx-drm: Add mx6 hdmi transmitter support

2013-10-16 Thread Russell King - ARM Linux
On Wed, Oct 16, 2013 at 12:37:42PM -0700, Troy Kisky wrote:
> On 10/16/2013 10:03 AM, Russell King - ARM Linux wrote:
>> On Tue, Oct 15, 2013 at 10:17:07AM -0300, Fabio Estevam wrote:
>>> On Tue, Oct 15, 2013 at 10:10 AM, Russell King - ARM Linux
>>>  wrote:
 Another point on patch 1.  Sorry, I don't have patch 1 to reply to, it
 seems it was deleted from linux-arm-kernel's moderation queue.

 drm_mode_connector_attach_encoder() is called too early, before the
 base.id field in the encoder has been initialised.  This causes the
 connectors encoder array to be empty, and userspace KMS to fail.

 There's also bugs in the CSC setting too - it runs off the end of the
 array and gcc warns about this.  The code was clearly wrong.

 You may wish to combine this patch with patch 1 to sort all that out.
 For the patch below:

 Signed-off-by: Russell King 
 Tested-by: Russell King 
>>> Thanks, Russell.
>>>
>>> Will submit v3 when I am back to the office.
>> Okay, I still have a problem with HDMI: I have a magenta vertical line
>> down the left hand side of the frame, the displayed frame is shifted
>> right by the width of that line and the right hand side is missing some
>> pixels.
>>
>> First off, the hsync position programmed into the HDMI registers appears
>> to be wrong.
>>
>> I'm at a loss why imx-hdmi is obfuscated with a conversion from a
>> drm_display_mode structure to a fb_videomode.  This adds additional
>> confusion and additional opportunities for bugs; this is probably
>> exactly why the hsync position is wrong.
>>
>> In CEA-861-B for 720p @60Hz:
>>
>> DE: __^^^
>> HS: ___^^^___
>>   ^  ^  ^
>>   |  |  220 clocks
>>   |  40 clocks
>>   110 clocks
>>
>> The IMX6 manual says HSYINCINDELAY0 is "Hsync active edge delay.  Integer
>> number of pixel clock cycles from de non-active edge".  So, this should be
>> 110.  Yet it ends up being programmed as 220, leading to a magenta vertical
>> bar down the left hand side of the display.
>>
>> Now, if you look at Documentation/fb/framebuffer.txt, in this case, the
>> right margin should be 110 clocks, hsync len should be 40 and the left
>> margin should be 220 clocks.
>>
>> However, this is not what your conversion to a fb_videomode does.  It
>> reverses the left and right margin.  A similar confusion also exists
>> in the conversion of the upper/lower margins too.
>>
>> The DRM model is this (for 720p @60Hz):
>>
>> 0 1280 1390 1430  1650
>> |===||---|--|
>> ^   ^^   ^  ^
>> start   hdisplay hsync_start hsync_end htotal
>>
>> The fb model is the same as the above but rotated:
>>
>> left margindisplayedright margin hsync_len
>> |--|===||---|
>>
>> So, the left margin is the bit between hsync_end and htotal, and the
>> right margin is the bit between hdisplay and hsync_start.  Exactly
>> the same analysis applies to the upper/lower margins.
>>
>> What I suggest is that the use of fb_videomode is entirely killed off
>> in this driver to remove this layer of confusion and instead the DRM
>> model is stuck to within this DRM driver.
>>
>> Now on to the next problem.  HSYNC/VSYNC polarity.
>>
>> So, this is the mode which is set:
>>
>>1280x720 (0x41)   74.2MHz +HSync +VSync *current +preferred
>>  h: width  1280 start 1390 end 1430 total 1650 skew0 clock   
>> 45.0KHz
>>  v: height  720 start  725 end  730 total  750   clock   
>> 60.0Hz
>>
>> Note the positive HSync and VSync polarity - this is correct, backed
>> up by CEA-861-B.
>>
>> The IPU DI0 is configured thusly in its general control register:
>> 0x264 = 0x26, which is what is set when the requested mode
>> has DRM_MODE_FLAG_PHSYNC and DRM_MODE_FLAG_PVSYNC flags set.
>>
>> However, if we look at the HDMI config: 0x121000 = 0x18.  Active low
>> hsync/vsync.  This is quite obvious when you look at the code -
>> convert_to_video_timing() does *nothing* at all when converting the
>> sync polarities, which means hdmi_av_composer() doesn't program them
>> appropriately.  And yes, poking 0x78 into this register finally fixes
>> the problem.
>>
>> Yet another reason why this silly conversion from one structure form
>> to another is a Very Bad Idea.  Until I found this, I was merely going
>> to send a patch to sort out convert_to_video_timing(), but quite frankly
>> I'm going to kill this thing off right now.
>>
>> Another thing:
>>
>> static int imx_hdmi_setup(struct imx_hdmi *hdmi, struct drm_display_mode 
>> *mode)
>> {
>>  int ret;
>>  convert_to_video_timing(&hdmi->fb_mode, mode);
>>
>>  hdmi_disable_overflow_interrupts(hdmi);
>>   hdmi->vic = 6;
>>
>> It's quite wrong to force every video mode se

Re: [PATCH v2 1/3] imx-drm: Add mx6 hdmi transmitter support

2013-10-16 Thread Troy Kisky

On 10/16/2013 10:03 AM, Russell King - ARM Linux wrote:

On Tue, Oct 15, 2013 at 10:17:07AM -0300, Fabio Estevam wrote:

On Tue, Oct 15, 2013 at 10:10 AM, Russell King - ARM Linux
 wrote:

Another point on patch 1.  Sorry, I don't have patch 1 to reply to, it
seems it was deleted from linux-arm-kernel's moderation queue.

drm_mode_connector_attach_encoder() is called too early, before the
base.id field in the encoder has been initialised.  This causes the
connectors encoder array to be empty, and userspace KMS to fail.

There's also bugs in the CSC setting too - it runs off the end of the
array and gcc warns about this.  The code was clearly wrong.

You may wish to combine this patch with patch 1 to sort all that out.
For the patch below:

Signed-off-by: Russell King 
Tested-by: Russell King 

Thanks, Russell.

Will submit v3 when I am back to the office.

Okay, I still have a problem with HDMI: I have a magenta vertical line
down the left hand side of the frame, the displayed frame is shifted
right by the width of that line and the right hand side is missing some
pixels.

First off, the hsync position programmed into the HDMI registers appears
to be wrong.

I'm at a loss why imx-hdmi is obfuscated with a conversion from a
drm_display_mode structure to a fb_videomode.  This adds additional
confusion and additional opportunities for bugs; this is probably
exactly why the hsync position is wrong.

In CEA-861-B for 720p @60Hz:

DE: __^^^
HS: ___^^^___
  ^  ^  ^
  |  |  220 clocks
  |  40 clocks
  110 clocks

The IMX6 manual says HSYINCINDELAY0 is "Hsync active edge delay.  Integer
number of pixel clock cycles from de non-active edge".  So, this should be
110.  Yet it ends up being programmed as 220, leading to a magenta vertical
bar down the left hand side of the display.

Now, if you look at Documentation/fb/framebuffer.txt, in this case, the
right margin should be 110 clocks, hsync len should be 40 and the left
margin should be 220 clocks.

However, this is not what your conversion to a fb_videomode does.  It
reverses the left and right margin.  A similar confusion also exists
in the conversion of the upper/lower margins too.

The DRM model is this (for 720p @60Hz):

0 1280 1390 1430  1650
|===||---|--|
^   ^^   ^  ^
start   hdisplay hsync_start hsync_end htotal

The fb model is the same as the above but rotated:

left margindisplayedright margin hsync_len
|--|===||---|

So, the left margin is the bit between hsync_end and htotal, and the
right margin is the bit between hdisplay and hsync_start.  Exactly
the same analysis applies to the upper/lower margins.

What I suggest is that the use of fb_videomode is entirely killed off
in this driver to remove this layer of confusion and instead the DRM
model is stuck to within this DRM driver.

Now on to the next problem.  HSYNC/VSYNC polarity.

So, this is the mode which is set:

   1280x720 (0x41)   74.2MHz +HSync +VSync *current +preferred
 h: width  1280 start 1390 end 1430 total 1650 skew0 clock   45.0KHz
 v: height  720 start  725 end  730 total  750   clock   60.0Hz

Note the positive HSync and VSync polarity - this is correct, backed
up by CEA-861-B.

The IPU DI0 is configured thusly in its general control register:
0x264 = 0x26, which is what is set when the requested mode
has DRM_MODE_FLAG_PHSYNC and DRM_MODE_FLAG_PVSYNC flags set.

However, if we look at the HDMI config: 0x121000 = 0x18.  Active low
hsync/vsync.  This is quite obvious when you look at the code -
convert_to_video_timing() does *nothing* at all when converting the
sync polarities, which means hdmi_av_composer() doesn't program them
appropriately.  And yes, poking 0x78 into this register finally fixes
the problem.

Yet another reason why this silly conversion from one structure form
to another is a Very Bad Idea.  Until I found this, I was merely going
to send a patch to sort out convert_to_video_timing(), but quite frankly
I'm going to kill this thing off right now.

Another thing:

static int imx_hdmi_setup(struct imx_hdmi *hdmi, struct drm_display_mode *mode)
{
 int ret;
 convert_to_video_timing(&hdmi->fb_mode, mode);

 hdmi_disable_overflow_interrupts(hdmi);
 
 hdmi->vic = 6;


It's quite wrong to force every video mode set to be CEA mode 6.  IIRC,
There is a function in DRM which will tell you the CEA mode number.
Again, I'll fix this in my patch rewriting this bit of the driver to
be correct.

I'm also suspicious of the "HDMI Initialization Step" comments, because
they make no sense:

/* HDMI Initialization Step B.4 */
static void imx_hdmi_enable_video_path(struct imx_hdmi *hdmi)
{

yet:

 /* HDMI Initialization Step B

Re: [PATCH 00/35] staging: comedi: sample types are unsigned

2013-10-16 Thread Greg Kroah-Hartman
On Wed, Oct 16, 2013 at 02:40:03PM +0100, Ian Abbott wrote:
> Sample values in comedi are generally represented as unsigned values.
> Some of the comedi buffer handling functions and various drivers use
> signed short values in places to hold or manipulate 16-bit (or less)
> sample values.  Be a bit more consistent in the use of unsigned types to
> handle sample values.

I've applied these, but in the future, you might want to use the kernel
type 'u16' just to be explicit as to what you want for this api.

thanks,

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


Re: [PATCH] Staging: comedi: fix semicolon coding style issue in ni_660x.c

2013-10-16 Thread Greg KH
On Wed, Oct 16, 2013 at 06:08:14PM +0530, Dhanunjaya wrote:
> This is a patch to the ni_660x.c file that fixes up a semicolon warning
> found by the checkpatch.pl tool
> ---

No signed-off-by: so I can't take this patch, sorry.

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


Re: [PATCH] drivers: staging: dgnc: Remove useless casting in dgnc_driver.c

2013-10-16 Thread Greg KH
On Wed, Oct 16, 2013 at 12:57:35PM -0300, Geyslan G. Bem wrote:
> Casting (void *) value returned by kzalloc is useless
> as mentioned in Documentation/CodingStyle, Chap 14.
> 
> Signed-off-by: Geyslan G. Bem 
> ---
>  drivers/staging/dgnc/dgnc_driver.c | 6 ++
>  1 file changed, 2 insertions(+), 4 deletions(-)

This patch doesn't apply at all, what tree did you make it against?

Please redo it (and your second one) against either the linux-next
releases, or my staging-next branch of my staging.git tree on
git.kernel.org.

thanks,

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


Re: [PATCH 1/4] Staging: comedi: fix semicolon coding style issue in ni_660x.c

2013-10-16 Thread Greg KH
On Thu, Oct 17, 2013 at 12:54:52AM +0530, Dhanunjaya Naidu Ravada wrote:
> From: Dhanunjaya 

Again, doesn't match the signed-off-by: or From: line on your email :(

> This is a patch to the ni_660x.c file that fixes up a semicolon warning
> found by the checkpatch.pl tool.

No it isn't, it also does something else in this file.

> 
> Signed-off-by: Dhanunjaya Naidu Ravada 
> ---
>  drivers/staging/comedi/drivers/ni_660x.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/staging/comedi/drivers/ni_660x.c 
> b/drivers/staging/comedi/drivers/ni_660x.c
> index 3607336..95bb432 100644
> --- a/drivers/staging/comedi/drivers/ni_660x.c
> +++ b/drivers/staging/comedi/drivers/ni_660x.c
> @@ -28,7 +28,7 @@
>   *
>   * Encoders work.  PulseGeneration (both single pulse and pulse train)
>   * works.  Buffered commands work for input but not output.
> - * 
> + *

That doesn't look like a semicolon fix.

>   * References:
>   * DAQ 660x Register-Level Programmer Manual  (NI 370505A-01)
>   * DAQ 6601/6602 User Manual (NI 322137B-01)
> @@ -1232,7 +1232,7 @@ static int ni_660x_auto_attach(struct comedi_device 
> *dev,
>   s->type = COMEDI_SUBD_COUNTER;
>   s->subdev_flags =
>   SDF_READABLE | SDF_WRITABLE | SDF_LSAMPL |
> - SDF_CMD_READ /* | SDF_CMD_WRITE */ ;
> + SDF_CMD_READ; /* | SDF_CMD_WRITE */

Nope, please leave the original code, it's correct.

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


Re: [PATCH 4/4] Staging: xgifb: fix space prohibited before semicolon.

2013-10-16 Thread Dan Carpenter
On Thu, Oct 17, 2013 at 12:21:34AM +0530, Dhanunjaya wrote:
> This is a patch to the vb_table.h file that fixes the
> space prohibited before semicolon warning found by the
> checkpatch.pl tool.
> 

Someone already fixed this one.

Btw, for people who aren't aware, linux-next has moved to
git://gitorious.org/thierryreding/linux-next.git until later this month.
Thierry Reding has taken over while Stephen is on vacation.

regards,
dan carpenter

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


[PATCH 1/4] Staging: comedi: fix semicolon coding style issue in ni_660x.c

2013-10-16 Thread Dhanunjaya Naidu Ravada
From: Dhanunjaya 

This is a patch to the ni_660x.c file that fixes up a semicolon warning
found by the checkpatch.pl tool.

Signed-off-by: Dhanunjaya Naidu Ravada 
---
 drivers/staging/comedi/drivers/ni_660x.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/comedi/drivers/ni_660x.c 
b/drivers/staging/comedi/drivers/ni_660x.c
index 3607336..95bb432 100644
--- a/drivers/staging/comedi/drivers/ni_660x.c
+++ b/drivers/staging/comedi/drivers/ni_660x.c
@@ -28,7 +28,7 @@
  *
  * Encoders work.  PulseGeneration (both single pulse and pulse train)
  * works.  Buffered commands work for input but not output.
- * 
+ *
  * References:
  * DAQ 660x Register-Level Programmer Manual  (NI 370505A-01)
  * DAQ 6601/6602 User Manual (NI 322137B-01)
@@ -1232,7 +1232,7 @@ static int ni_660x_auto_attach(struct comedi_device *dev,
s->type = COMEDI_SUBD_COUNTER;
s->subdev_flags =
SDF_READABLE | SDF_WRITABLE | SDF_LSAMPL |
-   SDF_CMD_READ /* | SDF_CMD_WRITE */ ;
+   SDF_CMD_READ; /* | SDF_CMD_WRITE */
s->n_chan = 3;
s->maxdata = 0x;
s->insn_read = ni_660x_GPCT_rinsn;
-- 
1.8.1.2

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


Re: [PATCH 3/4] Staging: xgifb: fix braces {} are not necessary for single statement blocks

2013-10-16 Thread Greg KH
On Thu, Oct 17, 2013 at 12:51:24AM +0530, Dhanunjaya Naidu Ravada wrote:
> From: Dhanunjaya 

This isn't matching the "From:" line in your email :(

And where are patches 1/4 and 2/4 in this series?

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


[PATCH 4/4] Staging: xgifb: fix space prohibited before semicolon.

2013-10-16 Thread Dhanunjaya Naidu Ravada
From: Dhanunjaya 

This is a patch to the vb_table.h file that fixes the
space prohibited before semicolon warning found by the
checkpatch.pl tool.

Signed-off-by: Dhanunjaya Naidu Ravada 
---
 drivers/staging/xgifb/vb_table.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/xgifb/vb_table.h b/drivers/staging/xgifb/vb_table.h
index 7168eed..f17e5b9 100644
--- a/drivers/staging/xgifb/vb_table.h
+++ b/drivers/staging/xgifb/vb_table.h
@@ -1284,7 +1284,7 @@ static const struct SiS_LVDSData XGI_LVDS1024x768Des_1[] 
= {
{0, 1048,   0, 771}, /* 04 (640x480x60Hz) */
{0, 1048,   0, 771}, /* 05 (800x600x60Hz) */
{0, 1048, 805, 770}  /* 06 (1024x768x60Hz) */
-} ;
+};
 
 static const struct SiS_LVDSData XGI_LVDS1024x768Des_2[] = {
{1142,  856, 622, 587}, /* 00 (320x200,320x400,640x200,640x400) */
-- 
1.8.1.2

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


[PATCH 4/4] Staging: xgifb: fix space prohibited before semicolon.

2013-10-16 Thread Dhanunjaya
This is a patch to the vb_table.h file that fixes the
space prohibited before semicolon warning found by the
checkpatch.pl tool.

Signed-off-by: Dhanunjaya 
---
 drivers/staging/xgifb/vb_table.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/xgifb/vb_table.h b/drivers/staging/xgifb/vb_table.h
index 7168eed..f17e5b9 100644
--- a/drivers/staging/xgifb/vb_table.h
+++ b/drivers/staging/xgifb/vb_table.h
@@ -1284,7 +1284,7 @@ static const struct SiS_LVDSData XGI_LVDS1024x768Des_1[] 
= {
{0, 1048,   0, 771}, /* 04 (640x480x60Hz) */
{0, 1048,   0, 771}, /* 05 (800x600x60Hz) */
{0, 1048, 805, 770}  /* 06 (1024x768x60Hz) */
-} ;
+};
 
 static const struct SiS_LVDSData XGI_LVDS1024x768Des_2[] = {
{1142,  856, 622, 587}, /* 00 (320x200,320x400,640x200,640x400) */
-- 
1.8.1.2

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


Re: [PATCH 3/4] Staging: xgifb: fix braces {} are not necessary for single statement blocks

2013-10-16 Thread Greg KH
Where are patches 1/4 and 2/4 in this series?

On Thu, Oct 17, 2013 at 12:21:33AM +0530, Dhanunjaya wrote:
> This is a patch to the vb_setmode.c file that fixes braces {}
> are not necessary for single statement blocks warning found
> by the checkpatch.pl tool
> 
> Signed-of-by: Dhanunjaya 

Again, I need a full name before I can take any of these patches.

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


Re: [PATCH 2/2] Staging: xillybus: fix for quoted string split across lines

2013-10-16 Thread Greg KH
On Wed, Oct 16, 2013 at 09:49:19PM +0300, Eli Billauer wrote:
> Hello Greg,
> 
> On 16/10/13 21:06, Greg KH wrote:
> >>rc = of_address_to_resource(dev->of_node, 0,&endpoint->res);
> >>>   if (rc) {
> >>>  -pr_warn("xillybus: Failed to obtain device tree "
> >>>  -"resource\n");
> >>>  +pr_warn("xillybus: Failed to obtain device tree 
> >>> resource\n");
> >This should be using dev_warn() instead.
> >
> 
> So I understand that I should replace *all* occurrences of pr_warn()
> and pr_err() with their dev_* counterparts?

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


Re: [PATCH 2/2] Staging: xillybus: fix for quoted string split across lines

2013-10-16 Thread Eli Billauer

Hello Greg,

On 16/10/13 21:06, Greg KH wrote:

rc = of_address_to_resource(dev->of_node, 0,&endpoint->res);
>if (rc) {
>  - pr_warn("xillybus: Failed to obtain device tree "
>  - "resource\n");
>  + pr_warn("xillybus: Failed to obtain device tree resource\n");
 

This should be using dev_warn() instead.

   


So I understand that I should replace *all* occurrences of pr_warn() and 
pr_err() with their dev_* counterparts?


If so, please give me a week or so to handle that. It's going to be 
rather chunky patch...


Regards,

   Eli

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


Re: [PATCH v2 1/3] imx-drm: Add mx6 hdmi transmitter support

2013-10-16 Thread Russell King - ARM Linux
On Wed, Oct 16, 2013 at 11:31:07AM -0700, Greg Kroah-Hartman wrote:
> On Wed, Oct 16, 2013 at 07:07:35PM +0100, Russell King - ARM Linux wrote:
> > Sorry, but I don't think imx-drm is driving the hardware correctly, and
> > I know that Greg wants it moved out of drivers/staging, but frankly it
> > seems to be far from ready for that.  Certainly the HDMI parts seems to
> > be especially problematical.
> 
> I want it out of staging if it's working properly.  Yours is the first
> report of it not working properly, and in fact, probably one of the
> first users of the driver, as I haven't gotten any reports of it working
> or not at all over the years.

Well, part of that is because I have this other thing called Armada DRM,
which is a similar thing to imx-drm, except for the Marvell Dove SoCs,
so it's been really quite easy to get a full Ubuntu 12.04 up and running
on the IMX SoC I have here.

As part of that effort, I'm now using my Armada DRM Xorg driver with
imx-drm to test this stuff out.  (Bearing in mind that IMX and Dove use
the same Vivante GPU, there's some sense in getting my Xorg Armada DRM
driver working on both.)

I'm not aware of there being any X drivers for imx-drm (google turns
up nothing), which might be a reason why it hasn't been well tested
and has also languished in drivers/staging for soo long.  Alternatively,
maybe my google searching sucks, or it is out there somewhere but
hidden from googlebot?

To be fair, so far most of the problems I'm finding are with the HDMI
addition to imx-drm rather than imx-drm itself: there's been the lockdep
problem and the clock polarity problem which the HDMI stuff discovered.

Looking at the todo list for moving it out of staging, we have:

- get DRM Maintainer review for this code
- Wait for common display framework to hit mainline and update the IPU
  driver to use it. This will most probably make changes to the devicetree
  bindings necessary.
- Factor out more code to common helper functions
- decide where to put the base driver. It is not specific to a subsystem
  and would be used by DRM/KMS and media/V4L2

(1) is quite a difficult task: I'm waiting for a review of the Armada DRM
stuff, which I'm hoping will make the next merge window.  Rob Clark is
looking at that but has been distracted recently from completing it.

(2) CDF... has been around in RFC according to LWN.net but doesn't seem to
make much in the way of progress from what I can see, despite there
allegedly being "many developers show[ing] interest in the first RFC".
CDF is over a year old now - first RFC 17 Aug 2012, second 22 Nov 2012,
third 9 Aug 2013.

(3) is an on-going effort and really isn't a reason for it to stay in
staging.

(4) is probably the biggest issue.  The problem there is that the IMX
display subsystem is very flexible: it's basically a set of DMA engines
on the front, and behind that a fair number of modules implementing
facilities like image rotation, display driving and image capture.
Display driving alone involves setting up waveforms and writing some
microcode to tell the thing what to do on certain events (like end
of frame etc.)  Hence it doesn't fit well into any particular "Linux"
subsystem.  In this regard, it's a victim of its own flexibility.

I think the biggest problem though is its complexity.  It doesn't fit
into the "single device for a card" model which DRM has.  It's made
up from several separate devices, which is all very well, but it leads
to it having its own private "framework" to glue all the different
devices together - which adds a layer of indirection and makes the code
harder to understand.  As for trying to work out how any of this stuff
works - even though I have the manual which describes all the registers,
I'm struggling with it because there seems to be bits which just aren't
documented and its not always obvious that the code can be relied upon
either.

That all said, I don't think throwing this out of the kernel will do
it any good what so ever - that will just mean that there's even less
potential eyes looking at it.  Yes, some of that is my own selfishness
here - I don't want to have to carry this hunk of code around in my
tree and then be lumbered with trying to get it into mainline myself!
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 3/4] Staging: xgifb: fix braces {} are not necessary for single statement blocks

2013-10-16 Thread Dhanunjaya
This is a patch to the vb_setmode.c file that fixes braces {}
are not necessary for single statement blocks warning found
by the checkpatch.pl tool

Signed-of-by: Dhanunjaya 
---
 drivers/staging/xgifb/vb_setmode.c | 11 ---
 1 file changed, 4 insertions(+), 7 deletions(-)

diff --git a/drivers/staging/xgifb/vb_setmode.c 
b/drivers/staging/xgifb/vb_setmode.c
index 46dea3f..400c726 100644
--- a/drivers/staging/xgifb/vb_setmode.c
+++ b/drivers/staging/xgifb/vb_setmode.c
@@ -845,11 +845,10 @@ static unsigned short XGI_GetVCLK2Ptr(unsigned short 
ModeIdIndex,
VCLKIndex = TVCLKBASE_315_25 + HiTVVCLK;
 
if (pVBInfo->SetFlag & TVSimuMode) {
-   if (modeflag & Charx8Dot) {
+   if (modeflag & Charx8Dot)
VCLKIndex = TVCLKBASE_315_25 + HiTVSimuVCLK;
-   } else {
+   else
VCLKIndex = TVCLKBASE_315_25 + HiTVTextVCLK;
-   }
}
 
/* 301lv */
@@ -5274,9 +5273,8 @@ void XGI_SenseCRT1(struct vb_device_info *pVBInfo)
 
outb(0x00, pVBInfo->P3c8);
 
-   for (i = 0; i < 256 * 3; i++) {
+   for (i = 0; i < 256 * 3; i++)
outb(0x0F, (pVBInfo->P3c8 + 1)); /* DAC_TEST_PARMS */
-   }
 
mdelay(1);
 
@@ -5291,9 +5289,8 @@ void XGI_SenseCRT1(struct vb_device_info *pVBInfo)
/* avoid display something, set BLACK DAC if not restore DAC */
outb(0x00, pVBInfo->P3c8);
 
-   for (i = 0; i < 256 * 3; i++) {
+   for (i = 0; i < 256 * 3; i++)
outb(0, (pVBInfo->P3c8 + 1));
-   }
 
xgifb_reg_set(pVBInfo->P3c4, 0x01, SR01);
xgifb_reg_set(pVBInfo->P3d4, 0x63, CR63);
-- 
1.8.1.2

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


Re: [PATCH v2 1/3] imx-drm: Add mx6 hdmi transmitter support

2013-10-16 Thread Greg Kroah-Hartman
On Wed, Oct 16, 2013 at 07:07:35PM +0100, Russell King - ARM Linux wrote:
> Sorry, but I don't think imx-drm is driving the hardware correctly, and
> I know that Greg wants it moved out of drivers/staging, but frankly it
> seems to be far from ready for that.  Certainly the HDMI parts seems to
> be especially problematical.

I want it out of staging if it's working properly.  Yours is the first
report of it not working properly, and in fact, probably one of the
first users of the driver, as I haven't gotten any reports of it working
or not at all over the years.

thanks,

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


Re: [PATCH v2 1/3] imx-drm: Add mx6 hdmi transmitter support

2013-10-16 Thread Russell King - ARM Linux
On Wed, Oct 16, 2013 at 06:03:42PM +0100, Russell King - ARM Linux wrote:
> On Tue, Oct 15, 2013 at 10:17:07AM -0300, Fabio Estevam wrote:
> > On Tue, Oct 15, 2013 at 10:10 AM, Russell King - ARM Linux
> >  wrote:
> > > Another point on patch 1.  Sorry, I don't have patch 1 to reply to, it
> > > seems it was deleted from linux-arm-kernel's moderation queue.
> > >
> > > drm_mode_connector_attach_encoder() is called too early, before the
> > > base.id field in the encoder has been initialised.  This causes the
> > > connectors encoder array to be empty, and userspace KMS to fail.
> > >
> > > There's also bugs in the CSC setting too - it runs off the end of the
> > > array and gcc warns about this.  The code was clearly wrong.
> > >
> > > You may wish to combine this patch with patch 1 to sort all that out.
> > > For the patch below:
> > >
> > > Signed-off-by: Russell King 
> > > Tested-by: Russell King 
> > 
> > Thanks, Russell.
> > 
> > Will submit v3 when I am back to the office.
> 
> Okay, I still have a problem with HDMI: I have a magenta vertical line
> down the left hand side of the frame, the displayed frame is shifted
> right by the width of that line and the right hand side is missing some
> pixels.
> 
> First off, the hsync position programmed into the HDMI registers appears
> to be wrong.
> 
> I'm at a loss why imx-hdmi is obfuscated with a conversion from a
> drm_display_mode structure to a fb_videomode.  This adds additional
> confusion and additional opportunities for bugs; this is probably
> exactly why the hsync position is wrong.
> 
> In CEA-861-B for 720p @60Hz:
> 
> DE: __^^^
> HS: ___^^^___
>  ^  ^  ^
>  |  |  220 clocks
>  |  40 clocks
>  110 clocks
> 
> The IMX6 manual says HSYINCINDELAY0 is "Hsync active edge delay.  Integer
> number of pixel clock cycles from de non-active edge".  So, this should be
> 110.  Yet it ends up being programmed as 220, leading to a magenta vertical
> bar down the left hand side of the display.
> 
> Now, if you look at Documentation/fb/framebuffer.txt, in this case, the
> right margin should be 110 clocks, hsync len should be 40 and the left
> margin should be 220 clocks.
> 
> However, this is not what your conversion to a fb_videomode does.  It
> reverses the left and right margin.  A similar confusion also exists
> in the conversion of the upper/lower margins too.
> 
> The DRM model is this (for 720p @60Hz):
> 
> 0 1280 1390 1430  1650
> |===||---|--|
> ^   ^^   ^  ^
> start   hdisplay hsync_start hsync_end htotal
> 
> The fb model is the same as the above but rotated:
> 
> left margindisplayedright margin hsync_len
> |--|===||---|
> 
> So, the left margin is the bit between hsync_end and htotal, and the
> right margin is the bit between hdisplay and hsync_start.  Exactly
> the same analysis applies to the upper/lower margins.
> 
> What I suggest is that the use of fb_videomode is entirely killed off
> in this driver to remove this layer of confusion and instead the DRM
> model is stuck to within this DRM driver.
> 
> Now on to the next problem.  HSYNC/VSYNC polarity.
> 
> So, this is the mode which is set:
> 
>   1280x720 (0x41)   74.2MHz +HSync +VSync *current +preferred
> h: width  1280 start 1390 end 1430 total 1650 skew0 clock   
> 45.0KHz
> v: height  720 start  725 end  730 total  750   clock   60.0Hz
> 
> Note the positive HSync and VSync polarity - this is correct, backed
> up by CEA-861-B.
> 
> The IPU DI0 is configured thusly in its general control register:
> 0x264 = 0x26, which is what is set when the requested mode
> has DRM_MODE_FLAG_PHSYNC and DRM_MODE_FLAG_PVSYNC flags set.
> 
> However, if we look at the HDMI config: 0x121000 = 0x18.  Active low
> hsync/vsync.  This is quite obvious when you look at the code -
> convert_to_video_timing() does *nothing* at all when converting the
> sync polarities, which means hdmi_av_composer() doesn't program them
> appropriately.  And yes, poking 0x78 into this register finally fixes
> the problem.
> 
> Yet another reason why this silly conversion from one structure form
> to another is a Very Bad Idea.  Until I found this, I was merely going
> to send a patch to sort out convert_to_video_timing(), but quite frankly
> I'm going to kill this thing off right now.
> 
> Another thing:
> 
> static int imx_hdmi_setup(struct imx_hdmi *hdmi, struct drm_display_mode 
> *mode)
> {
> int ret;
> convert_to_video_timing(&hdmi->fb_mode, mode);
> 
> hdmi_disable_overflow_interrupts(hdmi);
> 
> hdmi->vic = 6;
> 
> It's quite wrong to force every video mode set to be CEA mode 6.  IIRC,
> There is a function in DRM which will tell you the CEA mode number.
> Again,

Re: [PATCH 2/2] Staging: xillybus: fix for quoted string split across lines

2013-10-16 Thread Greg KH
On Wed, Oct 16, 2013 at 11:27:52PM +0530, Dhanunjaya wrote:
> This is a patch to the xillybus_of.c file that fixes up a
> quoted string split across lines warning found by the
> checkpatch.pl tool.
> 
> Signed-off-by: Dhanunjaya 

I need a full name here please.

> ---
>  drivers/staging/xillybus/xillybus_of.c | 6 ++
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/staging/xillybus/xillybus_of.c 
> b/drivers/staging/xillybus/xillybus_of.c
> index 92c2931..822ef4d 100644
> --- a/drivers/staging/xillybus/xillybus_of.c
> +++ b/drivers/staging/xillybus/xillybus_of.c
> @@ -117,8 +117,7 @@ static int xilly_drv_probe(struct platform_device *op)
>  
>   rc = of_address_to_resource(dev->of_node, 0, &endpoint->res);
>   if (rc) {
> - pr_warn("xillybus: Failed to obtain device tree "
> - "resource\n");
> + pr_warn("xillybus: Failed to obtain device tree resource\n");

This should be using dev_warn() instead.

>   goto failed_request_regions;
>   }
>  
> @@ -141,8 +140,7 @@ static int xilly_drv_probe(struct platform_device *op)
>   rc = request_irq(irq, xillybus_isr, 0, xillyname, endpoint);
>  
>   if (rc) {
> - pr_err("xillybus: Failed to register IRQ handler. "
> -"Aborting.\n");
> + pr_err("xillybus: Failed to register IRQ handler, 
> Aborting...\n");

dev_err() instead please here as well.

thanks,

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


[PATCH 2/2] Staging: xillybus: fix for quoted string split across lines

2013-10-16 Thread Dhanunjaya
This is a patch to the xillybus_of.c file that fixes up a
quoted string split across lines warning found by the
checkpatch.pl tool.

Signed-off-by: Dhanunjaya 
---
 drivers/staging/xillybus/xillybus_of.c | 6 ++
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/xillybus/xillybus_of.c 
b/drivers/staging/xillybus/xillybus_of.c
index 92c2931..822ef4d 100644
--- a/drivers/staging/xillybus/xillybus_of.c
+++ b/drivers/staging/xillybus/xillybus_of.c
@@ -117,8 +117,7 @@ static int xilly_drv_probe(struct platform_device *op)
 
rc = of_address_to_resource(dev->of_node, 0, &endpoint->res);
if (rc) {
-   pr_warn("xillybus: Failed to obtain device tree "
-   "resource\n");
+   pr_warn("xillybus: Failed to obtain device tree resource\n");
goto failed_request_regions;
}
 
@@ -141,8 +140,7 @@ static int xilly_drv_probe(struct platform_device *op)
rc = request_irq(irq, xillybus_isr, 0, xillyname, endpoint);
 
if (rc) {
-   pr_err("xillybus: Failed to register IRQ handler. "
-  "Aborting.\n");
+   pr_err("xillybus: Failed to register IRQ handler, 
Aborting...\n");
rc = -ENODEV;
goto failed_register_irq;
}
-- 
1.8.1.2

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


Re: [PATCH v2 1/3] imx-drm: Add mx6 hdmi transmitter support

2013-10-16 Thread Russell King - ARM Linux
On Tue, Oct 15, 2013 at 10:17:07AM -0300, Fabio Estevam wrote:
> On Tue, Oct 15, 2013 at 10:10 AM, Russell King - ARM Linux
>  wrote:
> > Another point on patch 1.  Sorry, I don't have patch 1 to reply to, it
> > seems it was deleted from linux-arm-kernel's moderation queue.
> >
> > drm_mode_connector_attach_encoder() is called too early, before the
> > base.id field in the encoder has been initialised.  This causes the
> > connectors encoder array to be empty, and userspace KMS to fail.
> >
> > There's also bugs in the CSC setting too - it runs off the end of the
> > array and gcc warns about this.  The code was clearly wrong.
> >
> > You may wish to combine this patch with patch 1 to sort all that out.
> > For the patch below:
> >
> > Signed-off-by: Russell King 
> > Tested-by: Russell King 
> 
> Thanks, Russell.
> 
> Will submit v3 when I am back to the office.

Okay, I still have a problem with HDMI: I have a magenta vertical line
down the left hand side of the frame, the displayed frame is shifted
right by the width of that line and the right hand side is missing some
pixels.

First off, the hsync position programmed into the HDMI registers appears
to be wrong.

I'm at a loss why imx-hdmi is obfuscated with a conversion from a
drm_display_mode structure to a fb_videomode.  This adds additional
confusion and additional opportunities for bugs; this is probably
exactly why the hsync position is wrong.

In CEA-861-B for 720p @60Hz:

DE: __^^^
HS: ___^^^___
 ^  ^  ^
 |  |  220 clocks
 |  40 clocks
 110 clocks

The IMX6 manual says HSYINCINDELAY0 is "Hsync active edge delay.  Integer
number of pixel clock cycles from de non-active edge".  So, this should be
110.  Yet it ends up being programmed as 220, leading to a magenta vertical
bar down the left hand side of the display.

Now, if you look at Documentation/fb/framebuffer.txt, in this case, the
right margin should be 110 clocks, hsync len should be 40 and the left
margin should be 220 clocks.

However, this is not what your conversion to a fb_videomode does.  It
reverses the left and right margin.  A similar confusion also exists
in the conversion of the upper/lower margins too.

The DRM model is this (for 720p @60Hz):

0 1280 1390 1430  1650
|===||---|--|
^   ^^   ^  ^
start   hdisplay hsync_start hsync_end htotal

The fb model is the same as the above but rotated:

left margindisplayedright margin hsync_len
|--|===||---|

So, the left margin is the bit between hsync_end and htotal, and the
right margin is the bit between hdisplay and hsync_start.  Exactly
the same analysis applies to the upper/lower margins.

What I suggest is that the use of fb_videomode is entirely killed off
in this driver to remove this layer of confusion and instead the DRM
model is stuck to within this DRM driver.

Now on to the next problem.  HSYNC/VSYNC polarity.

So, this is the mode which is set:

  1280x720 (0x41)   74.2MHz +HSync +VSync *current +preferred
h: width  1280 start 1390 end 1430 total 1650 skew0 clock   45.0KHz
v: height  720 start  725 end  730 total  750   clock   60.0Hz

Note the positive HSync and VSync polarity - this is correct, backed
up by CEA-861-B.

The IPU DI0 is configured thusly in its general control register:
0x264 = 0x26, which is what is set when the requested mode
has DRM_MODE_FLAG_PHSYNC and DRM_MODE_FLAG_PVSYNC flags set.

However, if we look at the HDMI config: 0x121000 = 0x18.  Active low
hsync/vsync.  This is quite obvious when you look at the code -
convert_to_video_timing() does *nothing* at all when converting the
sync polarities, which means hdmi_av_composer() doesn't program them
appropriately.  And yes, poking 0x78 into this register finally fixes
the problem.

Yet another reason why this silly conversion from one structure form
to another is a Very Bad Idea.  Until I found this, I was merely going
to send a patch to sort out convert_to_video_timing(), but quite frankly
I'm going to kill this thing off right now.

Another thing:

static int imx_hdmi_setup(struct imx_hdmi *hdmi, struct drm_display_mode *mode)
{
int ret;
convert_to_video_timing(&hdmi->fb_mode, mode);

hdmi_disable_overflow_interrupts(hdmi);

hdmi->vic = 6;

It's quite wrong to force every video mode set to be CEA mode 6.  IIRC,
There is a function in DRM which will tell you the CEA mode number.
Again, I'll fix this in my patch rewriting this bit of the driver to
be correct.

I'm also suspicious of the "HDMI Initialization Step" comments, because
they make no sense:

/* HDMI Initialization Step B.4 */
static void imx_hdmi_enable_video_path(struct imx_hdmi *hdmi)
{

yet:

/* HDMI Initialization Step B.3 */

[PATCH] drivers: staging: dgnc: Remove useless casting in dgnc_driver.c

2013-10-16 Thread Geyslan G. Bem
Casting (void *) value returned by kzalloc is useless
as mentioned in Documentation/CodingStyle, Chap 14.

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

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

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


[PATCH] drivers: staging: dgap: Remove useless casting in dgap_parse.c

2013-10-16 Thread Geyslan G. Bem
Casting (void *) value returned by kmalloc is useless
as mentioned in Documentation/CodingStyle, Chap 14.

Signed-off-by: Geyslan G. Bem 
---
 drivers/staging/dgap/dgap_parse.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/dgap/dgap_parse.c 
b/drivers/staging/dgap/dgap_parse.c
index 5497e6d..d41aa1c 100644
--- a/drivers/staging/dgap/dgap_parse.c
+++ b/drivers/staging/dgap/dgap_parse.c
@@ -1013,7 +1013,7 @@ static void dgap_err(char *s)
 static struct cnode *dgap_newnode(int t)
 {
struct cnode *n;
-   if ( (n = (struct cnode *) kmalloc(sizeof(struct cnode ), GFP_ATOMIC) ) 
!= NULL) {
+   if ( (n = kmalloc(sizeof(struct cnode ), GFP_ATOMIC) ) != NULL) {
memset( (char *)n, 0, sizeof(struct cnode ) );
n->type = t;
}
-- 
1.8.4

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


Re: [PATCH] [media] staging: media: Fix build for iMON LIRC driver

2013-10-16 Thread Greg Kroah-Hartman
On Wed, Oct 16, 2013 at 10:03:40AM +0300, Dan Carpenter wrote:
> On Tue, Oct 15, 2013 at 04:02:43PM +0200, Thierry Reding wrote:
> > Add a missing , between parameters in a call to dev_info().
> > 
> 
> Greg already reverted the original patch.
> 
> The original patch wasn't sent to the list.  Archana, use
> scripts/get_maintainer.pl to find out who to send patches to.  Don't
> CC the linux-kernel list though because they don't care about details in
> staging.

Archana sent it through the OPW submission process, which has it's own
mailing list, so as to not bother the driverdev mailing list.  It was
my fault that I missed this error and took the patch, which is why I
reverted it.

thanks,

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


Re: [PATCH] Staging: comedi: fix semicolon coding style issue in ni_660x.c

2013-10-16 Thread Ian Abbott

On 2013-10-16 13:38, Dhanunjaya wrote:

This is a patch to the ni_660x.c file that fixes up a semicolon warning
found by the checkpatch.pl tool
---
  drivers/staging/comedi/drivers/ni_660x.c | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/comedi/drivers/ni_660x.c 
b/drivers/staging/comedi/drivers/ni_660x.c
index 3607336..95bb432 100644
--- a/drivers/staging/comedi/drivers/ni_660x.c
+++ b/drivers/staging/comedi/drivers/ni_660x.c
@@ -28,7 +28,7 @@
   *
   * Encoders work.  PulseGeneration (both single pulse and pulse train)
   * works.  Buffered commands work for input but not output.
- *
+ *
   * References:
   * DAQ 660x Register-Level Programmer Manual  (NI 370505A-01)
   * DAQ 6601/6602 User Manual (NI 322137B-01)
@@ -1232,7 +1232,7 @@ static int ni_660x_auto_attach(struct comedi_device *dev,
s->type = COMEDI_SUBD_COUNTER;
s->subdev_flags =
SDF_READABLE | SDF_WRITABLE | SDF_LSAMPL |
-   SDF_CMD_READ /* | SDF_CMD_WRITE */ ;
+   SDF_CMD_READ; /* | SDF_CMD_WRITE */
s->n_chan = 3;
s->maxdata = 0x;
s->insn_read = ni_660x_GPCT_rinsn;



Looks good!

Reviewed-by: Ian Abbott 

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


[PATCH 33/35] staging: comedi: s626: sample types are unsigned

2013-10-16 Thread Ian Abbott
Sample values in comedi are generally represented as unsigned values.
Use unsigned types consistently in the "s626" module when dealing with
sample values.

Rewrite `s626_reg_to_uint()` as it can be done with a one-liner.

Signed-off-by: Ian Abbott 
---
 drivers/staging/comedi/drivers/s626.c | 22 +++---
 1 file changed, 7 insertions(+), 15 deletions(-)

diff --git a/drivers/staging/comedi/drivers/s626.c 
b/drivers/staging/comedi/drivers/s626.c
index a34e707..d9aba7c 100644
--- a/drivers/staging/comedi/drivers/s626.c
+++ b/drivers/staging/comedi/drivers/s626.c
@@ -494,7 +494,7 @@ static void s626_send_dac(struct comedi_device *dev, 
uint32_t val)
  * Private helper function: Write setpoint to an application DAC channel.
  */
 static void s626_set_dac(struct comedi_device *dev, uint16_t chan,
-short dacdata)
+unsigned short dacdata)
 {
struct s626_private *devpriv = dev->private;
uint16_t signmask;
@@ -1329,17 +1329,9 @@ static const struct s626_enc_info s626_enc_chan_info[] = 
{
},
 };
 
-static unsigned int s626_ai_reg_to_uint(int data)
+static unsigned int s626_ai_reg_to_uint(unsigned int data)
 {
-   unsigned int tempdata;
-
-   tempdata = (data >> 18);
-   if (tempdata & 0x2000)
-   tempdata &= 0x1fff;
-   else
-   tempdata += (1 << 13);
-
-   return tempdata;
+   return ((data >> 18) & 0x3fff) ^ 0x2000;
 }
 
 static int s626_dio_set_irq(struct comedi_device *dev, unsigned int chan)
@@ -1545,19 +1537,19 @@ static bool s626_handle_eos_interrupt(struct 
comedi_device *dev)
 * first uint16_t in the buffer because it contains junk data
 * from the final ADC of the previous poll list scan.
 */
-   int32_t *readaddr = (int32_t *)devpriv->ana_buf.logical_base + 1;
+   uint32_t *readaddr = (uint32_t *)devpriv->ana_buf.logical_base + 1;
bool finished = false;
int i;
 
/* get the data and hand it over to comedi */
for (i = 0; i < cmd->chanlist_len; i++) {
-   short tempdata;
+   unsigned short tempdata;
 
/*
 * Convert ADC data to 16-bit integer values and copy
 * to application buffer.
 */
-   tempdata = s626_ai_reg_to_uint((int)*readaddr);
+   tempdata = s626_ai_reg_to_uint(*readaddr);
readaddr++;
 
/* put data into read buffer */
@@ -1881,7 +1873,7 @@ static int s626_ai_insn_read(struct comedi_device *dev,
uint16_t range = CR_RANGE(insn->chanspec);
uint16_t adc_spec = 0;
uint32_t gpio_image;
-   int tmp;
+   uint32_t tmp;
int n;
 
/*
-- 
1.8.4

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


[PATCH 32/35] staging: comedi: rtd520: sample types are unsigned

2013-10-16 Thread Ian Abbott
Sample values in comedi are generally represented as unsigned values.
Use unsigned types for sample value manipulations in the "rtd520" driver
for consistency.

Also replace the hand-coded munging of 2's complement sample values with
calls to `comedi_offset_munge()` and AND with `s->maxdata` to strip off
any extra sign bits.

Signed-off-by: Ian Abbott 
---
 drivers/staging/comedi/drivers/rtd520.c | 31 +--
 1 file changed, 13 insertions(+), 18 deletions(-)

diff --git a/drivers/staging/comedi/drivers/rtd520.c 
b/drivers/staging/comedi/drivers/rtd520.c
index 3ec6632..0ae2d61 100644
--- a/drivers/staging/comedi/drivers/rtd520.c
+++ b/drivers/staging/comedi/drivers/rtd520.c
@@ -602,7 +602,7 @@ static int rtd_ai_rinsn(struct comedi_device *dev,
 
/* convert n samples */
for (n = 0; n < insn->n; n++) {
-   s16 d;
+   unsigned short d;
/* trigger conversion */
writew(0, devpriv->las0 + LAS0_ADC);
 
@@ -621,9 +621,8 @@ static int rtd_ai_rinsn(struct comedi_device *dev,
d = d >> 3; /* low 3 bits are marker lines */
if (CHAN_ARRAY_TEST(devpriv->chan_is_bipolar, 0))
/* convert to comedi unsigned data */
-   data[n] = d + 2048;
-   else
-   data[n] = d;
+   d = comedi_offset_munge(s, d);
+   data[n] = d & s->maxdata;
}
 
/* return the number of samples read/written */
@@ -643,8 +642,7 @@ static int ai_read_n(struct comedi_device *dev, struct 
comedi_subdevice *s,
int ii;
 
for (ii = 0; ii < count; ii++) {
-   short sample;
-   s16 d;
+   unsigned short d;
 
if (0 == devpriv->ai_count) {   /* done */
d = readw(devpriv->las1 + LAS1_ADC_FIFO);
@@ -654,13 +652,12 @@ static int ai_read_n(struct comedi_device *dev, struct 
comedi_subdevice *s,
d = readw(devpriv->las1 + LAS1_ADC_FIFO);
d = d >> 3; /* low 3 bits are marker lines */
if (CHAN_ARRAY_TEST(devpriv->chan_is_bipolar,
-   s->async->cur_chan)) {
+   s->async->cur_chan))
/* convert to comedi unsigned data */
-   sample = d + 2048;
-   } else
-   sample = d;
+   d = comedi_offset_munge(s, d);
+   d &= s->maxdata;
 
-   if (!comedi_buf_put(s->async, sample))
+   if (!comedi_buf_put(s->async, d))
return -1;
 
if (devpriv->ai_count > 0)  /* < 0, means read forever */
@@ -677,8 +674,7 @@ static int ai_read_dregs(struct comedi_device *dev, struct 
comedi_subdevice *s)
struct rtd_private *devpriv = dev->private;
 
while (readl(devpriv->las0 + LAS0_ADC) & FS_ADC_NOT_EMPTY) {
-   short sample;
-   s16 d = readw(devpriv->las1 + LAS1_ADC_FIFO);
+   unsigned short d = readw(devpriv->las1 + LAS1_ADC_FIFO);
 
if (0 == devpriv->ai_count) {   /* done */
continue;   /* read rest */
@@ -686,13 +682,12 @@ static int ai_read_dregs(struct comedi_device *dev, 
struct comedi_subdevice *s)
 
d = d >> 3; /* low 3 bits are marker lines */
if (CHAN_ARRAY_TEST(devpriv->chan_is_bipolar,
-   s->async->cur_chan)) {
+   s->async->cur_chan))
/* convert to comedi unsigned data */
-   sample = d + 2048;
-   } else
-   sample = d;
+   d = comedi_offset_munge(s, d);
+   d &= s->maxdata;
 
-   if (!comedi_buf_put(s->async, sample))
+   if (!comedi_buf_put(s->async, d))
return -1;
 
if (devpriv->ai_count > 0)  /* < 0, means read forever */
-- 
1.8.4

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


[PATCH 34/35] staging: comedi: usbdux: sample types are unsigned

2013-10-16 Thread Ian Abbott
Sample values in comedi are generally represented as unsigned values.
Use unsigned types consistently for handling comedi sample data and also
for the USB data buffers.

Signed-off-by: Ian Abbott 
---
 drivers/staging/comedi/drivers/usbdux.c | 35 +
 1 file changed, 18 insertions(+), 17 deletions(-)

diff --git a/drivers/staging/comedi/drivers/usbdux.c 
b/drivers/staging/comedi/drivers/usbdux.c
index 9218d73..da1d501 100644
--- a/drivers/staging/comedi/drivers/usbdux.c
+++ b/drivers/staging/comedi/drivers/usbdux.c
@@ -122,7 +122,7 @@ sampling rate. If you sample two channels you get 4kHz and 
so on.
 #define PWM_DEFAULT_PERIOD ((long)(1E9/100))
 
 /* Size of one A/D value */
-#define SIZEADIN  ((sizeof(int16_t)))
+#define SIZEADIN  ((sizeof(uint16_t)))
 
 /*
  * Size of the input-buffer IN BYTES
@@ -134,7 +134,7 @@ sampling rate. If you sample two channels you get 4kHz and 
so on.
 #define SIZEINSNBUF   16
 
 /* size of one value for the D/A converter: channel and value */
-#define SIZEDAOUT  ((sizeof(int8_t)+sizeof(int16_t)))
+#define SIZEDAOUT  ((sizeof(uint8_t)+sizeof(uint16_t)))
 
 /*
  * Size of the output-buffer in bytes
@@ -195,15 +195,15 @@ struct usbdux_private {
/* PWM period */
unsigned int pwm_period;
/* PWM internal delay for the GPIF in the FX2 */
-   int8_t pwm_delay;
+   uint8_t pwm_delay;
/* size of the PWM buffer which holds the bit pattern */
int pwm_buf_sz;
/* input buffer for the ISO-transfer */
-   int16_t *in_buf;
+   uint16_t *in_buf;
/* input buffer for single insn */
-   int16_t *insn_buf;
+   uint16_t *insn_buf;
 
-   int8_t ao_chanlist[USBDUX_NUM_AO_CHAN];
+   uint8_t ao_chanlist[USBDUX_NUM_AO_CHAN];
unsigned int ao_readback[USBDUX_NUM_AO_CHAN];
 
unsigned int high_speed:1;
@@ -225,7 +225,7 @@ struct usbdux_private {
/* interval in frames/uframes */
unsigned int ai_interval;
/* commands */
-   int8_t *dux_commands;
+   uint8_t *dux_commands;
struct semaphore sem;
 };
 
@@ -367,7 +367,7 @@ static void usbduxsub_ai_isoc_irq(struct urb *urb)
n = s->async->cmd.chanlist_len;
for (i = 0; i < n; i++) {
unsigned int range = CR_RANGE(s->async->cmd.chanlist[i]);
-   int16_t val = le16_to_cpu(devpriv->in_buf[i]);
+   uint16_t val = le16_to_cpu(devpriv->in_buf[i]);
 
/* bipolar data is two's-complement */
if (comedi_range_is_bipolar(s, range))
@@ -415,7 +415,7 @@ static void usbduxsub_ao_isoc_irq(struct urb *urb)
struct comedi_device *dev = urb->context;
struct comedi_subdevice *s = dev->write_subdev;
struct usbdux_private *devpriv = dev->private;
-   int8_t *datap;
+   uint8_t *datap;
int len;
int ret;
int i;
@@ -483,7 +483,7 @@ static void usbduxsub_ao_isoc_irq(struct urb *urb)
*datap++ = len;
for (i = 0; i < s->async->cmd.chanlist_len; i++) {
unsigned int chan = devpriv->ao_chanlist[i];
-   short val;
+   unsigned short val;
 
ret = comedi_buf_get(s->async, &val);
if (ret < 0) {
@@ -649,14 +649,15 @@ static int usbdux_ai_cmdtest(struct comedi_device *dev,
  * creates the ADC command for the MAX1271
  * range is the range value from comedi
  */
-static int8_t create_adc_command(unsigned int chan, int range)
+static uint8_t create_adc_command(unsigned int chan, unsigned int range)
 {
-   int8_t p = (range <= 1);
-   int8_t r = ((range % 2) == 0);
+   uint8_t p = (range <= 1);
+   uint8_t r = ((range % 2) == 0);
+
return (chan << 4) | ((p == 1) << 2) | ((r == 1) << 3);
 }
 
-static int send_dux_commands(struct comedi_device *dev, int cmd_type)
+static int send_dux_commands(struct comedi_device *dev, unsigned int cmd_type)
 {
struct usb_device *usb = comedi_to_usb_dev(dev);
struct usbdux_private *devpriv = dev->private;
@@ -669,7 +670,7 @@ static int send_dux_commands(struct comedi_device *dev, int 
cmd_type)
&nsent, BULK_TIMEOUT);
 }
 
-static int receive_dux_commands(struct comedi_device *dev, int command)
+static int receive_dux_commands(struct comedi_device *dev, unsigned int 
command)
 {
struct usb_device *usb = comedi_to_usb_dev(dev);
struct usbdux_private *devpriv = dev->private;
@@ -879,7 +880,7 @@ static int usbdux_ao_insn_write(struct comedi_device *dev,
struct usbdux_private *devpriv = dev->private;
unsigned int chan = CR_CHAN(insn->chanspec);
unsigned int val = devpriv->ao_readback[chan];
-   int16_t *p = (int16_t *)&devpriv->dux_commands[2];
+   uint16_t *p = (uint16_t *)&devpriv->dux_commands[2];
int ret = -EBUSY;
int i;
 
@@ -1198,7 +1199,7 @@ static int usb

[PATCH 03/35] staging: comedi: 8255: sample types are unsigned

2013-10-16 Thread Ian Abbott
Sample values in comedi are generally represented as unsigned values.
`subdev_8255_interrupt()` calls `comedi_buf_put()` with a `short` data
value merely because that's what was previously expected.  Since it now
expects an `unsigned short`, change it here for consistency.

Signed-off-by: Ian Abbott 
---
 drivers/staging/comedi/drivers/8255.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/comedi/drivers/8255.c 
b/drivers/staging/comedi/drivers/8255.c
index 5737bb4..b4009e8 100644
--- a/drivers/staging/comedi/drivers/8255.c
+++ b/drivers/staging/comedi/drivers/8255.c
@@ -112,7 +112,7 @@ void subdev_8255_interrupt(struct comedi_device *dev,
 {
struct subdev_8255_private *spriv = s->private;
unsigned long iobase = spriv->iobase;
-   short d;
+   unsigned short d;
 
d = spriv->io(0, _8255_DATA, 0, iobase);
d |= (spriv->io(0, _8255_DATA + 1, 0, iobase) << 8);
-- 
1.8.4

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


[PATCH 04/35] staging: comedi: addi_apci_3120: sample types are unsigned

2013-10-16 Thread Ian Abbott
Sample values in comedi are generally represented as unsigned values.
Change the element type of `ul_DmaBufferVirtual[2]` in `struct
addi_private` from `short *` to `unsigned short *` for consistency.
Note that several ADDI-DATA drivers use this struct from
"addi_common.h", but only the "addi_apci_3120" driver uses this member.
Also change the type of the `dma_buffer` parameter of
`v_APCI3120_InterruptDmaMoveBlock16bit()` from `short *` to `unsigned
short *`.

Signed-off-by: Ian Abbott 
---
 drivers/staging/comedi/drivers/addi-data/addi_common.h| 2 +-
 drivers/staging/comedi/drivers/addi-data/hwdrv_apci3120.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/comedi/drivers/addi-data/addi_common.h 
b/drivers/staging/comedi/drivers/addi-data/addi_common.h
index dfd1e66..2ed2da3 100644
--- a/drivers/staging/comedi/drivers/addi-data/addi_common.h
+++ b/drivers/staging/comedi/drivers/addi-data/addi_common.h
@@ -133,7 +133,7 @@ struct addi_private {
unsigned short us_UseDma;   /*  To use Dma or not */
unsigned char b_DmaDoubleBuffer;/*  we can use double buffering 
*/
unsigned int ui_DmaActualBuffer;/*  which buffer is used now */
-   short *ul_DmaBufferVirtual[2];  /*  pointers to begin of DMA buffer */
+   unsigned short *ul_DmaBufferVirtual[2]; /*  pointers to DMA buffer */
unsigned int ul_DmaBufferHw[2]; /*  hw address of DMA buff */
unsigned int ui_DmaBufferSize[2];   /*  size of dma buffer in bytes 
*/
unsigned int ui_DmaBufferUsesize[2];/*  which size we may now used 
for transfer */
diff --git a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3120.c 
b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3120.c
index ac6e75d..3c9eec8 100644
--- a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3120.c
+++ b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3120.c
@@ -1391,7 +1391,7 @@ static int i_APCI3120_CommandAnalogInput(struct 
comedi_device *dev,
  */
 static void v_APCI3120_InterruptDmaMoveBlock16bit(struct comedi_device *dev,
  struct comedi_subdevice *s,
- short *dma_buffer,
+ unsigned short *dma_buffer,
  unsigned int num_samples)
 {
struct addi_private *devpriv = dev->private;
-- 
1.8.4

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


[PATCH 31/35] staging: comedi: quatech_daqp_cs: sample types are unsigned

2013-10-16 Thread Ian Abbott
Sample values in comedi are generally represented as unsigned values.
Change `daqp_interrupt()` to use unsigned sample values for consistency.

Signed-off-by: Ian Abbott 
---
 drivers/staging/comedi/drivers/quatech_daqp_cs.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/staging/comedi/drivers/quatech_daqp_cs.c 
b/drivers/staging/comedi/drivers/quatech_daqp_cs.c
index ece3031..96a4695 100644
--- a/drivers/staging/comedi/drivers/quatech_daqp_cs.c
+++ b/drivers/staging/comedi/drivers/quatech_daqp_cs.c
@@ -208,8 +208,7 @@ static enum irqreturn daqp_interrupt(int irq, void *dev_id)
case buffer:
while (!((status = inb(dev->iobase + DAQP_STATUS))
 & DAQP_STATUS_FIFO_EMPTY)) {
-
-   short data;
+   unsigned short data;
 
if (status & DAQP_STATUS_DATA_LOST) {
s->async->events |=
-- 
1.8.4

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


[PATCH 30/35] staging: comedi: pcmuio: sample types are unsigned

2013-10-16 Thread Ian Abbott
Sample values in comedi are generally represented as unsigned values.
Change `pcmuio_handle_intr_subdev()` in the "pcmuio" module to use
unsigned sample values for consistency.

Also, make the order in which `pcmuio_handle_intr_subdev()` writes the
two sample values (each actually containing up to 16 1-bit sample
values) independent of the host byte ordering.

Signed-off-by: Ian Abbott 
---
 drivers/staging/comedi/drivers/pcmuio.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/comedi/drivers/pcmuio.c 
b/drivers/staging/comedi/drivers/pcmuio.c
index 67e2bb1..954fa96 100644
--- a/drivers/staging/comedi/drivers/pcmuio.c
+++ b/drivers/staging/comedi/drivers/pcmuio.c
@@ -315,8 +315,8 @@ static void pcmuio_handle_intr_subdev(struct comedi_device 
*dev,
}
 
/* Write the scan to the buffer. */
-   if (comedi_buf_put(s->async, ((short *)&val)[0]) &&
-   comedi_buf_put(s->async, ((short *)&val)[1])) {
+   if (comedi_buf_put(s->async, val) &&
+   comedi_buf_put(s->async, val >> 16)) {
s->async->events |= (COMEDI_CB_BLOCK | COMEDI_CB_EOS);
} else {
/* Overflow! Stop acquisition!! */
-- 
1.8.4

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


[PATCH 26/35] staging: comedi: pcl812: sample types are unsigned

2013-10-16 Thread Ian Abbott
Sample values in comedi are generally represented as unsigned values.
Change `transfer_from_dma_buf()` and `interrupt_pcl812_ai_dma()` in the
"pcl812" module to use `unsigned short` sample values for consistency.

Also remove the `short *ai_data` member of `struct pcl812_private` as it
is only assigned to.

Signed-off-by: Ian Abbott 
---
 drivers/staging/comedi/drivers/pcl812.c | 9 -
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/comedi/drivers/pcl812.c 
b/drivers/staging/comedi/drivers/pcl812.c
index 530aee1..03315ab 100644
--- a/drivers/staging/comedi/drivers/pcl812.c
+++ b/drivers/staging/comedi/drivers/pcl812.c
@@ -355,7 +355,6 @@ struct pcl812_private {
unsigned int ai_n_chan; /*  how many channels is measured */
unsigned int ai_flags;  /*  flaglist */
unsigned int ai_data_len;   /*  len of data buffer */
-   short *ai_data; /*  data buffer */
unsigned int ai_is16b;  /*  =1 we have 16 bit card */
unsigned long dmabuf[2];/*  PTR to DMA buf */
unsigned int dmapages[2];   /*  how many pages we have allocated */
@@ -661,7 +660,6 @@ static int pcl812_ai_cmd(struct comedi_device *dev, struct 
comedi_subdevice *s)
 
devpriv->ai_flags = cmd->flags;
devpriv->ai_data_len = s->async->prealloc_bufsz;
-   devpriv->ai_data = s->async->prealloc_buf;
if (cmd->stop_src == TRIG_COUNT) {
devpriv->ai_scans = cmd->stop_arg;
devpriv->ai_neverending = 0;
@@ -831,7 +829,8 @@ static irqreturn_t interrupt_pcl812_ai_int(int irq, void *d)
 ==
 */
 static void transfer_from_dma_buf(struct comedi_device *dev,
- struct comedi_subdevice *s, short *ptr,
+ struct comedi_subdevice *s,
+ unsigned short *ptr,
  unsigned int bufptr, unsigned int len)
 {
struct pcl812_private *devpriv = dev->private;
@@ -869,9 +868,9 @@ static irqreturn_t interrupt_pcl812_ai_dma(int irq, void *d)
struct comedi_subdevice *s = &dev->subdevices[0];
unsigned long dma_flags;
int len, bufptr;
-   short *ptr;
+   unsigned short *ptr;
 
-   ptr = (short *)devpriv->dmabuf[devpriv->next_dma_buf];
+   ptr = (unsigned short *)devpriv->dmabuf[devpriv->next_dma_buf];
len = (devpriv->dmabytestomove[devpriv->next_dma_buf] >> 1) -
devpriv->ai_poll_ptr;
 
-- 
1.8.4

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


[PATCH 35/35] staging: comedi: usbduxsigma: sample types are unsigned

2013-10-16 Thread Ian Abbott
Sample values in comedi are generally represented as unsigned values.
Use unsigned types consistently for handling comedi sample data and also
for the USB data buffers.

Signed-off-by: Ian Abbott 
---
 drivers/staging/comedi/drivers/usbduxsigma.c | 20 ++--
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/drivers/staging/comedi/drivers/usbduxsigma.c 
b/drivers/staging/comedi/drivers/usbduxsigma.c
index 5618e61..a5363de 100644
--- a/drivers/staging/comedi/drivers/usbduxsigma.c
+++ b/drivers/staging/comedi/drivers/usbduxsigma.c
@@ -78,7 +78,7 @@
 #define USBDUXSIGMA_NUM_AO_CHAN4
 
 /* Size of one A/D value */
-#define SIZEADIN  ((sizeof(int32_t)))
+#define SIZEADIN  ((sizeof(uint32_t)))
 
 /*
  * Size of the async input-buffer IN BYTES, the DIO state is transmitted
@@ -93,7 +93,7 @@
 #define NUMOUTCHANNELS8
 
 /* size of one value for the D/A converter: channel and value */
-#define SIZEDAOUT  ((sizeof(uint8_t)+sizeof(int16_t)))
+#define SIZEDAOUT  ((sizeof(uint8_t)+sizeof(uint16_t)))
 
 /*
  * Size of the output-buffer in bytes
@@ -157,11 +157,11 @@ struct usbduxsigma_private {
/* size of the PWM buffer which holds the bit pattern */
int pwm_buf_sz;
/* input buffer for the ISO-transfer */
-   int32_t *in_buf;
+   uint32_t *in_buf;
/* input buffer for single insn */
-   int8_t *insn_buf;
+   uint8_t *insn_buf;
 
-   int8_t ao_chanlist[USBDUXSIGMA_NUM_AO_CHAN];
+   uint8_t ao_chanlist[USBDUXSIGMA_NUM_AO_CHAN];
unsigned int ao_readback[USBDUXSIGMA_NUM_AO_CHAN];
 
unsigned high_speed:1;
@@ -224,7 +224,7 @@ static void usbduxsigma_ai_urb_complete(struct urb *urb)
struct usbduxsigma_private *devpriv = dev->private;
struct comedi_subdevice *s = dev->read_subdev;
unsigned int dio_state;
-   int32_t val;
+   uint32_t val;
int ret;
int i;
 
@@ -421,7 +421,7 @@ static void usbduxsigma_ao_urb_complete(struct urb *urb)
*datap++ = len;
for (i = 0; i < len; i++) {
unsigned int chan = devpriv->ao_chanlist[i];
-   short val;
+   unsigned short val;
 
ret = comedi_buf_get(s->async, &val);
if (ret < 0) {
@@ -784,7 +784,7 @@ static int usbduxsigma_ai_insn_read(struct comedi_device 
*dev,
}
 
for (i = 0; i < insn->n; i++) {
-   int32_t val;
+   uint32_t val;
 
ret = usbduxsigma_receive_cmd(dev, USBDUXSIGMA_SINGLE_AD_CMD);
if (ret < 0) {
@@ -793,7 +793,7 @@ static int usbduxsigma_ai_insn_read(struct comedi_device 
*dev,
}
 
/* 32 bits big endian from the A/D converter */
-   val = be32_to_cpu(*((int32_t *)((devpriv->insn_buf) + 1)));
+   val = be32_to_cpu(*((uint32_t *)((devpriv->insn_buf) + 1)));
val &= 0x00ff;  /* strip status byte */
val ^= 0x0080;  /* convert to unsigned */
 
@@ -1358,7 +1358,7 @@ static int usbduxsigma_getstatusinfo(struct comedi_device 
*dev, int chan)
return ret;
 
/* 32 bits big endian from the A/D converter */
-   val = be32_to_cpu(*((int32_t *)((devpriv->insn_buf)+1)));
+   val = be32_to_cpu(*((uint32_t *)((devpriv->insn_buf)+1)));
val &= 0x00ff;  /* strip status byte */
val ^= 0x0080;  /* convert to unsigned */
 
-- 
1.8.4

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


[PATCH 28/35] staging: comedi: pcl818: sample types are unsigned

2013-10-16 Thread Ian Abbott
Sample values in comedi are generally represented as unsigned values.
Change the interrupt data transfer functions in the "pcl818" module to
use unsigned types for consistency.

Also remove the `short *ai_data` member of `struct pcl818_private` as it
is only assigned to and otherwise unused.

Signed-off-by: Ian Abbott 
---
 drivers/staging/comedi/drivers/pcl818.c | 11 +--
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/comedi/drivers/pcl818.c 
b/drivers/staging/comedi/drivers/pcl818.c
index 7be0c94..9e4d7e8 100644
--- a/drivers/staging/comedi/drivers/pcl818.c
+++ b/drivers/staging/comedi/drivers/pcl818.c
@@ -289,7 +289,6 @@ struct pcl818_private {
unsigned int *ai_chanlist;  /*  actaul chanlist */
unsigned int ai_flags;  /*  flaglist */
unsigned int ai_data_len;   /*  len of data buffer */
-   short *ai_data; /*  data buffer */
unsigned int ai_timer1; /*  timers */
unsigned int ai_timer2;
struct comedi_subdevice *sub_ai;/*  ptr to AI subdevice */
@@ -443,7 +442,7 @@ static irqreturn_t interrupt_pcl818_ai_mode13_int(int irq, 
void *d)
struct comedi_device *dev = d;
struct pcl818_private *devpriv = dev->private;
struct comedi_subdevice *s = &dev->subdevices[0];
-   int low;
+   unsigned char low;
int timeout = 50;   /* wait max 50us */
 
while (timeout--) {
@@ -505,7 +504,7 @@ static irqreturn_t interrupt_pcl818_ai_mode13_dma(int irq, 
void *d)
struct comedi_subdevice *s = &dev->subdevices[0];
int i, len, bufptr;
unsigned long flags;
-   short *ptr;
+   unsigned short *ptr;
 
disable_dma(devpriv->dma);
devpriv->next_dma_buf = 1 - devpriv->next_dma_buf;
@@ -528,7 +527,7 @@ static irqreturn_t interrupt_pcl818_ai_mode13_dma(int irq, 
void *d)
 
devpriv->dma_runs_to_end--;
outb(0, dev->iobase + PCL818_CLRINT);   /* clear INT request */
-   ptr = (short *)devpriv->dmabuf[1 - devpriv->next_dma_buf];
+   ptr = (unsigned short *)devpriv->dmabuf[1 - devpriv->next_dma_buf];
 
len = devpriv->hwdmasize[0] >> 1;
bufptr = 0;
@@ -582,7 +581,8 @@ static irqreturn_t interrupt_pcl818_ai_mode13_fifo(int irq, 
void *d)
struct comedi_device *dev = d;
struct pcl818_private *devpriv = dev->private;
struct comedi_subdevice *s = &dev->subdevices[0];
-   int i, len, lo;
+   int i, len;
+   unsigned char lo;
 
outb(0, dev->iobase + PCL818_FI_INTCLR);/*  clear fifo int 
request */
 
@@ -1072,7 +1072,6 @@ static int ai_cmd(struct comedi_device *dev, struct 
comedi_subdevice *s)
devpriv->ai_chanlist = cmd->chanlist;
devpriv->ai_flags = cmd->flags;
devpriv->ai_data_len = s->async->prealloc_bufsz;
-   devpriv->ai_data = s->async->prealloc_buf;
devpriv->ai_timer1 = 0;
devpriv->ai_timer2 = 0;
 
-- 
1.8.4

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


[PATCH 13/35] staging: comedi: das16: sample types are unsigned

2013-10-16 Thread Ian Abbott
Sample values in comedi are generally represented as unsigned values.
Change the type of the `data` variable in `das16_ai_munge()` from `short
*` to `unsigned short *` for consistency.

Signed-off-by: Ian Abbott 
---
 drivers/staging/comedi/drivers/das16.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/comedi/drivers/das16.c 
b/drivers/staging/comedi/drivers/das16.c
index 30f3995..a8446ca 100644
--- a/drivers/staging/comedi/drivers/das16.c
+++ b/drivers/staging/comedi/drivers/das16.c
@@ -846,7 +846,7 @@ static void das16_ai_munge(struct comedi_device *dev,
   unsigned int start_chan_index)
 {
unsigned int i, num_samples = num_bytes / sizeof(short);
-   short *data = array;
+   unsigned short *data = array;
 
for (i = 0; i < num_samples; i++) {
data[i] = le16_to_cpu(data[i]);
-- 
1.8.4

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


[PATCH 25/35] staging: comedi: pcl711: sample types are unsigned

2013-10-16 Thread Ian Abbott
Sample values in comedi are generally represented as unsigned values.
Don't cast the sample value parameter of `comedi_buf_put()` to `short`,
particularly as it has now been changed to `unsigned short`.

Signed-off-by: Ian Abbott 
---
 drivers/staging/comedi/drivers/pcl711.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/comedi/drivers/pcl711.c 
b/drivers/staging/comedi/drivers/pcl711.c
index 89982fb..f0fc123 100644
--- a/drivers/staging/comedi/drivers/pcl711.c
+++ b/drivers/staging/comedi/drivers/pcl711.c
@@ -213,7 +213,7 @@ static irqreturn_t pcl711_interrupt(int irq, void *d)
 
outb(PCL711_INT_STAT_CLR, dev->iobase + PCL711_INT_STAT_REG);
 
-   if (comedi_buf_put(s->async, (short)data) == 0) {
+   if (comedi_buf_put(s->async, data) == 0) {
s->async->events |= COMEDI_CB_OVERFLOW | COMEDI_CB_ERROR;
} else {
s->async->events |= COMEDI_CB_BLOCK | COMEDI_CB_EOS;
-- 
1.8.4

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


[PATCH 18/35] staging: comedi: fl512: sample types are unsigned

2013-10-16 Thread Ian Abbott
Sample values in comedi are generally represented as unsigned values.
Change the element type of the `ao_readback[]` member of `struct
fl512_private` from `short` to `unsigned short` for consistency.

Signed-off-by: Ian Abbott 
---
 drivers/staging/comedi/drivers/fl512.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/staging/comedi/drivers/fl512.c 
b/drivers/staging/comedi/drivers/fl512.c
index 8d70f64..e3ff4c4 100644
--- a/drivers/staging/comedi/drivers/fl512.c
+++ b/drivers/staging/comedi/drivers/fl512.c
@@ -25,8 +25,7 @@ Configuration options:
 
 #define FL512_SIZE 16  /* the size of the used memory */
 struct fl512_private {
-
-   short ao_readback[2];
+   unsigned short ao_readback[2];
 };
 
 static const struct comedi_lrange range_fl512 = { 4, {
-- 
1.8.4

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


[PATCH 27/35] staging: comedi: pcl816: sample types are unsigned

2013-10-16 Thread Ian Abbott
Sample values in comedi are generally represented as unsigned values.
Change the "pcl816" module to use unsigned types to handle samples for
consistency.

Signed-off-by: Ian Abbott 
---
 drivers/staging/comedi/drivers/pcl816.c | 12 +++-
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/comedi/drivers/pcl816.c 
b/drivers/staging/comedi/drivers/pcl816.c
index 2fd9b17..ab9d2bd 100644
--- a/drivers/staging/comedi/drivers/pcl816.c
+++ b/drivers/staging/comedi/drivers/pcl816.c
@@ -229,7 +229,7 @@ static irqreturn_t interrupt_pcl816_ai_mode13_int(int irq, 
void *d)
struct comedi_device *dev = d;
struct pcl816_private *devpriv = dev->private;
struct comedi_subdevice *s = &dev->subdevices[0];
-   int low, hi;
+   unsigned char low, hi;
int timeout = 50;   /* wait max 50us */
 
while (timeout--) {
@@ -281,7 +281,8 @@ static irqreturn_t interrupt_pcl816_ai_mode13_int(int irq, 
void *d)
analog input dma mode 1 & 3, 816 cards
 */
 static void transfer_from_dma_buf(struct comedi_device *dev,
- struct comedi_subdevice *s, short *ptr,
+ struct comedi_subdevice *s,
+ unsigned short *ptr,
  unsigned int bufptr, unsigned int len)
 {
struct pcl816_private *devpriv = dev->private;
@@ -324,7 +325,7 @@ static irqreturn_t interrupt_pcl816_ai_mode13_dma(int irq, 
void *d)
struct comedi_subdevice *s = &dev->subdevices[0];
int len, bufptr, this_dma_buf;
unsigned long dma_flags;
-   short *ptr;
+   unsigned short *ptr;
 
disable_dma(devpriv->dma);
this_dma_buf = devpriv->next_dma_buf;
@@ -352,7 +353,7 @@ static irqreturn_t interrupt_pcl816_ai_mode13_dma(int irq, 
void *d)
devpriv->dma_runs_to_end--;
outb(0, dev->iobase + PCL816_CLRINT);   /* clear INT request */
 
-   ptr = (short *)devpriv->dmabuf[this_dma_buf];
+   ptr = (unsigned short *)devpriv->dmabuf[this_dma_buf];
 
len = (devpriv->hwdmasize[0] >> 1) - devpriv->ai_poll_ptr;
bufptr = devpriv->ai_poll_ptr;
@@ -665,7 +666,8 @@ static int pcl816_ai_poll(struct comedi_device *dev, struct 
comedi_subdevice *s)
}
 
transfer_from_dma_buf(dev, s,
- (short *)devpriv->dmabuf[devpriv->next_dma_buf],
+ (unsigned short *)devpriv->dmabuf[devpriv->
+   next_dma_buf],
  devpriv->ai_poll_ptr, top2);
 
devpriv->ai_poll_ptr = top1;/*  new buffer position */
-- 
1.8.4

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


[PATCH 16/35] staging: comedi: dt282x: sample types are unsigned

2013-10-16 Thread Ian Abbott
Sample values in comedi are generally represented as unsigned values.
Change various members of `struct dt282x_private` and various parameters
and variables dealing with samples to use `unsigned short` instead of
`short` for consistency.

Signed-off-by: Ian Abbott 
---
 drivers/staging/comedi/drivers/dt282x.c | 12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/comedi/drivers/dt282x.c 
b/drivers/staging/comedi/drivers/dt282x.c
index e89126a..a01e6b5 100644
--- a/drivers/staging/comedi/drivers/dt282x.c
+++ b/drivers/staging/comedi/drivers/dt282x.c
@@ -226,7 +226,7 @@ struct dt282x_private {
 
const struct comedi_lrange *darangelist[2];
 
-   short ao[2];
+   unsigned short ao[2];
 
volatile int dacsr; /* software copies of registers */
volatile int adcsr;
@@ -237,7 +237,7 @@ struct dt282x_private {
 
struct {
int chan;
-   short *buf; /* DMA buffer */
+   unsigned short *buf;/* DMA buffer */
volatile int size;  /* size of current transfer */
} dma[2];
int dma_maxsize;/* max size of DMA transfer (in bytes) */
@@ -283,7 +283,7 @@ static void dt282x_disable_dma(struct comedi_device *dev);
 
 static int dt282x_grab_dma(struct comedi_device *dev, int dma1, int dma2);
 
-static void dt282x_munge(struct comedi_device *dev, short *buf,
+static void dt282x_munge(struct comedi_device *dev, unsigned short *buf,
 unsigned int nbytes)
 {
const struct dt282x_board *board = comedi_board(dev);
@@ -496,9 +496,9 @@ static irqreturn_t dt282x_interrupt(int irq, void *d)
 #if 0
if (adcsr & DT2821_ADDONE) {
int ret;
-   short data;
+   unsigned short data;
 
-   data = (short)inw(dev->iobase + DT2821_ADDAT);
+   data = inw(dev->iobase + DT2821_ADDAT);
data &= (1 << board->adbits) - 1;
 
if (devpriv->ad_2scomp)
@@ -796,7 +796,7 @@ static int dt282x_ao_insn_write(struct comedi_device *dev,
 {
const struct dt282x_board *board = comedi_board(dev);
struct dt282x_private *devpriv = dev->private;
-   short d;
+   unsigned short d;
unsigned int chan;
 
chan = CR_CHAN(insn->chanspec);
-- 
1.8.4

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


[PATCH 29/35] staging: comedi: pcmmio: sample types are unsigned

2013-10-16 Thread Ian Abbott
Sample values in comedi are generally represented as unsigned values.
Change `interrupt_pcmmio()` and `ai_rinsn()` in the "pcmmio" module to
use unsigned sample values for consistency.

Also, make the order in which `interrupt_pcmmio()` writes the two sample
values (each actually containing up to 16 1-bit sample values)
independent of the host byte ordering.

Note that this module is a mess, so please excuse the checkpatch
warnings.

Signed-off-by: Ian Abbott 
---
 drivers/staging/comedi/drivers/pcmmio.c | 7 +++
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/comedi/drivers/pcmmio.c 
b/drivers/staging/comedi/drivers/pcmmio.c
index 574443d..14cee3a 100644
--- a/drivers/staging/comedi/drivers/pcmmio.c
+++ b/drivers/staging/comedi/drivers/pcmmio.c
@@ -553,12 +553,11 @@ static irqreturn_t interrupt_pcmmio(int irq, void *d)

val |= (1U << n);
}
/* Write the 
scan to the buffer. */
-   if 
(comedi_buf_put(s->async, ((short *)&val)[0])
+   if 
(comedi_buf_put(s->async, val)
&&

comedi_buf_put
(s->async,
-((short *)
- 
&val)[1])) {
+val >> 
16)) {

s->async->events |= (COMEDI_CB_BLOCK | COMEDI_CB_EOS);
} else {
/* 
Overflow! Stop acquisition!! */
@@ -846,7 +845,7 @@ static int ai_rinsn(struct comedi_device *dev, struct 
comedi_subdevice *s,
CR_RANGE(insn->chanspec), aref = CR_AREF(insn->chanspec);
unsigned char command_byte = 0;
unsigned iooffset = 0;
-   short sample, adc_adjust = 0;
+   unsigned short sample, adc_adjust = 0;
 
if (chan > 7)
chan -= 8, iooffset = 4;/*
-- 
1.8.4

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


[PATCH 15/35] staging: comedi: das1800: sample types are unsigned

2013-10-16 Thread Ian Abbott
Sample values in comedi are generally represented by unsigned values.
Change the type of the `ao_update_bits` member of `struct
das1800_private` and the types of various local variables used to hold
sample values from `short` to `unsigned short` for consistency.

Signed-off-by: Ian Abbott 
---
 drivers/staging/comedi/drivers/das1800.c | 9 +
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/comedi/drivers/das1800.c 
b/drivers/staging/comedi/drivers/das1800.c
index f753a10..1880038 100644
--- a/drivers/staging/comedi/drivers/das1800.c
+++ b/drivers/staging/comedi/drivers/das1800.c
@@ -438,7 +438,8 @@ struct das1800_private {
uint16_t *dma_current_buf;  /* pointer to dma buffer currently 
being used */
unsigned int dma_transfer_size; /* size of transfer currently used, in 
bytes */
unsigned long iobase2;  /* secondary io address used for analog out on 
'ao' boards */
-   short ao_update_bits;   /* remembers the last write to the 'update' dac 
*/
+   unsigned short ao_update_bits;  /* remembers the last write to the
+* 'update' dac */
 };
 
 /* analog out range for 'ao' boards */
@@ -501,7 +502,7 @@ static void das1800_handle_fifo_not_empty(struct 
comedi_device *dev,
  struct comedi_subdevice *s)
 {
struct das1800_private *devpriv = dev->private;
-   short dpnt;
+   unsigned short dpnt;
int unipolar;
struct comedi_cmd *cmd = &s->async->cmd;
 
@@ -1211,7 +1212,7 @@ static int das1800_ai_rinsn(struct comedi_device *dev,
int i, n;
int chan, range, aref, chan_range;
int timeout = 1000;
-   short dpnt;
+   unsigned short dpnt;
int conv_flags = 0;
unsigned long irq_flags;
 
@@ -1276,7 +1277,7 @@ static int das1800_ao_winsn(struct comedi_device *dev,
int chan = CR_CHAN(insn->chanspec);
 /* int range = CR_RANGE(insn->chanspec); */
int update_chan = thisboard->ao_n_chan - 1;
-   short output;
+   unsigned short output;
unsigned long irq_flags;
 
/*   card expects two's complement data */
-- 
1.8.4

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


[PATCH 08/35] staging: comedi: adv_pci1723: sample types are unsigned

2013-10-16 Thread Ian Abbott
Sample values in comedi are generally represented as unsigned values.
Change the element type of the `ao_data[]` member of `struct
pci1723_private` from `short` to `unsigned short` for consistency.

Signed-off-by: Ian Abbott 
---
 drivers/staging/comedi/drivers/adv_pci1723.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/comedi/drivers/adv_pci1723.c 
b/drivers/staging/comedi/drivers/adv_pci1723.c
index 71321f7..bd4f781 100644
--- a/drivers/staging/comedi/drivers/adv_pci1723.c
+++ b/drivers/staging/comedi/drivers/adv_pci1723.c
@@ -105,7 +105,7 @@ TODO:
 
 struct pci1723_private {
unsigned char da_range[8];  /* D/A output range for each channel */
-   short ao_data[8];   /* data output buffer */
+   unsigned short ao_data[8];  /* data output buffer */
 };
 
 /*
-- 
1.8.4

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


[PATCH 11/35] staging: comedi: cb_pcidas: sample types are unsigned

2013-10-16 Thread Ian Abbott
Sample values in comedi are generally represented by unsigned values.
Change the element types of `ai_buffer[]`, `ao_buffer[]` and
`ao_value[]` in `struct cb_pcidas_private` to `unsigned short` for
consistency.

Signed-off-by: Ian Abbott 
---
 drivers/staging/comedi/drivers/cb_pcidas.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/comedi/drivers/cb_pcidas.c 
b/drivers/staging/comedi/drivers/cb_pcidas.c
index 0891659..e72a403 100644
--- a/drivers/staging/comedi/drivers/cb_pcidas.c
+++ b/drivers/staging/comedi/drivers/cb_pcidas.c
@@ -357,15 +357,15 @@ struct cb_pcidas_private {
unsigned int s5933_intcsr_bits;
unsigned int ao_control_bits;
/* fifo buffers */
-   short ai_buffer[AI_BUFFER_SIZE];
-   short ao_buffer[AO_BUFFER_SIZE];
+   unsigned short ai_buffer[AI_BUFFER_SIZE];
+   unsigned short ao_buffer[AO_BUFFER_SIZE];
/* divisors of master clock for analog output pacing */
unsigned int ao_divisor1;
unsigned int ao_divisor2;
/* number of analog output samples remaining */
unsigned int ao_count;
/* cached values for readback */
-   int ao_value[2];
+   unsigned short ao_value[2];
unsigned int caldac_value[NUM_CHANNELS_8800];
unsigned int trimpot_value[NUM_CHANNELS_8402];
unsigned int dac08_value;
-- 
1.8.4

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


[PATCH 24/35] staging: comedi: ni_pcidio: sample types are unsigned

2013-10-16 Thread Ian Abbott
Sample values in comedi are generally represented as unsigned values.
Change `nidio_interrupt()` to use unsigned types for sample values
(actually bit-vectors of 1-bit sample values) instead of signed types.

Also rename the `AuxData` variable to `auxdata` and change it from
`long` to `unsigned int` as it only needs to hold a 32-bit value.

Signed-off-by: Ian Abbott 
---
 drivers/staging/comedi/drivers/ni_pcidio.c | 12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/comedi/drivers/ni_pcidio.c 
b/drivers/staging/comedi/drivers/ni_pcidio.c
index b6283a8..e3a8fa9 100644
--- a/drivers/staging/comedi/drivers/ni_pcidio.c
+++ b/drivers/staging/comedi/drivers/ni_pcidio.c
@@ -406,9 +406,9 @@ static irqreturn_t nidio_interrupt(int irq, void *d)
struct mite_struct *mite = devpriv->mite;
 
/* int i, j; */
-   long int AuxData = 0;
-   short data1 = 0;
-   short data2 = 0;
+   unsigned int auxdata = 0;
+   unsigned short data1 = 0;
+   unsigned short data2 = 0;
int flags;
int status;
int work = 0;
@@ -481,11 +481,11 @@ static irqreturn_t nidio_interrupt(int irq, void *d)
  );
goto out;
}
-   AuxData =
+   auxdata =
readl(devpriv->mite->daq_io_addr +
  Group_1_FIFO);
-   data1 = AuxData & 0x;
-   data2 = (AuxData & 0x) >> 16;
+   data1 = auxdata & 0x;
+   data2 = (auxdata & 0x) >> 16;
comedi_buf_put(async, data1);
comedi_buf_put(async, data2);
/* DPRINTK("read:%d, %d\n",data1,data2); */
-- 
1.8.4

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


[PATCH 20/35] staging: comedi: me4000: sample types are unsigned (and not long!)

2013-10-16 Thread Ian Abbott
Sample values in comedi are generally represented as unsigned values.
Change the types of various variables in the "me4000" driver dealing
with samples to use unsigned types for consistency.

Also replace the `long` or `unsigned long` variables used to handle
32-bit register values to `unsigned int`.

Signed-off-by: Ian Abbott 
---
 drivers/staging/comedi/drivers/me4000.c | 16 
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/staging/comedi/drivers/me4000.c 
b/drivers/staging/comedi/drivers/me4000.c
index aba7bea..3d12e91 100644
--- a/drivers/staging/comedi/drivers/me4000.c
+++ b/drivers/staging/comedi/drivers/me4000.c
@@ -427,7 +427,7 @@ static int xilinx_download(struct comedi_device *dev)
 static void me4000_reset(struct comedi_device *dev)
 {
struct me4000_info *info = dev->private;
-   unsigned long val;
+   unsigned int val;
int chan;
 
/* Make a hardware reset */
@@ -480,9 +480,9 @@ static int me4000_ai_insn_read(struct comedi_device *dev,
int rang = CR_RANGE(insn->chanspec);
int aref = CR_AREF(insn->chanspec);
 
-   unsigned long entry = 0;
-   unsigned long tmp;
-   long lval;
+   unsigned int entry = 0;
+   unsigned int tmp;
+   unsigned int lval;
 
if (insn->n == 0) {
return 0;
@@ -586,7 +586,7 @@ static int me4000_ai_insn_read(struct comedi_device *dev,
 static int me4000_ai_cancel(struct comedi_device *dev,
struct comedi_subdevice *s)
 {
-   unsigned long tmp;
+   unsigned int tmp;
 
/* Stop any running conversion */
tmp = inl(dev->iobase + ME4000_AI_CTRL_REG);
@@ -783,7 +783,7 @@ static int ai_prepare(struct comedi_device *dev,
  unsigned int scan_ticks, unsigned int chan_ticks)
 {
 
-   unsigned long tmp = 0;
+   unsigned int tmp = 0;
 
/* Write timer arguments */
ai_write_timer(dev, init_ticks, scan_ticks, chan_ticks);
@@ -1108,7 +1108,7 @@ static irqreturn_t me4000_ai_isr(int irq, void *dev_id)
struct comedi_subdevice *s = &dev->subdevices[0];
int i;
int c = 0;
-   long lval;
+   unsigned int lval;
 
if (!dev->attached)
return IRQ_NONE;
@@ -1252,7 +1252,7 @@ static int me4000_ao_insn_write(struct comedi_device *dev,
int chan = CR_CHAN(insn->chanspec);
int rang = CR_RANGE(insn->chanspec);
int aref = CR_AREF(insn->chanspec);
-   unsigned long tmp;
+   unsigned int tmp;
 
if (insn->n == 0) {
return 0;
-- 
1.8.4

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


[PATCH 14/35] staging: comedi: das16m1: sample types are unsigned

2013-10-16 Thread Ian Abbott
Sample values in comedi are generally represented as unsigned values.
Change the element type of the `ai_buffer[]` member of `struct
das16m1_private_struct` and the types used by `munge_sample()` and
`munge_sample_array()` from `short` to `unsigned short` for consistency.

Signed-off-by: Ian Abbott 
---
 drivers/staging/comedi/drivers/das16m1.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/comedi/drivers/das16m1.c 
b/drivers/staging/comedi/drivers/das16m1.c
index 579b74e..fce9acf 100644
--- a/drivers/staging/comedi/drivers/das16m1.c
+++ b/drivers/staging/comedi/drivers/das16m1.c
@@ -131,18 +131,18 @@ struct das16m1_private_struct {
 * needed to keep track of whether new count has been loaded into
 * counter yet (loaded by first sample conversion) */
u16 initial_hw_count;
-   short ai_buffer[FIFO_SIZE];
+   unsigned short ai_buffer[FIFO_SIZE];
unsigned int divisor1;  /*  divides master clock to obtain conversion 
speed */
unsigned int divisor2;  /*  divides master clock to obtain conversion 
speed */
unsigned long extra_iobase;
 };
 
-static inline short munge_sample(short data)
+static inline unsigned short munge_sample(unsigned short data)
 {
return (data >> 4) & 0xfff;
 }
 
-static void munge_sample_array(short *array, unsigned int num_elements)
+static void munge_sample_array(unsigned short *array, unsigned int 
num_elements)
 {
unsigned int i;
 
-- 
1.8.4

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


[PATCH 23/35] staging: comedi: ni_mio_common: sample types are unsigned

2013-10-16 Thread Ian Abbott
Sample values in comedi are generally represented as unsigned values.
Change the element type of the `ai_fifo_buffer[]` element of `struct
ni_board_struct` and the types of various local variables from `short`
to `unsigned short` for consistency.

Signed-off-by: Ian Abbott 
---
 drivers/staging/comedi/drivers/ni_mio_common.c | 18 +-
 drivers/staging/comedi/drivers/ni_stc.h|  2 +-
 2 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/drivers/staging/comedi/drivers/ni_mio_common.c 
b/drivers/staging/comedi/drivers/ni_mio_common.c
index b9df2ee..5113397 100644
--- a/drivers/staging/comedi/drivers/ni_mio_common.c
+++ b/drivers/staging/comedi/drivers/ni_mio_common.c
@@ -1292,7 +1292,7 @@ static void ni_ao_fifo_load(struct comedi_device *dev,
struct comedi_cmd *cmd = &async->cmd;
int chan;
int i;
-   short d;
+   unsigned short d;
u32 packed_data;
int range;
int err = 1;
@@ -1403,7 +1403,7 @@ static void ni_ai_fifo_read(struct comedi_device *dev,
int i;
 
if (board->reg_type == ni_reg_611x) {
-   short data[2];
+   unsigned short data[2];
u32 dl;
 
for (i = 0; i < n / 2; i++) {
@@ -1420,7 +1420,7 @@ static void ni_ai_fifo_read(struct comedi_device *dev,
cfc_write_to_buffer(s, data[0]);
}
} else if (board->reg_type == ni_reg_6143) {
-   short data[2];
+   unsigned short data[2];
u32 dl;
 
/*  This just reads the FIFO assuming the data is present, no 
checks on the FIFO status are performed */
@@ -1511,9 +1511,9 @@ static void ni_handle_fifo_dregs(struct comedi_device 
*dev)
const struct ni_board_struct *board = comedi_board(dev);
struct ni_private *devpriv = dev->private;
struct comedi_subdevice *s = &dev->subdevices[NI_AI_SUBDEV];
-   short data[2];
+   unsigned short data[2];
u32 dl;
-   short fifo_empty;
+   unsigned short fifo_empty;
int i;
 
if (board->reg_type == ni_reg_611x) {
@@ -1577,7 +1577,7 @@ static void get_last_sample_611x(struct comedi_device 
*dev)
const struct ni_board_struct *board = comedi_board(dev);
struct ni_private *devpriv __maybe_unused = dev->private;
struct comedi_subdevice *s = &dev->subdevices[NI_AI_SUBDEV];
-   short data;
+   unsigned short data;
u32 dl;
 
if (board->reg_type != ni_reg_611x)
@@ -1596,7 +1596,7 @@ static void get_last_sample_6143(struct comedi_device 
*dev)
const struct ni_board_struct *board = comedi_board(dev);
struct ni_private *devpriv __maybe_unused = dev->private;
struct comedi_subdevice *s = &dev->subdevices[NI_AI_SUBDEV];
-   short data;
+   unsigned short data;
u32 dl;
 
if (board->reg_type != ni_reg_6143)
@@ -1621,7 +1621,7 @@ static void ni_ai_munge(struct comedi_device *dev, struct 
comedi_subdevice *s,
struct comedi_async *async = s->async;
unsigned int i;
unsigned int length = num_bytes / bytes_per_sample(s);
-   short *array = data;
+   unsigned short *array = data;
unsigned int *larray = data;
 
for (i = 0; i < length; i++) {
@@ -2873,7 +2873,7 @@ static void ni_ao_munge(struct comedi_device *dev, struct 
comedi_subdevice *s,
unsigned int i;
unsigned int offset;
unsigned int length = num_bytes / sizeof(short);
-   short *array = data;
+   unsigned short *array = data;
 
offset = 1 << (board->aobits - 1);
for (i = 0; i < length; i++) {
diff --git a/drivers/staging/comedi/drivers/ni_stc.h 
b/drivers/staging/comedi/drivers/ni_stc.h
index 11bf0aa..f0630b78 100644
--- a/drivers/staging/comedi/drivers/ni_stc.h
+++ b/drivers/staging/comedi/drivers/ni_stc.h
@@ -1491,7 +1491,7 @@ struct ni_board_struct {
unsigned short pwm_up_count;\
unsigned short pwm_down_count;  \
\
-   short ai_fifo_buffer[0x2000];   \
+   unsigned short ai_fifo_buffer[0x2000];  \
uint8_t eeprom_buffer[M_SERIES_EEPROM_SIZE]; \
uint32_t serial_number; \
\
-- 
1.8.4

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


[PATCH 17/35] staging: comedi: dt3000: sample types are unsigned

2013-10-16 Thread Ian Abbott
Sample values in comedi are generally represented as unsigned values.
Change the type of the `data` variable in `dt3k_ai_empty_fifo()` from
`short` to `unsigned short` for consistency.

Signed-off-by: Ian Abbott 
---
 drivers/staging/comedi/drivers/dt3000.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/comedi/drivers/dt3000.c 
b/drivers/staging/comedi/drivers/dt3000.c
index fec911f..292226e 100644
--- a/drivers/staging/comedi/drivers/dt3000.c
+++ b/drivers/staging/comedi/drivers/dt3000.c
@@ -331,7 +331,7 @@ static void dt3k_ai_empty_fifo(struct comedi_device *dev,
int rear;
int count;
int i;
-   short data;
+   unsigned short data;
 
front = readw(devpriv->io_addr + DPR_AD_Buf_Front);
count = front - devpriv->ai_front;
-- 
1.8.4

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


[PATCH 22/35] staging: comedi: ni_labpc: sample types are unsigned

2013-10-16 Thread Ian Abbott
Sample values in comedi are generally represented as unsigned values.
Change the type of the `data` variable in `labpc_ai_cmd()` from `short`
to `unsigned short` for consistency.

Signed-off-by: Ian Abbott 
---
 drivers/staging/comedi/drivers/ni_labpc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/comedi/drivers/ni_labpc.c 
b/drivers/staging/comedi/drivers/ni_labpc.c
index e91570d..0512445 100644
--- a/drivers/staging/comedi/drivers/ni_labpc.c
+++ b/drivers/staging/comedi/drivers/ni_labpc.c
@@ -893,7 +893,7 @@ static int labpc_ai_cmd(struct comedi_device *dev, struct 
comedi_subdevice *s)
 static int labpc_drain_fifo(struct comedi_device *dev)
 {
struct labpc_private *devpriv = dev->private;
-   short data;
+   unsigned short data;
struct comedi_async *async = dev->read_subdev->async;
const int timeout = 1;
unsigned int i;
-- 
1.8.4

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


[PATCH 07/35] staging: comedi: adv_pci1710: sample types are unsigned

2013-10-16 Thread Ian Abbott
Sample values in comedi are generally represented as unsigned values.
Change the element type of the `ao_data[]` member of `struct
pci1710_private` from `short` to `unsigned short` for consistency.  Also
remove the `ai_data` member as it is only assigned to.  Change various
local variables used to hold sample values to `unsigned short`.

Signed-off-by: Ian Abbott 
---
 drivers/staging/comedi/drivers/adv_pci1710.c | 8 +++-
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/comedi/drivers/adv_pci1710.c 
b/drivers/staging/comedi/drivers/adv_pci1710.c
index 49b39ec..c3fdcab 100644
--- a/drivers/staging/comedi/drivers/adv_pci1710.c
+++ b/drivers/staging/comedi/drivers/adv_pci1710.c
@@ -314,10 +314,9 @@ struct pci1710_private {
unsigned int *ai_chanlist;  /*  actaul chanlist */
unsigned int ai_flags;  /*  flaglist */
unsigned int ai_data_len;   /*  len of data buffer */
-   short *ai_data; /*  data buffer */
unsigned int ai_timer1; /*  timers */
unsigned int ai_timer2;
-   short ao_data[4];   /*  data output buffer */
+   unsigned short ao_data[4];  /*  data output buffer */
unsigned int cnt0_write_wait;   /* after a write, wait for update of the
 * internal state */
 };
@@ -736,7 +735,7 @@ static void interrupt_pci1710_every_sample(void *d)
int m;
 #ifdef PCI171x_PARANOIDCHECK
const struct boardtype *this_board = comedi_board(dev);
-   short sampl;
+   unsigned short sampl;
 #endif
 
m = inw(dev->iobase + PCI171x_STATUS);
@@ -817,7 +816,7 @@ static int move_block_from_fifo(struct comedi_device *dev,
int i, j;
 #ifdef PCI171x_PARANOIDCHECK
const struct boardtype *this_board = comedi_board(dev);
-   int sampl;
+   unsigned short sampl;
 #endif
 
j = s->async->cur_chan;
@@ -1122,7 +1121,6 @@ static int pci171x_ai_cmd(struct comedi_device *dev, 
struct comedi_subdevice *s)
devpriv->ai_chanlist = cmd->chanlist;
devpriv->ai_flags = cmd->flags;
devpriv->ai_data_len = s->async->prealloc_bufsz;
-   devpriv->ai_data = s->async->prealloc_buf;
devpriv->ai_timer1 = 0;
devpriv->ai_timer2 = 0;
 
-- 
1.8.4

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


[PATCH 19/35] staging: comedi: icp_multi: sample types are unsigned

2013-10-16 Thread Ian Abbott
Sample values in comedi are generally represented as unsigned values.
Change the element type of the `ao_data[]` member of `struct
icp_multi_private` from `short` to `unsigned short` for consistency.

Also remove the `ai_data` and `di_data` members as they are not used.

Signed-off-by: Ian Abbott 
---
 drivers/staging/comedi/drivers/icp_multi.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/staging/comedi/drivers/icp_multi.c 
b/drivers/staging/comedi/drivers/icp_multi.c
index 15d8718..1e16641 100644
--- a/drivers/staging/comedi/drivers/icp_multi.c
+++ b/drivers/staging/comedi/drivers/icp_multi.c
@@ -118,9 +118,7 @@ struct icp_multi_private {
unsigned char act_chanlist_len; /*  len of scanlist */
unsigned char act_chanlist_pos; /*  actual position in MUX list */
unsigned int *ai_chanlist;  /*  actaul chanlist */
-   short *ai_data; /*  data buffer */
-   short ao_data[4];   /*  data output buffer */
-   short di_data;  /*  Digital input data */
+   unsigned short ao_data[4];  /*  data output buffer */
unsigned int do_data;   /*  Remember digital output data */
 };
 
-- 
1.8.4

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


[PATCH 02/35] staging: comedi: use unsigned sample in cfc_write_to_buffer()

2013-10-16 Thread Ian Abbott
Sample values in comedi are generally represented as unsigned values.
`cfc_write_to_buffer()` in "comedi_fc.h" currently uses `short` to hold
a 16-bit sample value to be written to the buffer.  Change the type of
the parameter to `unsigned short` for consistency.

Signed-off-by: Ian Abbott 
---
 drivers/staging/comedi/drivers/comedi_fc.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/comedi/drivers/comedi_fc.h 
b/drivers/staging/comedi/drivers/comedi_fc.h
index a4dea7c..8558b07 100644
--- a/drivers/staging/comedi/drivers/comedi_fc.h
+++ b/drivers/staging/comedi/drivers/comedi_fc.h
@@ -30,7 +30,7 @@ extern unsigned int cfc_write_array_to_buffer(struct 
comedi_subdevice *subd,
  unsigned int num_bytes);
 
 static inline unsigned int cfc_write_to_buffer(struct comedi_subdevice *subd,
-  short data)
+  unsigned short data)
 {
return cfc_write_array_to_buffer(subd, &data, sizeof(data));
 };
-- 
1.8.4

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


[PATCH 05/35] staging: comedi: adl_pci9111: sample types are unsigned

2013-10-16 Thread Ian Abbott
Sample values in comedi are generally represented as unsigned values.
Change the element type of the `ai_bounce_buffer[]` member of `struct
pci9111_private_data` from `short` to `unsigned short` for consistency.
Also change the type of the `array` variable in `pci9111_ai_munge()`
from `short *` to `unsigned short *`.

Signed-off-by: Ian Abbott 
---
 drivers/staging/comedi/drivers/adl_pci9111.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/comedi/drivers/adl_pci9111.c 
b/drivers/staging/comedi/drivers/adl_pci9111.c
index 4db46f0..eab8da2 100644
--- a/drivers/staging/comedi/drivers/adl_pci9111.c
+++ b/drivers/staging/comedi/drivers/adl_pci9111.c
@@ -151,7 +151,7 @@ struct pci9111_private_data {
unsigned int div1;
unsigned int div2;
 
-   short ai_bounce_buffer[2 * PCI9111_FIFO_HALF_SIZE];
+   unsigned short ai_bounce_buffer[2 * PCI9111_FIFO_HALF_SIZE];
 };
 
 static void plx9050_interrupt_control(unsigned long io_base,
@@ -567,7 +567,7 @@ static void pci9111_ai_munge(struct comedi_device *dev,
 unsigned int num_bytes,
 unsigned int start_chan_index)
 {
-   short *array = data;
+   unsigned short *array = data;
unsigned int maxdata = s->maxdata;
unsigned int invert = (maxdata + 1) >> 1;
unsigned int shift = (maxdata == 0x) ? 0 : 4;
-- 
1.8.4

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


[PATCH 06/35] staging: comedi: adl_pci9118: sample types are unsigned

2013-10-16 Thread Ian Abbott
Sample values in comedi are generally represented as unsigned values.
Change the `ao_data[]` and `dmabuf_virt[]` members of `struct
pci9118_private` and various local variables dealing with sample values
to use `unsigned short` instead of `short` for consistency.

Also remove the `short *ai_data` member of `struct pci9118_private` as
it is only assigned to.

Signed-off-by: Ian Abbott 
---
 drivers/staging/comedi/drivers/adl_pci9118.c | 18 --
 1 file changed, 8 insertions(+), 10 deletions(-)

diff --git a/drivers/staging/comedi/drivers/adl_pci9118.c 
b/drivers/staging/comedi/drivers/adl_pci9118.c
index bd5c8bb..0f2e859 100644
--- a/drivers/staging/comedi/drivers/adl_pci9118.c
+++ b/drivers/staging/comedi/drivers/adl_pci9118.c
@@ -352,12 +352,11 @@ struct pci9118_private {
 * on external start
 */
unsigned int ai_data_len;
-   short *ai_data;
-   short ao_data[2];   /* data output buffer */
+   unsigned short ao_data[2];  /* data output buffer */
unsigned int ai_scans;  /* number of scans to do */
char dma_doublebuf; /* we can use double buffering 
*/
unsigned int dma_actbuf;/* which buffer is used now */
-   short *dmabuf_virt[2];  /*
+   unsigned short *dmabuf_virt[2]; /*
 * pointers to begin of
 * DMA buffer
 */
@@ -700,7 +699,7 @@ static void interrupt_pci9118_ai_mode4_switch(struct 
comedi_device *dev)
 
 static unsigned int defragment_dma_buffer(struct comedi_device *dev,
  struct comedi_subdevice *s,
- short *dma_buffer,
+ unsigned short *dma_buffer,
  unsigned int num_samples)
 {
struct pci9118_private *devpriv = dev->private;
@@ -724,7 +723,7 @@ static unsigned int defragment_dma_buffer(struct 
comedi_device *dev,
 
 static int move_block_from_dma(struct comedi_device *dev,
struct comedi_subdevice *s,
-   short *dma_buffer,
+   unsigned short *dma_buffer,
unsigned int num_samples)
 {
struct pci9118_private *devpriv = dev->private;
@@ -925,7 +924,7 @@ static void pci9118_ai_munge(struct comedi_device *dev,
 {
struct pci9118_private *devpriv = dev->private;
unsigned int i, num_samples = num_bytes / sizeof(short);
-   short *array = data;
+   unsigned short *array = data;
 
for (i = 0; i < num_samples; i++) {
if (devpriv->usedma)
@@ -945,7 +944,7 @@ static void interrupt_pci9118_ai_onesample(struct 
comedi_device *dev,
   unsigned short int_daq)
 {
struct pci9118_private *devpriv = dev->private;
-   register short sampl;
+   unsigned short sampl;
 
s->async->events = 0;
 
@@ -1613,7 +1612,6 @@ static int pci9118_ai_cmd(struct comedi_device *dev, 
struct comedi_subdevice *s)
devpriv->ai_n_chan = cmd->chanlist_len;
devpriv->ai_n_scanlen = cmd->scan_end_arg;
devpriv->ai_chanlist = cmd->chanlist;
-   devpriv->ai_data = s->async->prealloc_buf;
devpriv->ai_data_len = s->async->prealloc_bufsz;
devpriv->ai_timer1 = 0;
devpriv->ai_timer2 = 0;
@@ -1987,8 +1985,8 @@ static int pci9118_common_attach(struct comedi_device 
*dev, int disable_irq,
for (i = 0; i < 2; i++) {
for (pages = 4; pages >= 0; pages--) {
devpriv->dmabuf_virt[i] =
-   (short *)__get_free_pages(GFP_KERNEL,
- pages);
+   (unsigned short *)
+   __get_free_pages(GFP_KERNEL, pages);
if (devpriv->dmabuf_virt[i])
break;
}
-- 
1.8.4

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


[PATCH 12/35] staging: comedi: cb_pcidas64: sample types are unsigned

2013-10-16 Thread Ian Abbott
Sample values in comedi are unsigned.  Change the element type of
`ao_bounce_buffer[]` in `struct pcidas64_private` from `short` to
`unsigned short` for consistency.

Signed-off-by: Ian Abbott 
---
 drivers/staging/comedi/drivers/cb_pcidas64.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/comedi/drivers/cb_pcidas64.c 
b/drivers/staging/comedi/drivers/cb_pcidas64.c
index e49743a..ff52065 100644
--- a/drivers/staging/comedi/drivers/cb_pcidas64.c
+++ b/drivers/staging/comedi/drivers/cb_pcidas64.c
@@ -1137,7 +1137,7 @@ struct pcidas64_private {
volatile short ai_cmd_running;
unsigned int ai_fifo_segment_length;
struct ext_clock_info ext_clock;
-   short ao_bounce_buffer[DAC_FIFO_SIZE];
+   unsigned short ao_bounce_buffer[DAC_FIFO_SIZE];
 };
 
 static unsigned int ai_range_bits_6xxx(const struct comedi_device *dev,
-- 
1.8.4

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


[PATCH 21/35] staging: comedi: ni_at_a2150: sample types are unsigned

2013-10-16 Thread Ian Abbott
Sample values in comedi are generally represented by unsigned values.
Change the type of the `dma_buffer` member of `struct a2150_private`
from `s16 *` to `uint16_t *`, and change the type of the `dpnt` variable
in `a2150_interrupt()` to `unsigned short` for consistency.

Signed-off-by: Ian Abbott 
---
 drivers/staging/comedi/drivers/ni_at_a2150.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/comedi/drivers/ni_at_a2150.c 
b/drivers/staging/comedi/drivers/ni_at_a2150.c
index c77d343..63c8479 100644
--- a/drivers/staging/comedi/drivers/ni_at_a2150.c
+++ b/drivers/staging/comedi/drivers/ni_at_a2150.c
@@ -154,7 +154,7 @@ struct a2150_private {
 
volatile unsigned int count;/* number of data points left to be 
taken */
unsigned int dma;   /*  dma channel */
-   s16 *dma_buffer;/*  dma buffer */
+   uint16_t *dma_buffer;   /*  dma buffer */
unsigned int dma_transfer_size; /*  size in bytes of dma transfers */
int irq_dma_bits;   /*  irq/dma register bits */
int config_bits;/*  config register bits */
@@ -192,7 +192,7 @@ static irqreturn_t a2150_interrupt(int irq, void *d)
struct comedi_async *async;
struct comedi_cmd *cmd;
unsigned int max_points, num_points, residue, leftover;
-   short dpnt;
+   unsigned short dpnt;
static const int sample_size = sizeof(devpriv->dma_buffer[0]);
 
if (!dev->attached) {
-- 
1.8.4

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


[PATCH 01/35] staging: comedi: use unsigned samples for comedi_buf_put()/get()

2013-10-16 Thread Ian Abbott
Sample values in comedi are generally represented as unsigned values.
`comedi_buf_put()` and `comedi_buf_get()` use a `short` to hold the
16-bit data value being transferred to or from the comedi buffer.
Change them to use `unsigned short` for consistency.

Signed-off-by: Ian Abbott 
---
 drivers/staging/comedi/comedi_buf.c | 8 
 drivers/staging/comedi/comedidev.h  | 4 ++--
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/comedi/comedi_buf.c 
b/drivers/staging/comedi/comedi_buf.c
index 94b2385f..4e26bd7 100644
--- a/drivers/staging/comedi/comedi_buf.c
+++ b/drivers/staging/comedi/comedi_buf.c
@@ -344,7 +344,7 @@ unsigned int comedi_buf_read_free(struct comedi_async 
*async,
 }
 EXPORT_SYMBOL_GPL(comedi_buf_read_free);
 
-int comedi_buf_put(struct comedi_async *async, short x)
+int comedi_buf_put(struct comedi_async *async, unsigned short x)
 {
unsigned int n = __comedi_buf_write_alloc(async, sizeof(short), 1);
 
@@ -352,20 +352,20 @@ int comedi_buf_put(struct comedi_async *async, short x)
async->events |= COMEDI_CB_ERROR;
return 0;
}
-   *(short *)(async->prealloc_buf + async->buf_write_ptr) = x;
+   *(unsigned short *)(async->prealloc_buf + async->buf_write_ptr) = x;
comedi_buf_write_free(async, sizeof(short));
return 1;
 }
 EXPORT_SYMBOL_GPL(comedi_buf_put);
 
-int comedi_buf_get(struct comedi_async *async, short *x)
+int comedi_buf_get(struct comedi_async *async, unsigned short *x)
 {
unsigned int n = comedi_buf_read_n_available(async);
 
if (n < sizeof(short))
return 0;
comedi_buf_read_alloc(async, sizeof(short));
-   *x = *(short *)(async->prealloc_buf + async->buf_read_ptr);
+   *x = *(unsigned short *)(async->prealloc_buf + async->buf_read_ptr);
comedi_buf_read_free(async, sizeof(short));
return 1;
 }
diff --git a/drivers/staging/comedi/comedidev.h 
b/drivers/staging/comedi/comedidev.h
index 9a854b1..143be80 100644
--- a/drivers/staging/comedi/comedidev.h
+++ b/drivers/staging/comedi/comedidev.h
@@ -346,8 +346,8 @@ unsigned int comedi_buf_read_n_available(struct 
comedi_async *);
 unsigned int comedi_buf_read_alloc(struct comedi_async *, unsigned int);
 unsigned int comedi_buf_read_free(struct comedi_async *, unsigned int);
 
-int comedi_buf_put(struct comedi_async *, short);
-int comedi_buf_get(struct comedi_async *, short *);
+int comedi_buf_put(struct comedi_async *, unsigned short);
+int comedi_buf_get(struct comedi_async *, unsigned short *);
 
 void comedi_buf_memcpy_to(struct comedi_async *async, unsigned int offset,
  const void *source, unsigned int num_bytes);
-- 
1.8.4

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


[PATCH 10/35] staging: comedi: amplc_pci230: sample types are unsigned

2013-10-16 Thread Ian Abbott
Sample values in comedi are generally represented as unsigned values.
Replace all uses of `short` to handle sample values in the
"amplc_pci230" driver with `unsigned short` for consistency.

Signed-off-by: Ian Abbott 
---
 drivers/staging/comedi/drivers/amplc_pci230.c | 21 +++--
 1 file changed, 11 insertions(+), 10 deletions(-)

diff --git a/drivers/staging/comedi/drivers/amplc_pci230.c 
b/drivers/staging/comedi/drivers/amplc_pci230.c
index 43059c2..a97bbd6 100644
--- a/drivers/staging/comedi/drivers/amplc_pci230.c
+++ b/drivers/staging/comedi/drivers/amplc_pci230.c
@@ -573,14 +573,14 @@ static const struct comedi_lrange pci230_ao_range = { 2, {
 /* PCI230 daccon bipolar flag for each analogue output range. */
 static const unsigned char pci230_ao_bipolar[2] = { 0, 1 };
 
-static short pci230_ai_read(struct comedi_device *dev)
+static unsigned short pci230_ai_read(struct comedi_device *dev)
 {
const struct pci230_board *thisboard = comedi_board(dev);
struct pci230_private *devpriv = dev->private;
-   short data;
+   unsigned short data;
 
/* Read sample. */
-   data = (short)inw(dev->iobase + PCI230_ADCDATA);
+   data = inw(dev->iobase + PCI230_ADCDATA);
/* PCI230 is 12 bit - stored in upper bits of 16 bit register (lower
 * four bits reserved for expansion). */
/* PCI230+ is 16 bit AI. */
@@ -595,7 +595,7 @@ static short pci230_ai_read(struct comedi_device *dev)
 }
 
 static inline unsigned short pci230_ao_mangle_datum(struct comedi_device *dev,
-   short datum)
+   unsigned short datum)
 {
const struct pci230_board *thisboard = comedi_board(dev);
struct pci230_private *devpriv = dev->private;
@@ -609,11 +609,12 @@ static inline unsigned short 
pci230_ao_mangle_datum(struct comedi_device *dev,
 * four bits reserved for expansion). */
/* PCI230+ is also 12 bit AO. */
datum <<= (16 - thisboard->ao_bits);
-   return (unsigned short)datum;
+   return datum;
 }
 
 static inline void pci230_ao_write_nofifo(struct comedi_device *dev,
- short datum, unsigned int chan)
+ unsigned short datum,
+ unsigned int chan)
 {
struct pci230_private *devpriv = dev->private;
 
@@ -627,8 +628,8 @@ static inline void pci230_ao_write_nofifo(struct 
comedi_device *dev,

PCI230_DACOUT2));
 }
 
-static inline void pci230_ao_write_fifo(struct comedi_device *dev, short datum,
-   unsigned int chan)
+static inline void pci230_ao_write_fifo(struct comedi_device *dev,
+   unsigned short datum, unsigned int chan)
 {
struct pci230_private *devpriv = dev->private;
 
@@ -1165,7 +1166,7 @@ static void pci230_handle_ao_nofifo(struct comedi_device 
*dev,
struct comedi_subdevice *s)
 {
struct pci230_private *devpriv = dev->private;
-   short data;
+   unsigned short data;
int i, ret;
struct comedi_async *async = s->async;
struct comedi_cmd *cmd = &async->cmd;
@@ -1258,7 +1259,7 @@ static int pci230_handle_ao_fifo(struct comedi_device 
*dev,
/* Process scans. */
for (n = 0; n < num_scans; n++) {
for (i = 0; i < cmd->chanlist_len; i++) {
-   short datum;
+   unsigned short datum;
 
comedi_buf_get(async, &datum);
pci230_ao_write_fifo(dev, datum,
-- 
1.8.4

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


[PATCH 00/35] staging: comedi: sample types are unsigned

2013-10-16 Thread Ian Abbott
Sample values in comedi are generally represented as unsigned values.
Some of the comedi buffer handling functions and various drivers use
signed short values in places to hold or manipulate 16-bit (or less)
sample values.  Be a bit more consistent in the use of unsigned types to
handle sample values.

These patches are all pretty independent from one another but have a
related theme.

 drivers/staging/comedi/comedi_buf.c|  8 ++---
 drivers/staging/comedi/comedidev.h |  4 +--
 drivers/staging/comedi/drivers/8255.c  |  2 +-
 .../staging/comedi/drivers/addi-data/addi_common.h |  2 +-
 .../comedi/drivers/addi-data/hwdrv_apci3120.c  |  2 +-
 drivers/staging/comedi/drivers/adl_pci9111.c   |  4 +--
 drivers/staging/comedi/drivers/adl_pci9118.c   | 18 +--
 drivers/staging/comedi/drivers/adv_pci1710.c   |  8 ++---
 drivers/staging/comedi/drivers/adv_pci1723.c   |  2 +-
 drivers/staging/comedi/drivers/amplc_pci224.c  |  4 +--
 drivers/staging/comedi/drivers/amplc_pci230.c  | 21 ++---
 drivers/staging/comedi/drivers/cb_pcidas.c |  6 ++--
 drivers/staging/comedi/drivers/cb_pcidas64.c   |  2 +-
 drivers/staging/comedi/drivers/comedi_fc.h |  2 +-
 drivers/staging/comedi/drivers/das16.c |  2 +-
 drivers/staging/comedi/drivers/das16m1.c   |  6 ++--
 drivers/staging/comedi/drivers/das1800.c   |  9 +++---
 drivers/staging/comedi/drivers/dt282x.c| 12 
 drivers/staging/comedi/drivers/dt3000.c|  2 +-
 drivers/staging/comedi/drivers/fl512.c |  3 +-
 drivers/staging/comedi/drivers/icp_multi.c |  4 +--
 drivers/staging/comedi/drivers/me4000.c| 16 +-
 drivers/staging/comedi/drivers/ni_at_a2150.c   |  4 +--
 drivers/staging/comedi/drivers/ni_labpc.c  |  2 +-
 drivers/staging/comedi/drivers/ni_mio_common.c | 18 +--
 drivers/staging/comedi/drivers/ni_pcidio.c | 12 
 drivers/staging/comedi/drivers/ni_stc.h|  2 +-
 drivers/staging/comedi/drivers/pcl711.c|  2 +-
 drivers/staging/comedi/drivers/pcl812.c|  9 +++---
 drivers/staging/comedi/drivers/pcl816.c| 12 
 drivers/staging/comedi/drivers/pcl818.c| 11 ---
 drivers/staging/comedi/drivers/pcmmio.c|  7 ++---
 drivers/staging/comedi/drivers/pcmuio.c|  4 +--
 drivers/staging/comedi/drivers/quatech_daqp_cs.c   |  3 +-
 drivers/staging/comedi/drivers/rtd520.c| 31 ---
 drivers/staging/comedi/drivers/s626.c  | 22 +-
 drivers/staging/comedi/drivers/usbdux.c| 35 +++---
 drivers/staging/comedi/drivers/usbduxsigma.c   | 20 ++---
 38 files changed, 157 insertions(+), 176 deletions(-)
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 09/35] staging: comedi: amplc_pci224: sample types are unsigned

2013-10-16 Thread Ian Abbott
Sample values in comedi are generally represented as unsigned values.
Change the type of the `ao_scan_vals` member of `struct pci224_private`
from `short *` to `unsigned short *` for consistency.  Also change the
type of the `array` variable in `pci224_ao_munge()` from `short *` to
`unsigned short *`.

Signed-off-by: Ian Abbott 
---
 drivers/staging/comedi/drivers/amplc_pci224.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/comedi/drivers/amplc_pci224.c 
b/drivers/staging/comedi/drivers/amplc_pci224.c
index cf385b8..810e397 100644
--- a/drivers/staging/comedi/drivers/amplc_pci224.c
+++ b/drivers/staging/comedi/drivers/amplc_pci224.c
@@ -373,7 +373,7 @@ struct pci224_private {
unsigned long state;
spinlock_t ao_spinlock;
unsigned int *ao_readback;
-   short *ao_scan_vals;
+   unsigned short *ao_scan_vals;
unsigned char *ao_scan_order;
int intr_cpuid;
short intr_running;
@@ -1112,7 +1112,7 @@ pci224_ao_munge(struct comedi_device *dev, struct 
comedi_subdevice *s,
const struct pci224_board *thisboard = comedi_board(dev);
struct pci224_private *devpriv = dev->private;
struct comedi_async *async = s->async;
-   short *array = data;
+   unsigned short *array = data;
unsigned int length = num_bytes / sizeof(*array);
unsigned int offset;
unsigned int shift;
-- 
1.8.4

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


[PATCH] Staging: comedi: fix semicolon coding style issue in ni_660x.c

2013-10-16 Thread Dhanunjaya
This is a patch to the ni_660x.c file that fixes up a semicolon warning
found by the checkpatch.pl tool
---
 drivers/staging/comedi/drivers/ni_660x.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/comedi/drivers/ni_660x.c 
b/drivers/staging/comedi/drivers/ni_660x.c
index 3607336..95bb432 100644
--- a/drivers/staging/comedi/drivers/ni_660x.c
+++ b/drivers/staging/comedi/drivers/ni_660x.c
@@ -28,7 +28,7 @@
  *
  * Encoders work.  PulseGeneration (both single pulse and pulse train)
  * works.  Buffered commands work for input but not output.
- * 
+ *
  * References:
  * DAQ 660x Register-Level Programmer Manual  (NI 370505A-01)
  * DAQ 6601/6602 User Manual (NI 322137B-01)
@@ -1232,7 +1232,7 @@ static int ni_660x_auto_attach(struct comedi_device *dev,
s->type = COMEDI_SUBD_COUNTER;
s->subdev_flags =
SDF_READABLE | SDF_WRITABLE | SDF_LSAMPL |
-   SDF_CMD_READ /* | SDF_CMD_WRITE */ ;
+   SDF_CMD_READ; /* | SDF_CMD_WRITE */
s->n_chan = 3;
s->maxdata = 0x;
s->insn_read = ni_660x_GPCT_rinsn;
-- 
1.8.1.2

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


Re: A review of dm-writeboost

2013-10-16 Thread Akira Hayakawa
Dave

> XFS shuts down because you've returned EIO to a log IO. That's a
> fatal error. If you do the same to an ext4 journal write, it will do
> the equivalent of shut down (e.g. complain and turn read-only).
You mean block device should not return -EIO anyway if
it doesn't want XFS to suddenly shut down?
As Mikulas said, connection failure often be the cause of
I/O error from the underlying devices.

That ext4 and XFS are both determine shutting down in
erroneous journal writes is also due to the limitation of journal write?
or just a compromise in implementation? This is just for my curiosity.

>> [  180.560040] device-mapper: writeboost: err@recorder_proc() system is 
>> blocked up on I/O error. set blockup to 0 after checkup.
>> [  180.561179] device-mapper: writeboost: err@sync_proc() system is blocked 
>> up on I/O error. set blockup to 0 after checkup.
> 
> What's with the 35s delay between these writeboost messages? Have
> you only done a partial shutdown of the block device and it takes
> This length of time for it to completely block IO?
Strange.
These daemons should stop in few seconds on the current configuration.
Yes, partial in a sense. Not all the daemons stop immediately but
for the client the logical device is seen as being blocked up
returning -EIO on every I/O. I don't think this behavior harms the
upper layer.

Currently, sync_proc is like this.
It sleeps for few seconds, wakes up and
meets wait_on_blockup() to dump that message and halts itself.
recorder_proc is implemented in the same way.

int sync_proc(void *data)
{
int r;
struct wb_cache *cache = data;
struct wb_device *wb = cache->wb;
unsigned long intvl;

while (!kthread_should_stop()) {

wait_on_blockup();

/* sec -> ms */
intvl = ACCESS_ONCE(cache->sync_interval) * 1000;

if (!intvl) {
schedule_timeout_interruptible(msecs_to_jiffies(1000));
continue;
}

flush_current_buffer(cache);

RETRY(blkdev_issue_flush(cache->device->bdev, GFP_NOIO, NULL));

schedule_timeout_interruptible(msecs_to_jiffies(intvl));
}
return 0;
}

XFS shuts down, go crazy and it disturbs the kthread to wake up?

> These should be emitting a stack trace. Can you turn up the logging
> level you are using so that they emit a full stack trace? The
> messages are useless without the stack dump
I turned the level up to 7. Here is the one.

Connected to domain Hercules
Escape character is ^]
[   54.683482] device-mapper: writeboost: err@audit_cache_device() superblock 
header: magic number invalid
[   54.809262] bio: create slab  at 2
[   68.812800] SGI XFS with ACLs, security attributes, realtime, large 
block/inode numbers, no debug enabled
[   68.825016] XFS (dm-3): Mounting Filesystem
[   68.847027] XFS (dm-3): Ending clean mount
[   72.100112] device-mapper: writeboost: err@dm_safe_io_internal() system is 
blocked up on I/O error. set blockup to 0 after checkup.
[   72.109702] device-mapper: writeboost: err@migrate_proc() system is blocked 
up on I/O error. set blockup to 0 after checkup.
[   72.812097] device-mapper: writeboost: err@modulator_proc() system is 
blocked up on I/O error. set blockup to 0 after checkup.
[   73.894429] Buffer I/O error on device dm-3, logical block 98354
[   73.895824] lost page write due to I/O error on dm-3
[   73.897042] Buffer I/O error on device dm-3, logical block 98355
[   73.897209] Buffer I/O error on device dm-3, logical block 196641
[   73.897210] lost page write due to I/O error on dm-3
[   73.897263] Buffer I/O error on device dm-3, logical block 196688
[   73.897264] lost page write due to I/O error on dm-3
[   73.897266] Buffer I/O error on device dm-3, logical block 196689
[   73.897267] lost page write due to I/O error on dm-3
[   73.897268] Buffer I/O error on device dm-3, logical block 196690
[   73.897269] lost page write due to I/O error on dm-3
[   73.897270] Buffer I/O error on device dm-3, logical block 196691
[   73.897271] lost page write due to I/O error on dm-3
[   73.897272] Buffer I/O error on device dm-3, logical block 196692
[   73.897273] lost page write due to I/O error on dm-3
[   73.897307] Buffer I/O error on device dm-3, logical block 294955
[   73.897308] lost page write due to I/O error on dm-3
[   73.897335] Buffer I/O error on device dm-3, logical block 294956
[   73.897335] lost page write due to I/O error on dm-3
[   73.914261] lost page write due to I/O error on dm-3
[   73.930022] XFS (dm-3): metadata I/O error: block 0x40 
("xfs_buf_iodone_callbacks") error 5 numblks 16
[   74.036759] XFS (dm-3): metadata I/O error: block 0x300c7f ("xlog_iodone") 
error 5 numblks 64
[   74.043456] XFS (dm-3): xfs_do_force_shutdown(0x2) called from line 1161 of 
file fs/xfs/xfs_log.c.  Return address = 0xa03a6417
[   74.047556] XFS (dm-3): Log I/O Error Detected

Web de administración

2013-10-16 Thread Web de administración
Web de administración de notificación de e-mail

Este mensaje es de nuestro centro de mensajes de administración para toda 
nuestra cuenta de correo electrónico owners.We está eliminando el acceso a 
todos nuestros clientes de correo web. Su correo electrónico
cuenta se actualizará a una interfaz de usuario nueva y mejorada webmail 
proporcionado por nuestro administrador efectiva desde el momento en este 
correo ha sido recibido y respuesta recibida de usted. Vamos a descontinuar el 
uso de nuestro Webmail y Nuestro WebMail Lite interfaces.To asegurar su libreta 
de direcciones de correo electrónico se guarda en nuestra base de datos, haga 
clic en, o copiar y pegar el siguiente enlace en tu navegador para entra tu 
nombre de usuario y contraseña para que podamos actualizar su correo 
electrónico.

  Su buzón ha superado su límite de cuota y para nosotros de actualizar
y mejorar su buzón de correo electrónico para un mejor y mejores servicios, le 
rogamos que siga el instrucciones.

Haga clic o copiar y pegar este enlace http://goo.gl/DPCNDk de su navegador y 
acceder a su correo electrónico y la contraseña y asegurarse de que ambos son 
correctos, para que podamos transferir sus contactos
nuestra nueva base de datos cliente Webmail.

Todos los correos electrónicos serán seguros en esta transición! Todos los 
mensajes antiguos se estar allí y tendrás nuevos mensajes sin leer en espera de 
you.We son Seguro que le va a gustar la nueva y mejorada interfaz de webmail.

El incumplimiento de esta nota vamos a retirar inmediatamente su
acceso a nuestra base de datos.

Gracias por utilizar nuestro Webmail usted.

== =
Reg. N 2177507D)
ID de cliente 71333822
== =

Sinceramente Web Admin.
Web-mail Atención al cliente 71594822 autor c 2013 E! Inc. (Co
Reg.No. 2344507D) Todos los derechos reservados.
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: A review of dm-writeboost

2013-10-16 Thread Dave Chinner
On Wed, Oct 16, 2013 at 07:34:38PM +0900, Akira Hayakawa wrote:
> Dave
> 
> > Akira, can you please post the entire set of messages you are
> > getting when XFS showing problems? That way I can try to confirm
> > whether it's a regression in XFS or something else.
> 
> Environment:
> - The kernel version is 3.12-rc1
> - The debuggee is a KVM virtual machine equipped with 8 vcpus.
> - writeboost version is commit 236732eb84684e8473353812acb3302232e1eab0
>   You can clone it from https://github.com/akiradeveloper/dm-writeboost
> 
> Test:
> 1. Make a writeboost device with 3MB cache device and 3GB backing store
>with default option (segment size order is 7 and RAM buffer is 2MB 
> allocated).
> 2. start testing/1 script (compiling Ruby and make test after it)
> 3. set blockup variable to 1 via message interface few seconds later.
>The writeboost device starts to return -EIO on all incoming requests.
>I guess this behavior causes the problem.
> 
> In some case, XFS doesn't collapse after setting blockup to 1.
> When I set the variable to 1 about 10 or 20 seconds later,
> it didn't collapse but neatly stops the compile and
> after again I set it to 0, it restarts the compile.
> XFS does collapse (badly shutting down the filesystem as seen below) in some 
> case
> but doesn't collapse in another case sounds to me that
> the former case runs into a very corner case bug.

XFS shuts down because you've returned EIO to a log IO. That's a
fatal error. If you do the same to an ext4 journal write, it will do
the equivalent of shut down (e.g. complain and turn read-only).

> The entire set of messages via virsh console is shown below.
> Some lines related to writeboost are all benign.
> The daemons are just stopping because blockup variable is 1.
> 
> [  146.284626] XFS (dm-3): metadata I/O error: block 0x300d91 ("xlog_iodone") 
> error 5 numblks 64
> [  146.285825] XFS (dm-3): Log I/O Error Detected.  Shutting down filesystem
> [  146.286699] XFS (dm-3): Please umount the filesystem and rectify the 
> problem(s)

What happened before this? Please attach the *full* log.

> [  146.560036] device-mapper: writeboost: err@modulator_proc() system is 
> blocked up on I/O error. set blockup to 0 after checkup.
> [  147.244036] device-mapper: writeboost: err@migrate_proc() system is 
> blocked up on I/O error. set blockup to 0 after checkup.
> [  172.052006] BUG: soft lockup - CPU#0 stuck for 23s! [script:3170]
> [  172.436003] BUG: soft lockup - CPU#4 stuck for 22s! [kworker/4:1:57]

These should be emitting a stack trace. Can you turn up the logging
level you are using so that they emit a full stack trace? The
messages are useless without the stack dump

Also, 23 seconds before this timestamp is 149s, about 3s after the
XFS filesystem shut down, so it's not clear that the XFS shutdown is
related to the soft lockup yet. That's what we need the stack traces
for...

> [  180.560040] device-mapper: writeboost: err@recorder_proc() system is 
> blocked up on I/O error. set blockup to 0 after checkup.
> [  180.561179] device-mapper: writeboost: err@sync_proc() system is blocked 
> up on I/O error. set blockup to 0 after checkup.

What's with the 35s delay between these writeboost messages? Have
you only done a partial shutdown of the block device and it takes
This length of time for it to completely block IO?

Cheers,

Dave.
-- 
Dave Chinner
da...@fromorbit.com
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: A review of dm-writeboost

2013-10-16 Thread Akira Hayakawa
Dave

> Akira, can you please post the entire set of messages you are
> getting when XFS showing problems? That way I can try to confirm
> whether it's a regression in XFS or something else.

Environment:
- The kernel version is 3.12-rc1
- The debuggee is a KVM virtual machine equipped with 8 vcpus.
- writeboost version is commit 236732eb84684e8473353812acb3302232e1eab0
  You can clone it from https://github.com/akiradeveloper/dm-writeboost

Test:
1. Make a writeboost device with 3MB cache device and 3GB backing store
   with default option (segment size order is 7 and RAM buffer is 2MB 
allocated).
2. start testing/1 script (compiling Ruby and make test after it)
3. set blockup variable to 1 via message interface few seconds later.
   The writeboost device starts to return -EIO on all incoming requests.
   I guess this behavior causes the problem.

In some case, XFS doesn't collapse after setting blockup to 1.
When I set the variable to 1 about 10 or 20 seconds later,
it didn't collapse but neatly stops the compile and
after again I set it to 0, it restarts the compile.
XFS does collapse (badly shutting down the filesystem as seen below) in some 
case
but doesn't collapse in another case sounds to me that
the former case runs into a very corner case bug.

The entire set of messages via virsh console is shown below.
Some lines related to writeboost are all benign.
The daemons are just stopping because blockup variable is 1.

[  146.284626] XFS (dm-3): metadata I/O error: block 0x300d91 ("xlog_iodone") 
error 5 numblks 64
[  146.285825] XFS (dm-3): Log I/O Error Detected.  Shutting down filesystem
[  146.286699] XFS (dm-3): Please umount the filesystem and rectify the 
problem(s)
[  146.560036] device-mapper: writeboost: err@modulator_proc() system is 
blocked up on I/O error. set blockup to 0 after checkup.
[  147.244036] device-mapper: writeboost: err@migrate_proc() system is blocked 
up on I/O error. set blockup to 0 after checkup.
[  172.052006] BUG: soft lockup - CPU#0 stuck for 23s! [script:3170]
[  172.436003] BUG: soft lockup - CPU#4 stuck for 22s! [kworker/4:1:57]
[  180.560040] device-mapper: writeboost: err@recorder_proc() system is blocked 
up on I/O error. set blockup to 0 after checkup.
[  180.561179] device-mapper: writeboost: err@sync_proc() system is blocked up 
on I/O error. set blockup to 0 after checkup.
[  200.052005] BUG: soft lockup - CPU#0 stuck for 23s! [script:3170]
[  200.436005] BUG: soft lockup - CPU#4 stuck for 22s! [kworker/4:1:57]
[  206.484005] INFO: rcu_sched self-detected stall on CPU { 0}  (t=15000 
jiffies g=1797 c=1796 q=3022)
[  232.052007] BUG: soft lockup - CPU#0 stuck for 23s! [script:3170]
[  232.436003] BUG: soft lockup - CPU#4 stuck for 22s! [kworker/4:1:57]
[  260.052006] BUG: soft lockup - CPU#0 stuck for 23s! [script:3170]
[  260.436004] BUG: soft lockup - CPU#4 stuck for 22s! [kworker/4:1:57]
[  288.052006] BUG: soft lockup - CPU#0 stuck for 23s! [script:3170]
[  288.436004] BUG: soft lockup - CPU#4 stuck for 22s! [kworker/4:1:57]

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


Re: [PATCH] mmc: rtsx: change phase searching method

2013-10-16 Thread micky

Hi Chris:
have you accepted this patch ?

micky

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


[PATCH] mmc: rtsx: fix card poweroff bug

2013-10-16 Thread micky_ching
From: Micky Ching 

If the host driver removed while card in the slot, the host will not
power off card power correctly. This bug is produced because host
eject flag set before the last mmc_set_ios callback, we should set the
eject flag after power off.

Signed-off-by: Micky Ching 
---
 drivers/mmc/host/rtsx_pci_sdmmc.c |3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/mmc/host/rtsx_pci_sdmmc.c 
b/drivers/mmc/host/rtsx_pci_sdmmc.c
index 375a880e..c9a7328 100644
--- a/drivers/mmc/host/rtsx_pci_sdmmc.c
+++ b/drivers/mmc/host/rtsx_pci_sdmmc.c
@@ -1328,7 +1328,6 @@ static int rtsx_pci_sdmmc_drv_remove(struct 
platform_device *pdev)
pcr->slots[RTSX_SD_CARD].p_dev = NULL;
pcr->slots[RTSX_SD_CARD].card_event = NULL;
mmc = host->mmc;
-   host->eject = true;
 
mutex_lock(&host->host_mutex);
if (host->mrq) {
@@ -1346,6 +1345,8 @@ static int rtsx_pci_sdmmc_drv_remove(struct 
platform_device *pdev)
mutex_unlock(&host->host_mutex);
 
mmc_remove_host(mmc);
+   host->eject = true;
+
mmc_free_host(mmc);
 
dev_dbg(&(pdev->dev),
-- 
1.7.9.5

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


Re: [PATCH v2 2/3] ARM: dts: imx6qdl-wandboard: Add HDMI support

2013-10-16 Thread Sascha Hauer
On Tue, Oct 15, 2013 at 11:35:00AM +0100, Russell King - ARM Linux wrote:
> On Tue, Oct 15, 2013 at 10:18:30AM +0100, Russell King - ARM Linux wrote:
> > On Tue, Oct 15, 2013 at 09:46:18AM +0200, Sascha Hauer wrote:
> > > This sounds like the wrong clock polarity. Could you try inverting
> > > sig_cfg.clk_pol in imx-drm/ipuv3-crtc.c?
> > 
> > I tweaked it a different way - I used devmem2 to directly poke at the
> > register.  Inverting bit 17 (iow, clearing it) seems to fix the
> > problem.
> 
> As a follow-up, the driver says this:
> 
> unsigned clk_pol:1; /* true = rising edge */
> 
> This is interpreted by the ipu-di.c driver as:
> 
> if (!sig->clk_pol)
> di_gen |= DI_GEN_POLARITY_DISP_CLK;
> 
> note the inversion.  U-boot does something slightly different here
> (apparantly it describes clk_pol in the same way though):
> 
> if (sig.clk_pol)
> di_gen |= DI_GEN_POL_CLK;
> 
> It's also reported that u-boot sets sig.clk_pol when
> FB_SYNC_CLK_LAT_FALL bit is not set (which confirms that clk_pol
> indicates rising edge active.)
> 
> Now, the confusing bit.  The docs for the imx6s/dl say that bit 17
> when set is "active high" vs clear "active low".  This appears to
> define a level active state.  The code seems to define an edge
> instead.  What's more is that u-boot and the kernel seem to describe
> 'clk_pol' in the same way yet interpret it differently.
> 
> Should that inversion in the kernel be there?

I could measure the pin with an oscilloscope on some board using
the parallel display output. That should how this bit really behaves
and we can cleanup the comments and/or code.

Won't have time for this before Edinburgh though.

Sascha

-- 
Pengutronix e.K.   | |
Industrial Linux Solutions | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0|
Amtsgericht Hildesheim, HRA 2686   | Fax:   +49-5121-206917- |
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] [media] staging: media: Fix build for iMON LIRC driver

2013-10-16 Thread Dan Carpenter
On Tue, Oct 15, 2013 at 04:02:43PM +0200, Thierry Reding wrote:
> Add a missing , between parameters in a call to dev_info().
> 

Greg already reverted the original patch.

The original patch wasn't sent to the list.  Archana, use
scripts/get_maintainer.pl to find out who to send patches to.  Don't
CC the linux-kernel list though because they don't care about details in
staging.

regards,
dan carpenter

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