Linux Framebuffer Layer development
 help / color / mirror / Atom feed
* Re: [PATCH] staging: sm750fb: Cleanup the type of mmio750
From: Dan Carpenter @ 2015-03-10 11:40 UTC (permalink / raw)
  To: Lorenzo Stoakes
  Cc: sudipm.mukherjee, teddy.wang, gregkh, devel, linux-fbdev,
	linux-kernel
In-Reply-To: <1425981426-20680-1-git-send-email-lstoakes@gmail.com>

On Tue, Mar 10, 2015 at 09:57:06AM +0000, Lorenzo Stoakes wrote:
> This patch assigns the more appropriate void* type to the mmio750 variable
> eliminating an unnecessary volatile qualifier in the process. Additionally it
> updates parameter types as necessary where those parameters interact with
> mmio750 and removes unnecessary casts.
> 
> As a consequence, this patch fixes the following sparse warning:-
> 
> drivers/staging/sm750fb/ddk750_help.c:12:17: warning: incorrect type in assignment (different address spaces)
> 
> Signed-off-by: Lorenzo Stoakes <lstoakes@gmail.com>

Looks good.  Thanks for doing this.

regards,
dan carpenter


^ permalink raw reply

* Re: [PATCH v2] video: mxsfb: Make sure axi clock is enabled when accessing registers
From: Tomi Valkeinen @ 2015-03-10 12:02 UTC (permalink / raw)
  To: Liu Ying, linux-fbdev
  Cc: Peter Chen, Jean-Christophe Plagniol-Villard, Fabio Estevam,
	Greg Kroah-Hartman, linux-kernel, stable
In-Reply-To: <1425452771-19313-1-git-send-email-Ying.Liu@freescale.com>

[-- Attachment #1: Type: text/plain, Size: 4555 bytes --]

On 04/03/15 09:06, Liu Ying wrote:
> The LCDIF engines embedded in i.MX6sl and i.MX6sx SoCs need the axi clock
> as the engine's system clock.  The clock should be enabled when accessing
> LCDIF registers, otherwise the kernel would hang up.  We should also keep
> the clock being enabled when the engine is being active to scan out frames

The text above is a bit confusing. Maybe just "... also keep the clock
enabled when..."

> from memory.  This patch makes sure the axi clock is enabled when accessing
> registers so that the kernel hang up issue can be fixed.
> 
> Reported-by: Peter Chen <peter.chen@freescale.com>
> Tested-by: Peter Chen <peter.chen@freescale.com>
> Cc: <stable@vger.kernel.org> # 3.19+
> Signed-off-by: Liu Ying <Ying.Liu@freescale.com>
> ---
> v1->v2:
> * Add 'Tested-by: Peter Chen <peter.chen@freescale.com>' tag.
> * Add 'Cc: <stable@vger.kernel.org> # 3.19+' tag.
> 
>  drivers/video/fbdev/mxsfb.c | 70 ++++++++++++++++++++++++++++++++++++---------
>  1 file changed, 56 insertions(+), 14 deletions(-)
> 
> diff --git a/drivers/video/fbdev/mxsfb.c b/drivers/video/fbdev/mxsfb.c
> index f8ac4a4..a8cf3b2 100644
> --- a/drivers/video/fbdev/mxsfb.c
> +++ b/drivers/video/fbdev/mxsfb.c
> @@ -316,6 +316,18 @@ static int mxsfb_check_var(struct fb_var_screeninfo *var,
>  	return 0;
>  }
>  
> +static inline void mxsfb_enable_axi_clk(struct mxsfb_info *host)
> +{
> +	if (host->clk_axi)
> +		clk_prepare_enable(host->clk_axi);
> +}
> +
> +static inline void mxsfb_disable_axi_clk(struct mxsfb_info *host)
> +{
> +	if (host->clk_axi)
> +		clk_disable_unprepare(host->clk_axi);
> +}
> +
>  static void mxsfb_enable_controller(struct fb_info *fb_info)
>  {
>  	struct mxsfb_info *host = to_imxfb_host(fb_info);
> @@ -333,14 +345,13 @@ static void mxsfb_enable_controller(struct fb_info *fb_info)
>  		}
>  	}
>  
> -	if (host->clk_axi)
> -		clk_prepare_enable(host->clk_axi);
> -
>  	if (host->clk_disp_axi)
>  		clk_prepare_enable(host->clk_disp_axi);
>  	clk_prepare_enable(host->clk);
>  	clk_set_rate(host->clk, PICOS2KHZ(fb_info->var.pixclock) * 1000U);
>  
> +	mxsfb_enable_axi_clk(host);
> +

Is there some reason to move the clk enable to a different place here?

>  	/* if it was disabled, re-enable the mode again */
>  	writel(CTRL_DOTCLK_MODE, host->base + LCDC_CTRL + REG_SET);
>  
> @@ -380,11 +391,11 @@ static void mxsfb_disable_controller(struct fb_info *fb_info)
>  	reg = readl(host->base + LCDC_VDCTRL4);
>  	writel(reg & ~VDCTRL4_SYNC_SIGNALS_ON, host->base + LCDC_VDCTRL4);
>  
> +	mxsfb_disable_axi_clk(host);
> +
>  	clk_disable_unprepare(host->clk);
>  	if (host->clk_disp_axi)
>  		clk_disable_unprepare(host->clk_disp_axi);
> -	if (host->clk_axi)
> -		clk_disable_unprepare(host->clk_axi);

And same here for disable.

>  	host->enabled = 0;
>  
> @@ -421,6 +432,8 @@ static int mxsfb_set_par(struct fb_info *fb_info)
>  		mxsfb_disable_controller(fb_info);
>  	}
>  
> +	mxsfb_enable_axi_clk(host);
> +
>  	/* clear the FIFOs */
>  	writel(CTRL1_FIFO_CLEAR, host->base + LCDC_CTRL1 + REG_SET);
>  
> @@ -438,6 +451,7 @@ static int mxsfb_set_par(struct fb_info *fb_info)
>  		ctrl |= CTRL_SET_WORD_LENGTH(3);
>  		switch (host->ld_intf_width) {
>  		case STMLCDIF_8BIT:
> +			mxsfb_disable_axi_clk(host);
>  			dev_err(&host->pdev->dev,
>  					"Unsupported LCD bus width mapping\n");
>  			return -EINVAL;
> @@ -451,6 +465,7 @@ static int mxsfb_set_par(struct fb_info *fb_info)
>  		writel(CTRL1_SET_BYTE_PACKAGING(0x7), host->base + LCDC_CTRL1);
>  		break;
>  	default:
> +		mxsfb_disable_axi_clk(host);
>  		dev_err(&host->pdev->dev, "Unhandled color depth of %u\n",
>  				fb_info->var.bits_per_pixel);
>  		return -EINVAL;
> @@ -504,6 +519,8 @@ static int mxsfb_set_par(struct fb_info *fb_info)
>  			fb_info->fix.line_length * fb_info->var.yoffset,
>  			host->base + host->devdata->next_buf);
>  
> +	mxsfb_disable_axi_clk(host);
> +
>  	if (reenable)
>  		mxsfb_enable_controller(fb_info);
>  
> @@ -582,10 +599,16 @@ static int mxsfb_pan_display(struct fb_var_screeninfo *var,
>  
>  	offset = fb_info->fix.line_length * var->yoffset;
>  
> +	if (!host->enabled)
> +		mxsfb_enable_axi_clk(host);
> +
>  	/* update on next VSYNC */
>  	writel(fb_info->fix.smem_start + offset,
>  			host->base + host->devdata->next_buf);
>  
> +	if (!host->enabled)
> +		mxsfb_disable_axi_clk(host);
> +

Why do you check for host->enabled here, but not elsewhere?

 Tomi



[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply

* Re: [PATCH,RESEND] framebuffer: don't link fb_devio into kernel image unconditionally
From: Tomi Valkeinen @ 2015-03-10 12:18 UTC (permalink / raw)
  To: linux-fbdev
In-Reply-To: <E1YSma9-0001JA-6C@stardust.g4.wien.funkfeuer.at>

[-- Attachment #1: Type: text/plain, Size: 1854 bytes --]

On 03/03/15 15:09, Harald Geyer wrote:
> CONFIG_FB_DEFERRED_IO is defined as bool while CONFIG_FB is defined as
> tristate. Currently fb_defio.o is linked into the kernel image even if
> CONFIG_FB=m. 
> 
> I fix this by updating the Makefile to link fb_defio.o into fb.o and thus
> go into one place with the other core framebuffer code.
> 
> This has been tested on arm/sunxi and arm/mxs.
> 
> Signed-off-by: Harald Geyer <harald@ccbib.org>
> ---
> Resending this patch as I didn't get any reply for over two weeks.
> 
>  drivers/video/fbdev/core/Makefile | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/video/fbdev/core/Makefile b/drivers/video/fbdev/core/Makefile
> index 67f28e2..23d86a8 100644
> --- a/drivers/video/fbdev/core/Makefile
> +++ b/drivers/video/fbdev/core/Makefile
> @@ -3,6 +3,7 @@ obj-$(CONFIG_FB_CMDLINE)          += fb_cmdline.o
>  obj-$(CONFIG_FB)                  += fb.o
>  fb-y                              := fbmem.o fbmon.o fbcmap.o fbsysfs.o \
>                                       modedb.o fbcvt.o
> +fb-$(CONFIG_FB_DEFERRED_IO)       += fb_defio.o
>  fb-objs                           := $(fb-y)
>  
>  obj-$(CONFIG_FB_CFB_FILLRECT)  += cfbfillrect.o
> @@ -14,4 +15,3 @@ obj-$(CONFIG_FB_SYS_IMAGEBLIT) += sysimgblt.o
>  obj-$(CONFIG_FB_SYS_FOPS)      += fb_sys_fops.o
>  obj-$(CONFIG_FB_SVGALIB)       += svgalib.o
>  obj-$(CONFIG_FB_DDC)           += fb_ddc.o
> -obj-$(CONFIG_FB_DEFERRED_IO)   += fb_defio.o

I think this change makes sense. An alternative would be to make
fb_defio tristate, but as fb.ko uses fb_defio, fb_defio will always be
loaded if fb is used. And I don't think fb_defio.ko can be used alone,
without fb.ko.

But if you do link fb_defio into fb.ko, I think you need to remove
MODULE_LICENSE() from fb_defio.

 Tomi



[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply

* Re: [PATCH 03/15] fbdev: aty128fb: replace PPC_OF with PPC
From: Tomi Valkeinen @ 2015-03-10 12:23 UTC (permalink / raw)
  To: Kevin Hao, Benjamin Herrenschmidt
  Cc: linux-fbdev, Jean-Christophe Plagniol-Villard, linuxppc-dev,
	Paul Mackerras
In-Reply-To: <20150227010549.GA10596@pek-khao-d1.corp.ad.wrs.com>

[-- Attachment #1: Type: text/plain, Size: 999 bytes --]

On 27/02/15 03:05, Kevin Hao wrote:
> On Fri, Feb 27, 2015 at 11:11:15AM +1100, Benjamin Herrenschmidt wrote:
>> On Sat, 2015-01-31 at 21:47 +0800, Kevin Hao wrote:
>>> The PPC_OF is a ppc specific option which is used to mean that the
>>> firmware device tree access functions are available. Since all the
>>> ppc platforms have a device tree, it is aways set to 'y' for ppc.
>>> So it makes no sense to keep a such option in the current kernel.
>>> Replace it with PPC.
>>>
>>> Signed-off-by: Kevin Hao <haokexin@gmail.com>
>>
>> For this and generally the whole series,
>>
>> Acked-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
> 
> Thanks Ben.
> 
>>
>> Which tree do we expect this to go through ?
> 
> I just sent out a v2 [1] a few hours earlier with some minor updates. We plan
> to merge this patch series via the powerpc tree in 4.1 cycle if I can collect
> all the acks from the corresponding driver maintainers.

Fbdev changes look ok to me.

 Tomi



[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply

* Re: [PATCH v2] video: fbdev: use msecs_to_jiffies for time conversions
From: Tomi Valkeinen @ 2015-03-10 12:32 UTC (permalink / raw)
  To: Nicholas Mc Guire, Jean-Christophe Plagniol-Villard
  Cc: Jingoo Han, Daniel Vetter, Fabian Frederick, Laurent Pinchart,
	Wolfram Sang, linux-fbdev, linux-kernel
In-Reply-To: <1424442841-25466-1-git-send-email-hofrat@osadl.org>

[-- Attachment #1: Type: text/plain, Size: 894 bytes --]

On 20/02/15 16:34, Nicholas Mc Guire wrote:
> This is only an API consolidation and should make things more readable by
> replacing  var * HZ / 1000  by msecs_to_jiffies(var).
> 
> Signed-off-by: Nicholas Mc Guire <hofrat@osadl.org>
> ---
> 
> v2: fixed missing closing parenthesis in pxafb_disable_controller.
>     Compile testing was missing part of the patched code due to
>     the missing CONFIG_FB_PXA_SMARTPANEL=y, so the missing closing
>     parenthesis reported by Tomi Valkeinen <tomi.valkeinen@ti.com>
>     pxafb_disable_controller went unnoticed.
> 
> Patch was only compile tested with viper_defconfig CONFIG_FB_PXA=m,
> CONFIG_FB_PXA_SMARTPANEL=y
> 
> Patch is against 3.19.0 (localversion-next is -next-20150220)
> 
>  drivers/video/fbdev/pxafb.c |    6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 

Thanks, queued for 4.1.

 Tomi



[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply

* Re: [PATCH 2/3 v3] hyperv: hyperv_fb.c: match wait_for_completion_timeout return type
From: Tomi Valkeinen @ 2015-03-10 12:38 UTC (permalink / raw)
  To: Nicholas Mc Guire, K. Y. Srinivasan
  Cc: Haiyang Zhang, Jean-Christophe Plagniol-Villard, devel,
	linux-fbdev, linux-kernel
In-Reply-To: <1422527056-24929-1-git-send-email-der.herr@hofr.at>

[-- Attachment #1: Type: text/plain, Size: 1678 bytes --]

On 29/01/15 12:24, Nicholas Mc Guire wrote:
> The return type of wait_for_completion_timeout is unsigned long not
> int. This patch fixes up the declarations only.
> 
> Signed-off-by: Nicholas Mc Guire <der.herr@hofr.at>
> ---
> 
> v2: fixed subject line
> v3: fixed patch description as recommended by Dan Carpenter
>     <dan.carpenter@oracle.com>
> 
> Patch was compile tested only for x86_64_defconfig + CONFIG_X86_VSMP=y
> CONFIG_HYPERV=m, CONFIG_FB_HYPERV=m
> 
> Patch is against 3.19.0-rc5 -next-20150123
> 
>  drivers/video/fbdev/hyperv_fb.c |    6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/video/fbdev/hyperv_fb.c b/drivers/video/fbdev/hyperv_fb.c
> index 4254336..807ee22 100644
> --- a/drivers/video/fbdev/hyperv_fb.c
> +++ b/drivers/video/fbdev/hyperv_fb.c
> @@ -415,7 +415,8 @@ static int synthvid_negotiate_ver(struct hv_device *hdev, u32 ver)
>  	struct fb_info *info = hv_get_drvdata(hdev);
>  	struct hvfb_par *par = info->par;
>  	struct synthvid_msg *msg = (struct synthvid_msg *)par->init_buf;
> -	int t, ret = 0;
> +	int ret = 0;
> +	unsigned long t;
>  
>  	memset(msg, 0, sizeof(struct synthvid_msg));
>  	msg->vid_hdr.type = SYNTHVID_VERSION_REQUEST;
> @@ -488,7 +489,8 @@ static int synthvid_send_config(struct hv_device *hdev)
>  	struct fb_info *info = hv_get_drvdata(hdev);
>  	struct hvfb_par *par = info->par;
>  	struct synthvid_msg *msg = (struct synthvid_msg *)par->init_buf;
> -	int t, ret = 0;
> +	int ret = 0;
> +	unsigned long t;
>  
>  	/* Send VRAM location */
>  	memset(msg, 0, sizeof(struct synthvid_msg));
> 

Thanks, queued for 4.1.

 Tomi



[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply

* Re: [PATCH] video: treat signal like timeout as failure
From: Tomi Valkeinen @ 2015-03-10 12:43 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <1421731430-13207-1-git-send-email-der.herr@hofr.at>

[-- Attachment #1: Type: text/plain, Size: 1232 bytes --]

On 20/01/15 07:23, Nicholas Mc Guire wrote:
> if(!wait_for_completion_interruptible_timeout(...))
> only handles the timeout case - this patch adds handling the
> signal case the same as timeout and cleans up.
> 
> Signed-off-by: Nicholas Mc Guire <der.herr@hofr.at>
> ---
> 
> Only the timeout case was being handled, return of 0 in 
> wait_for_completion_interruptible_timeout, the signal case (-ERESTARTSYS)
> was treated just like the case of successful completion, which is most 
> likely not reasonable.
> 
> Note that exynos_mipi_dsi_wr_data/exynos_mipi_dsi_rd_data return values
> are not checked at the call sites in s6e8ax0.c (cmd_read/cmd_write)!
> 
> This patch simply treats the signal case the same way as the timeout case,
> by releasing locks and returning 0 - which might not be the right thing to
> do - this needs a review by someone knowing the details of this driver.

While I agree that this patch is a bit better than the current state,
the code still looks wrong as Russell said.

I can merge this, but I'd rather have someone from Samsung look at the
code and change it to use wait_for_completion_killable_timeout() if
that's what this code is really supposed to use.

 Tomi



[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply

* Re: [patch] fbdev: pm3fb: cleanup some confusing indenting
From: Tomi Valkeinen @ 2015-03-10 12:47 UTC (permalink / raw)
  To: linux-fbdev

[-- Attachment #1: Type: text/plain, Size: 896 bytes --]

On 25/02/15 15:25, Dan Carpenter wrote:
> This if statement should be pushed out one tab to line up with the rest.
> 
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> 
> diff --git a/drivers/video/fbdev/pm3fb.c b/drivers/video/fbdev/pm3fb.c
> index 4bf3273..77b99ed 100644
> --- a/drivers/video/fbdev/pm3fb.c
> +++ b/drivers/video/fbdev/pm3fb.c
> @@ -1479,9 +1479,9 @@ static void pm3fb_remove(struct pci_dev *dev)
>  		fb_dealloc_cmap(&info->cmap);
>  
>  #ifdef CONFIG_MTRR
> -	if (par->mtrr_handle >= 0)
> -		mtrr_del(par->mtrr_handle, info->fix.smem_start,
> -			 info->fix.smem_len);
> +		if (par->mtrr_handle >= 0)
> +			mtrr_del(par->mtrr_handle, info->fix.smem_start,
> +				 info->fix.smem_len);
>  #endif /* CONFIG_MTRR */
>  		iounmap(info->screen_base);
>  		release_mem_region(fix->smem_start, fix->smem_len);

Thanks, queued for 4.1.

 Tomi



[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply

* Re: [PATCH] staging: sm750fb: Cleanup the type of mmio750
From: Lorenzo Stoakes @ 2015-03-10 12:47 UTC (permalink / raw)
  To: Sudip Mukherjee
  Cc: Dan Carpenter, teddy.wang, Greg KH, devel, linux-fbdev,
	linux-kernel
In-Reply-To: <20150310123633.GA2782@sudip-PC>

On 10 March 2015 at 12:36, Sudip Mukherjee <sudipm.mukherjee@gmail.com> wrote:
> but it is introducing two new build warnings:
>
> drivers/staging/sm750fb/sm750_hw.c: In function ‘hw_sm750_map’:
> drivers/staging/sm750fb/sm750_hw.c:67:2: warning: passing argument 1 of ‘ddk750_set_mmio’ discards ‘volatile’ qualifier from pointer target type [enabled by default]
> In file included from drivers/staging/sm750fb/ddk750_mode.h:4:0,
>                     from drivers/staging/sm750fb/ddk750.h:15,
>                     from drivers/staging/sm750fb/sm750_hw.c:24:
>
> and
>
> drivers/staging/sm750fb/ddk750_chip.h:77:6: note: expected ‘void *’ but argument is of type ‘volatile unsigned char *’
>
> care to make another patch to solve these two new warnings, and send this patch and the new one in a series and while sending mark the version number in the subject.

I think the second warning is simply additional information attached
to the 1st to give context?

I noticed this issue but felt changing the type of this field would
sit outside the purview of this patch as then I'm not only changing
the type of mmio750 and code that *directly* interacts with this
variable, but also code that indirectly interacts with it, so I felt
that should perhaps be a separate patch.

I'd love to additionally provide some further patches to help out with
issues here too, incidentally! I will try to prepare some further
patches tonight in this vein.

-- 
Lorenzo Stoakes
https:/ljs.io

^ permalink raw reply

* Re: [PATCH] staging: sm750fb: Cleanup the type of mmio750
From: Sudip Mukherjee @ 2015-03-10 12:48 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Lorenzo Stoakes, teddy.wang, gregkh, devel, linux-fbdev,
	linux-kernel
In-Reply-To: <20150310114030.GP10964@mwanda>

On Tue, Mar 10, 2015 at 02:40:30PM +0300, Dan Carpenter wrote:
> On Tue, Mar 10, 2015 at 09:57:06AM +0000, Lorenzo Stoakes wrote:
> > This patch assigns the more appropriate void* type to the mmio750 variable
> > eliminating an unnecessary volatile qualifier in the process. Additionally it
> > updates parameter types as necessary where those parameters interact with
> > mmio750 and removes unnecessary casts.
> > 
> > As a consequence, this patch fixes the following sparse warning:-
> > 
> > drivers/staging/sm750fb/ddk750_help.c:12:17: warning: incorrect type in assignment (different address spaces)
> > 
> > Signed-off-by: Lorenzo Stoakes <lstoakes@gmail.com>
> 
> Looks good.  Thanks for doing this.

but it is introducing two new build warnings:

drivers/staging/sm750fb/sm750_hw.c: In function ‘hw_sm750_map’:
drivers/staging/sm750fb/sm750_hw.c:67:2: warning: passing argument 1 of ‘ddk750_set_mmio’ discards ‘volatile’ qualifier from pointer target type [enabled by default]
In file included from drivers/staging/sm750fb/ddk750_mode.h:4:0,
                    from drivers/staging/sm750fb/ddk750.h:15,
                    from drivers/staging/sm750fb/sm750_hw.c:24:

and

drivers/staging/sm750fb/ddk750_chip.h:77:6: note: expected ‘void *’ but argument is of type ‘volatile unsigned char *’

care to make another patch to solve these two new warnings, and send this patch and the new one in a series and while sending mark the version number in the subject.

regards
sudip
> 
> regards,
> dan carpenter
> 

^ permalink raw reply

* Re: [PATCH] video: treat signal like timeout as failure
From: Nicholas Mc Guire @ 2015-03-10 12:51 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <54FEE70D.3010307@ti.com>

On Tue, 10 Mar 2015, Tomi Valkeinen wrote:

> On 20/01/15 07:23, Nicholas Mc Guire wrote:
> > if(!wait_for_completion_interruptible_timeout(...))
> > only handles the timeout case - this patch adds handling the
> > signal case the same as timeout and cleans up.
> > 
> > Signed-off-by: Nicholas Mc Guire <der.herr@hofr.at>
> > ---
> > 
> > Only the timeout case was being handled, return of 0 in 
> > wait_for_completion_interruptible_timeout, the signal case (-ERESTARTSYS)
> > was treated just like the case of successful completion, which is most 
> > likely not reasonable.
> > 
> > Note that exynos_mipi_dsi_wr_data/exynos_mipi_dsi_rd_data return values
> > are not checked at the call sites in s6e8ax0.c (cmd_read/cmd_write)!
> > 
> > This patch simply treats the signal case the same way as the timeout case,
> > by releasing locks and returning 0 - which might not be the right thing to
> > do - this needs a review by someone knowing the details of this driver.
> 
> While I agree that this patch is a bit better than the current state,
> the code still looks wrong as Russell said.
> 
> I can merge this, but I'd rather have someone from Samsung look at the
> code and change it to use wait_for_completion_killable_timeout() if
> that's what this code is really supposed to use.
>
If someone that knows the details takes care of it
that is of course the best solution. If someone Samsung is 
going to look into it then it is probably best to completly
drop this speculative patch so that this does not lead
to more confusion than it does good.

thx!
hofrat

^ permalink raw reply

* Re: [PATCH] staging: sm750fb: Cleanup the type of mmio750
From: Dan Carpenter @ 2015-03-10 13:06 UTC (permalink / raw)
  To: Lorenzo Stoakes
  Cc: Sudip Mukherjee, teddy.wang, Greg KH, devel, linux-fbdev,
	linux-kernel
In-Reply-To: <CAA5enKZMZDVzEjZG1mccn089MEN3AvSQc+TECc6vMZBKB06TRA@mail.gmail.com>

On Tue, Mar 10, 2015 at 12:47:44PM +0000, Lorenzo Stoakes wrote:
> On 10 March 2015 at 12:36, Sudip Mukherjee <sudipm.mukherjee@gmail.com> wrote:
> > but it is introducing two new build warnings:
> >
> > drivers/staging/sm750fb/sm750_hw.c: In function ‘hw_sm750_map’:
> > drivers/staging/sm750fb/sm750_hw.c:67:2: warning: passing argument 1 of ‘ddk750_set_mmio’ discards ‘volatile’ qualifier from pointer target type [enabled by default]
> > In file included from drivers/staging/sm750fb/ddk750_mode.h:4:0,
> >                     from drivers/staging/sm750fb/ddk750.h:15,
> >                     from drivers/staging/sm750fb/sm750_hw.c:24:
> >
> > and
> >
> > drivers/staging/sm750fb/ddk750_chip.h:77:6: note: expected ‘void *’ but argument is of type ‘volatile unsigned char *’
> >
> > care to make another patch to solve these two new warnings, and send this patch and the new one in a series and while sending mark the version number in the subject.
> 
> I think the second warning is simply additional information attached
> to the 1st to give context?
> 
> I noticed this issue but felt changing the type of this field would
> sit outside the purview of this patch as then I'm not only changing
> the type of mmio750 and code that *directly* interacts with this
> variable, but also code that indirectly interacts with it, so I felt
> that should perhaps be a separate patch.

You should have said that in the patch description or under the ---
cut off.  But anyway, it's not ok.  And we'll need to redo this patch.
Breaking up patches into logical changes is sort of tricky because
everything touches everything else so the patch gets larger and larger.

You could maybe break it up:

[patch 1/2] staging: sm750fb: Cleanup the type of mmio750
	This would add some temporary casting until the rest of the
	code was cleaned up.  It wouldn't touch change the function
	parameters of ddk750_set_mmio().
[patch 2/2] staging: sm750fb: Cleanup the types for ddk750_set_mmio()
	This would change the function paramters and the type for
	->pvReg and remove the temporary casts.

But maybe it's only one line larger than the patch you just send?  In
that case just fold it in and don't do the temporary casting.

The next patch after that could get rid of all the ramaining "volatile"
keywords.

regards,
dan carpenter


^ permalink raw reply

* Re: [PATCH] staging: sm750fb: Cleanup the type of mmio750
From: Lorenzo Stoakes @ 2015-03-10 13:22 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Sudip Mukherjee, teddy.wang, Greg KH, devel, linux-fbdev,
	linux-kernel
In-Reply-To: <20150310130624.GC16501@mwanda>

On 10 March 2015 at 13:06, Dan Carpenter <dan.carpenter@oracle.com> wrote:

> You should have said that in the patch description or under the ---
> cut off.  But anyway, it's not ok.  And we'll need to redo this patch.
> Breaking up patches into logical changes is sort of tricky because
> everything touches everything else so the patch gets larger and larger.
>

Major apologies, I am still getting used to kernel development! I'll
be careful to not make such assumptions in future when it comes to
warnings/errors.

[snip]

> But maybe it's only one line larger than the patch you just send?  In
> that case just fold it in and don't do the temporary casting.
>
> The next patch after that could get rid of all the ramaining "volatile"
> keywords.

It seems that we can in fact fix this problem with a single additional
change, I will submit a v2 shortly.

Best,

-- 
Lorenzo Stoakes
https:/ljs.io

^ permalink raw reply

* [PATCH v2] staging: sm750fb: Cleanup the type of mmio750
From: Lorenzo Stoakes @ 2015-03-10 13:27 UTC (permalink / raw)
  To: sudipm.mukherjee, teddy.wang, gregkh
  Cc: linux-fbdev, devel, linux-kernel, Lorenzo Stoakes

This patch assigns the more appropriate void* type to the mmio750 variable
eliminating an unnecessary volatile qualifier in the process. Additionally it
updates parameter types as necessary where those parameters interact with
mmio750, removes unnecessary casts and updates the type of the
lynx_share->pvReg field which is passed to the ddk750_set_mmio method.

As a consequence, this patch fixes the following sparse warning:-

drivers/staging/sm750fb/ddk750_help.c:12:17: warning: incorrect type in assignment (different address spaces)

Signed-off-by: Lorenzo Stoakes <lstoakes@gmail.com>

---
 drivers/staging/sm750fb/ddk750_chip.h |  4 +++-
 drivers/staging/sm750fb/ddk750_help.c |  4 ++--
 drivers/staging/sm750fb/ddk750_help.h | 10 +++++-----
 drivers/staging/sm750fb/sm750.h       |  2 +-
 4 files changed, 11 insertions(+), 9 deletions(-)

diff --git a/drivers/staging/sm750fb/ddk750_chip.h b/drivers/staging/sm750fb/ddk750_chip.h
index 1c78875..d067b06 100644
--- a/drivers/staging/sm750fb/ddk750_chip.h
+++ b/drivers/staging/sm750fb/ddk750_chip.h
@@ -3,6 +3,8 @@
 #define DEFAULT_INPUT_CLOCK 14318181 /* Default reference clock */
 #define SM750LE_REVISION_ID (char)0xfe
 
+#include <linux/io.h>
+
 /* This is all the chips recognized by this library */
 typedef enum _logical_chip_type_t
 {
@@ -70,7 +72,7 @@ logical_chip_type_t getChipType(void);
 unsigned int calcPllValue(unsigned int request,pll_value_t *pll);
 unsigned int calcPllValue2(unsigned int,pll_value_t *);
 unsigned int formatPllReg(pll_value_t *pPLL);
-void ddk750_set_mmio(volatile unsigned char *,unsigned short,char);
+void ddk750_set_mmio(void __iomem *,unsigned short,char);
 unsigned int ddk750_getVMSize(void);
 int ddk750_initHw(initchip_param_t *);
 unsigned int getPllValue(clock_type_t clockType, pll_value_t *pPLL);
diff --git a/drivers/staging/sm750fb/ddk750_help.c b/drivers/staging/sm750fb/ddk750_help.c
index cc00d2b..c68ff3b 100644
--- a/drivers/staging/sm750fb/ddk750_help.c
+++ b/drivers/staging/sm750fb/ddk750_help.c
@@ -2,12 +2,12 @@
 //#include "ddk750_chip.h"
 #include "ddk750_help.h"
 
-volatile unsigned char __iomem * mmio750 = NULL;
+void __iomem * mmio750 = NULL;
 char revId750 = 0;
 unsigned short devId750 = 0;
 
 /* after driver mapped io registers, use this function first */
-void ddk750_set_mmio(volatile unsigned char * addr,unsigned short devId,char revId)
+void ddk750_set_mmio(void __iomem * addr,unsigned short devId,char revId)
 {
 	mmio750 = addr;
 	devId750 = devId;
diff --git a/drivers/staging/sm750fb/ddk750_help.h b/drivers/staging/sm750fb/ddk750_help.h
index 4fc93b5..07c8264 100644
--- a/drivers/staging/sm750fb/ddk750_help.h
+++ b/drivers/staging/sm750fb/ddk750_help.h
@@ -12,14 +12,14 @@
 #if 0
 /* if 718 big endian turned on,be aware that don't use this driver for general use,only for ppc big-endian */
 #warning "big endian on target cpu and enable nature big endian support of 718 capability !"
-#define PEEK32(addr)  			__raw_readl((void __iomem *)(mmio750)+(addr))
-#define POKE32(addr,data) 		__raw_writel((data),(void __iomem*)(mmio750)+(addr))
+#define PEEK32(addr)  			__raw_readl(mmio750 + addr)
+#define POKE32(addr,data) 		__raw_writel(data, mmio750 + addr)
 #else /* software control endianess */
-#define PEEK32(addr) readl((addr)+mmio750)
-#define POKE32(addr,data) writel((data),(addr)+mmio750)
+#define PEEK32(addr) readl(addr + mmio750)
+#define POKE32(addr,data) writel(data, addr + mmio750)
 #endif
 
-extern volatile unsigned  char __iomem * mmio750;
+extern void __iomem * mmio750;
 extern char revId750;
 extern unsigned short devId750;
 #else
diff --git a/drivers/staging/sm750fb/sm750.h b/drivers/staging/sm750fb/sm750.h
index 711676c..376df5f 100644
--- a/drivers/staging/sm750fb/sm750.h
+++ b/drivers/staging/sm750fb/sm750.h
@@ -63,7 +63,7 @@ struct lynx_share{
 	resource_size_t vidreg_start;
 	resource_size_t vidmem_size;
 	resource_size_t vidreg_size;
-	volatile unsigned char __iomem * pvReg;
+	void __iomem * pvReg;
 	unsigned char __iomem * pvMem;
 	/* locks*/
 	spinlock_t slock;
-- 
2.3.2


^ permalink raw reply related

* Re: [PATCH] video: treat signal like timeout as failure
From: Russell King - ARM Linux @ 2015-03-10 14:15 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <20150310125116.GA26020@opentech.at>

On Tue, Mar 10, 2015 at 01:51:16PM +0100, Nicholas Mc Guire wrote:
> On Tue, 10 Mar 2015, Tomi Valkeinen wrote:
> 
> > On 20/01/15 07:23, Nicholas Mc Guire wrote:
> > > if(!wait_for_completion_interruptible_timeout(...))
> > > only handles the timeout case - this patch adds handling the
> > > signal case the same as timeout and cleans up.
> > > 
> > > Signed-off-by: Nicholas Mc Guire <der.herr@hofr.at>
> > > ---
> > > 
> > > Only the timeout case was being handled, return of 0 in 
> > > wait_for_completion_interruptible_timeout, the signal case (-ERESTARTSYS)
> > > was treated just like the case of successful completion, which is most 
> > > likely not reasonable.
> > > 
> > > Note that exynos_mipi_dsi_wr_data/exynos_mipi_dsi_rd_data return values
> > > are not checked at the call sites in s6e8ax0.c (cmd_read/cmd_write)!
> > > 
> > > This patch simply treats the signal case the same way as the timeout case,
> > > by releasing locks and returning 0 - which might not be the right thing to
> > > do - this needs a review by someone knowing the details of this driver.
> > 
> > While I agree that this patch is a bit better than the current state,
> > the code still looks wrong as Russell said.
> > 
> > I can merge this, but I'd rather have someone from Samsung look at the
> > code and change it to use wait_for_completion_killable_timeout() if
> > that's what this code is really supposed to use.
> >
> If someone that knows the details takes care of it
> that is of course the best solution. If someone Samsung is 
> going to look into it then it is probably best to completly
> drop this speculative patch so that this does not lead
> to more confusion than it does good.

IMHO, just change it to wait_for_completion_killable_timeout() - that's
a much better change than the change you're proposing.

If we think about it...  The current code uses this:

                if (!wait_for_completion_interruptible_timeout(&dsim_wr_comp,
                                                        MIPI_FIFO_TIMEOUT)) {
                        dev_warn(dsim->dev, "command write timeout.\n");
                        mutex_unlock(&dsim->lock);
                        return -EAGAIN;
                }

which has the effect of treating a signal as "success", and doesn't return
an error.  So, if the calling application receives (eg) a SIGPIPE or a
SIGALRM, we proceed as if we received the FIFO empty interrupt and doesn't
cause an error.

Your change results in:

                timeout = wait_for_completion_interruptible_timeout(
                                        &dsim_wr_comp, MIPI_FIFO_TIMEOUT);
                if (timeout <= 0) {
                        dev_warn(dsim->dev,
                                "command write timed-out/interrupted.\n");
                        mutex_unlock(&dsim->lock);
                        return -EAGAIN;
                }

which now means that this call returns -EAGAIN when a signal is raised.

Now, further auditing of this exynos crap (and I really do mean crap)
shows that this function is assigned to a method called "cmd_write".
Grepping for that shows that *no caller ever checks the return value*!

So, really, there's a bug here in that we should _never_ complete on a
signal, and we most *definitely can not* error out on a signal either.
The *only* sane change to this code without author/maintainer input is
to change this to wait_for_completion_killable_timeout() - so that
signals do not cause either premature completion nor premature failure
of the wait.

The proper fix is absolutely huge: all call paths need to be augmented
with code to detect this function failing, and back out whatever changes
they've made, and restoring the previous state (if they can) and
propagate the error all the way back to userland, so that syscall
restarting can work correctly.  _Only then_ is it safe to use a call
which causes an interruptible sleep.

Personally, I'd be happier seeing this moved into drivers/staging and
eventually deleted from the kernel unless someone is willing to review
the driver and fix some of these glaring problems.  I wouldn't be
surprised if there was _loads_ of this kind of crap there.

-- 
FTTC broadband for 0.8mile line: currently at 10.5Mbps down 400kbps up
according to speedtest.net.

^ permalink raw reply

* Re: [PATCH] video: treat signal like timeout as failure
From: Nicholas Mc Guire @ 2015-03-10 14:39 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <20150310141511.GL8656@n2100.arm.linux.org.uk>

On Tue, 10 Mar 2015, Russell King - ARM Linux wrote:

> On Tue, Mar 10, 2015 at 01:51:16PM +0100, Nicholas Mc Guire wrote:
> > On Tue, 10 Mar 2015, Tomi Valkeinen wrote:
> > 
> > > On 20/01/15 07:23, Nicholas Mc Guire wrote:
> > > > if(!wait_for_completion_interruptible_timeout(...))
> > > > only handles the timeout case - this patch adds handling the
> > > > signal case the same as timeout and cleans up.
> > > > 
> > > > Signed-off-by: Nicholas Mc Guire <der.herr@hofr.at>
> > > > ---
> > > > 
> > > > Only the timeout case was being handled, return of 0 in 
> > > > wait_for_completion_interruptible_timeout, the signal case (-ERESTARTSYS)
> > > > was treated just like the case of successful completion, which is most 
> > > > likely not reasonable.
> > > > 
> > > > Note that exynos_mipi_dsi_wr_data/exynos_mipi_dsi_rd_data return values
> > > > are not checked at the call sites in s6e8ax0.c (cmd_read/cmd_write)!
> > > > 
> > > > This patch simply treats the signal case the same way as the timeout case,
> > > > by releasing locks and returning 0 - which might not be the right thing to
> > > > do - this needs a review by someone knowing the details of this driver.
> > > 
> > > While I agree that this patch is a bit better than the current state,
> > > the code still looks wrong as Russell said.
> > > 
> > > I can merge this, but I'd rather have someone from Samsung look at the
> > > code and change it to use wait_for_completion_killable_timeout() if
> > > that's what this code is really supposed to use.
> > >
> > If someone that knows the details takes care of it
> > that is of course the best solution. If someone Samsung is 
> > going to look into it then it is probably best to completly
> > drop this speculative patch so that this does not lead
> > to more confusion than it does good.
> 
> IMHO, just change it to wait_for_completion_killable_timeout() - that's
> a much better change than the change you're proposing.
> 
> If we think about it...  The current code uses this:
> 
>                 if (!wait_for_completion_interruptible_timeout(&dsim_wr_comp,
>                                                         MIPI_FIFO_TIMEOUT)) {
>                         dev_warn(dsim->dev, "command write timeout.\n");
>                         mutex_unlock(&dsim->lock);
>                         return -EAGAIN;
>                 }
> 
> which has the effect of treating a signal as "success", and doesn't return
> an error.  So, if the calling application receives (eg) a SIGPIPE or a
> SIGALRM, we proceed as if we received the FIFO empty interrupt and doesn't
> cause an error.
> 
> Your change results in:
> 
>                 timeout = wait_for_completion_interruptible_timeout(
>                                         &dsim_wr_comp, MIPI_FIFO_TIMEOUT);
>                 if (timeout <= 0) {
>                         dev_warn(dsim->dev,
>                                 "command write timed-out/interrupted.\n");
>                         mutex_unlock(&dsim->lock);
>                         return -EAGAIN;
>                 }
> 
> which now means that this call returns -EAGAIN when a signal is raised.

but in case of wait_for_completion_killable_timeout it also would return
-ERESTARTSYS (unless I'm missreading do_wait_for_common -> signal_pending_state(state, current)) so I still think it would be better to have the
dev_warn() in the path and then when the task is killed it atleast leaves
some trace of the of what was going on ?

> 
> Now, further auditing of this exynos crap (and I really do mean crap)
> shows that this function is assigned to a method called "cmd_write".
> Grepping for that shows that *no caller ever checks the return value*!
>

yup - as was noted in the patch - and this is also why it was
not really possible to figure out what should really be done
as it runs into a dead end in all cases - the only point of the patch was
to atleast generate a debug message and return some signal
indicating error ... which is then unhandled...
 
> So, really, there's a bug here in that we should _never_ complete on a
> signal, and we most *definitely can not* error out on a signal either.
> The *only* sane change to this code without author/maintainer input is
> to change this to wait_for_completion_killable_timeout() - so that
> signals do not cause either premature completion nor premature failure
> of the wait.
> 
> The proper fix is absolutely huge: all call paths need to be augmented
> with code to detect this function failing, and back out whatever changes
> they've made, and restoring the previous state (if they can) and
> propagate the error all the way back to userland, so that syscall
> restarting can work correctly.  _Only then_ is it safe to use a call
> which causes an interruptible sleep.
> 
> Personally, I'd be happier seeing this moved into drivers/staging and
> eventually deleted from the kernel unless someone is willing to review
> the driver and fix some of these glaring problems.  I wouldn't be
> surprised if there was _loads_ of this kind of crap there.
>
there is plenty of this - actually all of the wait_for_completion* related
findings I've been posting in the past 2 month are based on the attempt to
write up a more or less complete API spec in form of coccinelle scripts that
then can be used to scan and sometimes fix-up this kind of problems - but of
course just "local-fixes" - this can't fix fundamentally broken code.

thx!
hofrat 

^ permalink raw reply

* Re: [PATCH] video: treat signal like timeout as failure
From: Russell King - ARM Linux @ 2015-03-10 14:46 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <20150310143928.GA19501@opentech.at>

On Tue, Mar 10, 2015 at 03:39:28PM +0100, Nicholas Mc Guire wrote:
> On Tue, 10 Mar 2015, Russell King - ARM Linux wrote:
> > On Tue, Mar 10, 2015 at 01:51:16PM +0100, Nicholas Mc Guire wrote:
> > > On Tue, 10 Mar 2015, Tomi Valkeinen wrote:
> > > 
> > > > On 20/01/15 07:23, Nicholas Mc Guire wrote:
> > > > > if(!wait_for_completion_interruptible_timeout(...))
> > > > > only handles the timeout case - this patch adds handling the
> > > > > signal case the same as timeout and cleans up.
> > > > > 
> > > > > Signed-off-by: Nicholas Mc Guire <der.herr@hofr.at>
> > > > > ---
> > > > > 
> > > > > Only the timeout case was being handled, return of 0 in 
> > > > > wait_for_completion_interruptible_timeout, the signal case (-ERESTARTSYS)
> > > > > was treated just like the case of successful completion, which is most 
> > > > > likely not reasonable.
> > > > > 
> > > > > Note that exynos_mipi_dsi_wr_data/exynos_mipi_dsi_rd_data return values
> > > > > are not checked at the call sites in s6e8ax0.c (cmd_read/cmd_write)!
> > > > > 
> > > > > This patch simply treats the signal case the same way as the timeout case,
> > > > > by releasing locks and returning 0 - which might not be the right thing to
> > > > > do - this needs a review by someone knowing the details of this driver.
> > > > 
> > > > While I agree that this patch is a bit better than the current state,
> > > > the code still looks wrong as Russell said.
> > > > 
> > > > I can merge this, but I'd rather have someone from Samsung look at the
> > > > code and change it to use wait_for_completion_killable_timeout() if
> > > > that's what this code is really supposed to use.
> > > >
> > > If someone that knows the details takes care of it
> > > that is of course the best solution. If someone Samsung is 
> > > going to look into it then it is probably best to completly
> > > drop this speculative patch so that this does not lead
> > > to more confusion than it does good.
> > 
> > IMHO, just change it to wait_for_completion_killable_timeout() - that's
> > a much better change than the change you're proposing.
> > 
> > If we think about it...  The current code uses this:
> > 
> >                 if (!wait_for_completion_interruptible_timeout(&dsim_wr_comp,
> >                                                         MIPI_FIFO_TIMEOUT)) {
> >                         dev_warn(dsim->dev, "command write timeout.\n");
> >                         mutex_unlock(&dsim->lock);
> >                         return -EAGAIN;
> >                 }
> > 
> > which has the effect of treating a signal as "success", and doesn't return
> > an error.  So, if the calling application receives (eg) a SIGPIPE or a
> > SIGALRM, we proceed as if we received the FIFO empty interrupt and doesn't
> > cause an error.
> > 
> > Your change results in:
> > 
> >                 timeout = wait_for_completion_interruptible_timeout(
> >                                         &dsim_wr_comp, MIPI_FIFO_TIMEOUT);
> >                 if (timeout <= 0) {
> >                         dev_warn(dsim->dev,
> >                                 "command write timed-out/interrupted.\n");
> >                         mutex_unlock(&dsim->lock);
> >                         return -EAGAIN;
> >                 }
> > 
> > which now means that this call returns -EAGAIN when a signal is raised.
> 
> but in case of wait_for_completion_killable_timeout it also would return
> -ERESTARTSYS (unless I'm missreading do_wait_for_common -> signal_pending_state(state, current)) so I still think it would be better to have the
> dev_warn() in the path and then when the task is killed it atleast leaves
> some trace of the of what was going on ?
> 
> > 
> > Now, further auditing of this exynos crap (and I really do mean crap)
> > shows that this function is assigned to a method called "cmd_write".
> > Grepping for that shows that *no caller ever checks the return value*!
> >
> 
> yup - as was noted in the patch - and this is also why it was
> not really possible to figure out what should really be done
> as it runs into a dead end in all cases - the only point of the patch was
> to atleast generate a debug message and return some signal
> indicating error ... which is then unhandled...
>  
> > So, really, there's a bug here in that we should _never_ complete on a
> > signal, and we most *definitely can not* error out on a signal either.
> > The *only* sane change to this code without author/maintainer input is
> > to change this to wait_for_completion_killable_timeout() - so that
> > signals do not cause either premature completion nor premature failure
> > of the wait.
> > 
> > The proper fix is absolutely huge: all call paths need to be augmented
> > with code to detect this function failing, and back out whatever changes
> > they've made, and restoring the previous state (if they can) and
> > propagate the error all the way back to userland, so that syscall
> > restarting can work correctly.  _Only then_ is it safe to use a call
> > which causes an interruptible sleep.
> > 
> > Personally, I'd be happier seeing this moved into drivers/staging and
> > eventually deleted from the kernel unless someone is willing to review
> > the driver and fix some of these glaring problems.  I wouldn't be
> > surprised if there was _loads_ of this kind of crap there.
> >
> there is plenty of this - actually all of the wait_for_completion* related
> findings I've been posting in the past 2 month are based on the attempt to
> write up a more or less complete API spec in form of coccinelle scripts that
> then can be used to scan and sometimes fix-up this kind of problems - but of
> course just "local-fixes" - this can't fix fundamentally broken code.

In which case, let me propose that the exynos fbdev driver needs to be
moved to drivers/staging, and stay there until this stuff gets fixed.
drivers/staging is supposed to be for stuff which isn't up to the mark,
and which is potentially unstable.  And that's what this driver exactly
is.

-- 
FTTC broadband for 0.8mile line: currently at 10.5Mbps down 400kbps up
according to speedtest.net.

^ permalink raw reply

* Re: [PATCH] video: treat signal like timeout as failure
From: Tomi Valkeinen @ 2015-03-10 14:55 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <20150310144640.GM8656@n2100.arm.linux.org.uk>

[-- Attachment #1: Type: text/plain, Size: 1077 bytes --]

On 10/03/15 16:46, Russell King - ARM Linux wrote:

> In which case, let me propose that the exynos fbdev driver needs to be
> moved to drivers/staging, and stay there until this stuff gets fixed.
> drivers/staging is supposed to be for stuff which isn't up to the mark,
> and which is potentially unstable.  And that's what this driver exactly
> is.

There is drivers/gpu/drm/exynos/ which is getting a lot of updates. So...

I'd propose removing the exynos fbdev driver if the exynos drm driver
offers the same functionality. I don't know if that's the case. Does the
drm driver support all the devices the fbdev supports?

Also, I'm not sure if and how we can remove drivers. If exynos fbdev
driver is dropped, that would perhaps break boards that have exynos
fbdev in their .dts file. And if the drm driver doesn't offer the exact
same /dev/fbX interface, it would break the userspace.

So I don't know if that's possible. But that's what I'd like to do,
eventually, for all the fbdev drivers. Implement drm driver, remove the
fbdev one.

 Tomi



[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply

* Re: [PATCH] staging: sm750fb: Cleanup the type of mmio750
From: Greg KH @ 2015-03-10 15:04 UTC (permalink / raw)
  To: Lorenzo Stoakes
  Cc: Sudip Mukherjee, devel, linux-fbdev, teddy.wang, linux-kernel,
	Dan Carpenter
In-Reply-To: <CAA5enKZMZDVzEjZG1mccn089MEN3AvSQc+TECc6vMZBKB06TRA@mail.gmail.com>

On Tue, Mar 10, 2015 at 12:47:44PM +0000, Lorenzo Stoakes wrote:
> On 10 March 2015 at 12:36, Sudip Mukherjee <sudipm.mukherjee@gmail.com> wrote:
> > but it is introducing two new build warnings:
> >
> > drivers/staging/sm750fb/sm750_hw.c: In function ‘hw_sm750_map’:
> > drivers/staging/sm750fb/sm750_hw.c:67:2: warning: passing argument 1 of ‘ddk750_set_mmio’ discards ‘volatile’ qualifier from pointer target type [enabled by default]
> > In file included from drivers/staging/sm750fb/ddk750_mode.h:4:0,
> >                     from drivers/staging/sm750fb/ddk750.h:15,
> >                     from drivers/staging/sm750fb/sm750_hw.c:24:
> >
> > and
> >
> > drivers/staging/sm750fb/ddk750_chip.h:77:6: note: expected ‘void *’ but argument is of type ‘volatile unsigned char *’
> >
> > care to make another patch to solve these two new warnings, and send this patch and the new one in a series and while sending mark the version number in the subject.
> 
> I think the second warning is simply additional information attached
> to the 1st to give context?
> 
> I noticed this issue but felt changing the type of this field would
> sit outside the purview of this patch as then I'm not only changing
> the type of mmio750 and code that *directly* interacts with this
> variable, but also code that indirectly interacts with it, so I felt
> that should perhaps be a separate patch.
> 
> I'd love to additionally provide some further patches to help out with
> issues here too, incidentally! I will try to prepare some further
> patches tonight in this vein.

I can't apply patches that add new build warnings, sorry.  Please fix
this up in the patch itself.

greg k-h

^ permalink raw reply

* Re: [PATCH v2] staging: sm750fb: Fix sparse warning
From: Greg KH @ 2015-03-10 15:06 UTC (permalink / raw)
  To: Lorenzo Stoakes
  Cc: sudipm.mukherjee, teddy.wang, devel, linux-fbdev, linux-kernel
In-Reply-To: <1425977519-4810-1-git-send-email-lstoakes@gmail.com>

On Tue, Mar 10, 2015 at 08:51:59AM +0000, Lorenzo Stoakes wrote:
> This patch fixes the following sparse warning:-
> 
> drivers/staging/sm750fb/ddk750_help.c: warning: incorrect type in assignment (different address spaces)
> 
> In addition it eliminates an unnecessary volatile.

This doesn't apply anymore due to other patches I just took, so can you
rebase this patch on my latest staging-testing branch of staging.git?

Also, how about someone fixing the real compiler warnings this driver is
spitting out first, before we worry about sparse warnings?  That's much
more relevant here as it's keeping the driver from being built in
linux-next at the moment.

thanks,

greg k-h

^ permalink raw reply

* Re: [PATCH] staging: sm750fb: Cleanup the type of mmio750
From: Lorenzo Stoakes @ 2015-03-10 15:08 UTC (permalink / raw)
  To: Greg KH
  Cc: Sudip Mukherjee, devel, linux-fbdev, teddy.wang, linux-kernel,
	Dan Carpenter
In-Reply-To: <20150310150454.GA22451@kroah.com>

On 10 March 2015 at 15:04, Greg KH <gregkh@linuxfoundation.org> wrote:
> I can't apply patches that add new build warnings, sorry.  Please fix
> this up in the patch itself.
>
> greg k-h

Hi Greg,

Apologies for this, I've resolved this issue in v2 of the patch, no
warning messages are added in the updated version of this patch.

Best,

-- 
Lorenzo Stoakes
https:/ljs.io

^ permalink raw reply

* Re: [PATCH v2] staging: sm750fb: Cleanup the type of mmio750
From: Greg KH @ 2015-03-10 15:09 UTC (permalink / raw)
  To: Lorenzo Stoakes
  Cc: sudipm.mukherjee, teddy.wang, devel, linux-fbdev, linux-kernel
In-Reply-To: <1425994068-8535-1-git-send-email-lstoakes@gmail.com>

On Tue, Mar 10, 2015 at 01:27:48PM +0000, Lorenzo Stoakes wrote:
> This patch assigns the more appropriate void* type to the mmio750 variable
> eliminating an unnecessary volatile qualifier in the process. Additionally it
> updates parameter types as necessary where those parameters interact with
> mmio750, removes unnecessary casts and updates the type of the
> lynx_share->pvReg field which is passed to the ddk750_set_mmio method.
> 
> As a consequence, this patch fixes the following sparse warning:-
> 
> drivers/staging/sm750fb/ddk750_help.c:12:17: warning: incorrect type in assignment (different address spaces)
> 
> Signed-off-by: Lorenzo Stoakes <lstoakes@gmail.com>
> 
> ---
>  drivers/staging/sm750fb/ddk750_chip.h |  4 +++-
>  drivers/staging/sm750fb/ddk750_help.c |  4 ++--
>  drivers/staging/sm750fb/ddk750_help.h | 10 +++++-----
>  drivers/staging/sm750fb/sm750.h       |  2 +-
>  4 files changed, 11 insertions(+), 9 deletions(-)

This doesn't apply either anymore, for the same reason :(

^ permalink raw reply

* [PATCH v3] staging: sm750fb: Cleanup the type of mmio750
From: Lorenzo Stoakes @ 2015-03-10 15:25 UTC (permalink / raw)
  To: sudipm.mukherjee, teddy.wang, gregkh
  Cc: linux-fbdev, devel, linux-kernel, Lorenzo Stoakes

This patch assigns the more appropriate void* type to the mmio750 variable
eliminating an unnecessary volatile qualifier in the process. Additionally it
updates parameter types as necessary where those parameters interact with
mmio750, removes unnecessary casts and updates the type of the
lynx_share->pvReg field which is passed to the ddk750_set_mmio method.

As a consequence, this patch fixes the following sparse warning:-

drivers/staging/sm750fb/ddk750_help.c:12:17: warning: incorrect type in assignment (different address spaces)

Signed-off-by: Lorenzo Stoakes <lstoakes@gmail.com>
---
 drivers/staging/sm750fb/ddk750_chip.h |  4 +++-
 drivers/staging/sm750fb/ddk750_help.c |  4 ++--
 drivers/staging/sm750fb/ddk750_help.h | 10 +++++-----
 drivers/staging/sm750fb/sm750.h       |  2 +-
 4 files changed, 11 insertions(+), 9 deletions(-)

diff --git a/drivers/staging/sm750fb/ddk750_chip.h b/drivers/staging/sm750fb/ddk750_chip.h
index d761b72..04cb0d5 100644
--- a/drivers/staging/sm750fb/ddk750_chip.h
+++ b/drivers/staging/sm750fb/ddk750_chip.h
@@ -5,6 +5,8 @@
 #define SM750LE_REVISION_ID ((unsigned char)0xfe)
 #endif
 
+#include <linux/io.h>
+
 /* This is all the chips recognized by this library */
 typedef enum _logical_chip_type_t
 {
@@ -72,7 +74,7 @@ logical_chip_type_t getChipType(void);
 unsigned int calcPllValue(unsigned int request,pll_value_t *pll);
 unsigned int calcPllValue2(unsigned int,pll_value_t *);
 unsigned int formatPllReg(pll_value_t *pPLL);
-void ddk750_set_mmio(volatile unsigned char *,unsigned short,char);
+void ddk750_set_mmio(void __iomem *,unsigned short,char);
 unsigned int ddk750_getVMSize(void);
 int ddk750_initHw(initchip_param_t *);
 unsigned int getPllValue(clock_type_t clockType, pll_value_t *pPLL);
diff --git a/drivers/staging/sm750fb/ddk750_help.c b/drivers/staging/sm750fb/ddk750_help.c
index cc00d2b..c68ff3b 100644
--- a/drivers/staging/sm750fb/ddk750_help.c
+++ b/drivers/staging/sm750fb/ddk750_help.c
@@ -2,12 +2,12 @@
 //#include "ddk750_chip.h"
 #include "ddk750_help.h"
 
-volatile unsigned char __iomem * mmio750 = NULL;
+void __iomem * mmio750 = NULL;
 char revId750 = 0;
 unsigned short devId750 = 0;
 
 /* after driver mapped io registers, use this function first */
-void ddk750_set_mmio(volatile unsigned char * addr,unsigned short devId,char revId)
+void ddk750_set_mmio(void __iomem * addr,unsigned short devId,char revId)
 {
 	mmio750 = addr;
 	devId750 = devId;
diff --git a/drivers/staging/sm750fb/ddk750_help.h b/drivers/staging/sm750fb/ddk750_help.h
index 4fc93b5..07c8264 100644
--- a/drivers/staging/sm750fb/ddk750_help.h
+++ b/drivers/staging/sm750fb/ddk750_help.h
@@ -12,14 +12,14 @@
 #if 0
 /* if 718 big endian turned on,be aware that don't use this driver for general use,only for ppc big-endian */
 #warning "big endian on target cpu and enable nature big endian support of 718 capability !"
-#define PEEK32(addr)  			__raw_readl((void __iomem *)(mmio750)+(addr))
-#define POKE32(addr,data) 		__raw_writel((data),(void __iomem*)(mmio750)+(addr))
+#define PEEK32(addr)  			__raw_readl(mmio750 + addr)
+#define POKE32(addr,data) 		__raw_writel(data, mmio750 + addr)
 #else /* software control endianess */
-#define PEEK32(addr) readl((addr)+mmio750)
-#define POKE32(addr,data) writel((data),(addr)+mmio750)
+#define PEEK32(addr) readl(addr + mmio750)
+#define POKE32(addr,data) writel(data, addr + mmio750)
 #endif
 
-extern volatile unsigned  char __iomem * mmio750;
+extern void __iomem * mmio750;
 extern char revId750;
 extern unsigned short devId750;
 #else
diff --git a/drivers/staging/sm750fb/sm750.h b/drivers/staging/sm750fb/sm750.h
index d39968c..5361116 100644
--- a/drivers/staging/sm750fb/sm750.h
+++ b/drivers/staging/sm750fb/sm750.h
@@ -63,7 +63,7 @@ struct lynx_share{
 	unsigned long vidreg_start;
 	__u32 vidmem_size;
 	__u32 vidreg_size;
-	volatile unsigned char __iomem * pvReg;
+	void __iomem * pvReg;
 	unsigned char __iomem * pvMem;
 	/* locks*/
 	spinlock_t slock;
-- 
2.3.2


^ permalink raw reply related

* Re: [PATCH] video: treat signal like timeout as failure
From: Russell King - ARM Linux @ 2015-03-10 15:26 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <54FF05FC.5030704@ti.com>

On Tue, Mar 10, 2015 at 04:55:56PM +0200, Tomi Valkeinen wrote:
> On 10/03/15 16:46, Russell King - ARM Linux wrote:
> 
> > In which case, let me propose that the exynos fbdev driver needs to be
> > moved to drivers/staging, and stay there until this stuff gets fixed.
> > drivers/staging is supposed to be for stuff which isn't up to the mark,
> > and which is potentially unstable.  And that's what this driver exactly
> > is.
> 
> There is drivers/gpu/drm/exynos/ which is getting a lot of updates. So...
> 
> I'd propose removing the exynos fbdev driver if the exynos drm driver
> offers the same functionality. I don't know if that's the case. Does the
> drm driver support all the devices the fbdev supports?
> 
> Also, I'm not sure if and how we can remove drivers. If exynos fbdev
> driver is dropped, that would perhaps break boards that have exynos
> fbdev in their .dts file. And if the drm driver doesn't offer the exact
> same /dev/fbX interface, it would break the userspace.
> 
> So I don't know if that's possible. But that's what I'd like to do,
> eventually, for all the fbdev drivers. Implement drm driver, remove the
> fbdev one.

That's why I suggested moving it to drivers/staging - it's a hint that
the driver needs a serious amount of work, and when built as a module,
it also provides users with the hint that the module they're loading is
of questionable quality (which is definitely the case here.)

Others have done that kind of thing before - we've had drivers which
have fallen by the way side, and at some point the decision has been
made to move them to drivers/staging, and if nothing happens to fix
them up (showing that no one cares about them), they've eventually
been dropped.

Of course, us talking about this might be enough to spur some effort
to get the thing properly fixed. :)

-- 
FTTC broadband for 0.8mile line: currently at 10.5Mbps down 400kbps up
according to speedtest.net.

^ permalink raw reply

* Re: [PATCH v2] staging: sm750fb: Fix sparse warning
From: Lorenzo Stoakes @ 2015-03-10 15:33 UTC (permalink / raw)
  To: Greg KH; +Cc: Sudip Mukherjee, teddy.wang, devel, linux-fbdev, linux-kernel
In-Reply-To: <20150310150612.GA22560@kroah.com>

On 10 March 2015 at 15:06, Greg KH <gregkh@linuxfoundation.org> wrote:
> This doesn't apply anymore due to other patches I just took, so can you
> rebase this patch on my latest staging-testing branch of staging.git?

Fixed in v3 of staging: sm750fb: Cleanup the type of mmio75.

> Also, how about someone fixing the real compiler warnings this driver is
> spitting out first, before we worry about sparse warnings?  That's much
> more relevant here as it's keeping the driver from being built in
> linux-next at the moment.
>
> thanks,
>
> greg k-h

I am more than happy to take a look at this later today when I have
the opportunity to do so :)

-- 
Lorenzo Stoakes
https:/ljs.io

^ permalink raw reply


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox