[PATCH 00/14] use atomic_dec_not_zero()

2017-01-30 Thread Fabian Frederick
complementary definition to atomic_inc_not_zero() featured in
lib/fault-inject.c. This small patchset moves it to
include/linux/atomic.h using it instead of
atomic_add_unless(value, -1, 0)

s390 patches were not compile-tested.

Fabian Frederick (14):
  locking/atomic: import atomic_dec_not_zero()
  drm/exynos: use atomic_dec_not_zero()
  drm/omap: use atomic_dec_not_zero()
  m5mols: use atomic_dec_not_zero()
  omap3isp: use atomic_dec_not_zero()
  s390/qeth: use atomic_dec_not_zero()
  PM / RUNTIME: use atomic_dec_not_zero()
  ipmi: use atomic_dec_not_zero()
  kdb: use atomic_dec_not_zero()
  PM / Hibernate: use atomic_dec_not_zero()
  PM: use atomic_dec_not_zero()
  s390/topology: use atomic_dec_not_zero()
  ext4: use atomic_dec_not_zero()
  xfs: use atomic_dec_not_zero()

 arch/s390/kernel/topology.c   | 2 +-
 drivers/base/power/runtime.c  | 4 ++--
 drivers/char/ipmi/ipmi_msghandler.c   | 2 +-
 drivers/gpu/drm/exynos/exynos_drm_fimd.c  | 2 +-
 drivers/gpu/drm/omapdrm/omap_dmm_tiler.c  | 2 +-
 drivers/media/i2c/m5mols/m5mols_core.c| 2 +-
 drivers/media/platform/omap3isp/ispstat.c | 2 +-
 drivers/s390/net/qeth_core_main.c | 2 +-
 fs/ext4/ext4.h| 2 +-
 fs/xfs/xfs_buf.c  | 2 +-
 include/linux/atomic.h| 2 ++
 kernel/debug/kdb/kdb_main.c   | 2 +-
 kernel/power/hibernate.c  | 4 ++--
 kernel/power/user.c   | 2 +-
 lib/fault-inject.c| 2 --
 15 files changed, 17 insertions(+), 17 deletions(-)

-- 
2.9.3

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH 03/14] drm/omap: use atomic_dec_not_zero()

2017-01-30 Thread Fabian Frederick
instead of atomic_add_unless(value, -1, 0)

Signed-off-by: Fabian Frederick 
---
 drivers/gpu/drm/omapdrm/omap_dmm_tiler.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/omapdrm/omap_dmm_tiler.c 
b/drivers/gpu/drm/omapdrm/omap_dmm_tiler.c
index 3cab066..abd0b15 100644
--- a/drivers/gpu/drm/omapdrm/omap_dmm_tiler.c
+++ b/drivers/gpu/drm/omapdrm/omap_dmm_tiler.c
@@ -184,7 +184,7 @@ static struct dmm_txn *dmm_txn_init(struct dmm *dmm, struct 
tcm *tcm)
 
/* wait until an engine is available */
ret = wait_event_interruptible(omap_dmm->engine_queue,
-   atomic_add_unless(&omap_dmm->engine_counter, -1, 0));
+   atomic_dec_not_zero(&omap_dmm->engine_counter));
if (ret)
return ERR_PTR(ret);
 
-- 
2.9.3

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH 1/1 linux-next] drm/nouveau: don't opencode IS_REACHABLE()

2016-11-12 Thread Fabian Frederick
Signed-off-by: Fabian Frederick 
---
 drivers/gpu/drm/nouveau/nouveau_hwmon.c   | 6 +++---
 drivers/gpu/drm/nouveau/nvkm/subdev/pci/agp.h | 2 +-
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/nouveau/nouveau_hwmon.c 
b/drivers/gpu/drm/nouveau/nouveau_hwmon.c
index 71f764b..ddfac0b 100644
--- a/drivers/gpu/drm/nouveau/nouveau_hwmon.c
+++ b/drivers/gpu/drm/nouveau/nouveau_hwmon.c
@@ -37,7 +37,7 @@
 #include 
 #include 

-#if defined(CONFIG_HWMON) || (defined(MODULE) && defined(CONFIG_HWMON_MODULE))
+#if IS_REACHABLE(CONFIG_HWMON)
 static ssize_t
 nouveau_hwmon_show_temp(struct device *d, struct device_attribute *a, char 
*buf)
 {
@@ -662,7 +662,7 @@ static const struct attribute_group hwmon_power_attrgroup = 
{
 int
 nouveau_hwmon_init(struct drm_device *dev)
 {
-#if defined(CONFIG_HWMON) || (defined(MODULE) && defined(CONFIG_HWMON_MODULE))
+#if IS_REACHABLE(CONFIG_HWMON)
struct nouveau_drm *drm = nouveau_drm(dev);
struct nvkm_therm *therm = nvxx_therm(&drm->device);
struct nvkm_volt *volt = nvxx_volt(&drm->device);
@@ -749,7 +749,7 @@ nouveau_hwmon_init(struct drm_device *dev)
 void
 nouveau_hwmon_fini(struct drm_device *dev)
 {
-#if defined(CONFIG_HWMON) || (defined(MODULE) && defined(CONFIG_HWMON_MODULE))
+#if IS_REACHABLE(CONFIG_HWMON)
struct nouveau_hwmon *hwmon = nouveau_hwmon(dev);

if (hwmon->hwmon) {
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/pci/agp.h 
b/drivers/gpu/drm/nouveau/nvkm/subdev/pci/agp.h
index df2dd08..8de914c 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/pci/agp.h
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/pci/agp.h
@@ -1,5 +1,5 @@
 #include "priv.h"
-#if defined(CONFIG_AGP) || (defined(CONFIG_AGP_MODULE) && defined(MODULE))
+#if IS_REACHABLE(CONFIG_AGP)
 #ifndef __NVKM_PCI_AGP_H__
 #define __NVKM_PCI_AGP_H__

-- 
2.7.4



[PATCH 1/1 linux-next] drm: remove unnecessary sizeof(u8)

2014-11-16 Thread Fabian Frederick
sizeof(u8) is always 1.

Signed-off-by: Fabian Frederick 
---
 drivers/gpu/drm/r128/r128_state.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/r128/r128_state.c 
b/drivers/gpu/drm/r128/r128_state.c
index 575e986..8fd2d9f 100644
--- a/drivers/gpu/drm/r128/r128_state.c
+++ b/drivers/gpu/drm/r128/r128_state.c
@@ -905,7 +905,7 @@ static int r128_cce_dispatch_write_span(struct drm_device 
*dev,
if (IS_ERR(buffer))
return PTR_ERR(buffer);

-   mask_size = depth->n * sizeof(u8);
+   mask_size = depth->n;
if (depth->mask) {
mask = memdup_user(depth->mask, mask_size);
if (IS_ERR(mask)) {
@@ -1010,7 +1010,7 @@ static int r128_cce_dispatch_write_pixels(struct 
drm_device *dev,
}

if (depth->mask) {
-   mask_size = depth->n * sizeof(u8);
+   mask_size = depth->n;
mask = memdup_user(depth->mask, mask_size);
if (IS_ERR(mask)) {
kfree(x);
-- 
1.9.3



[PATCH 0/9 linux-next] drivers/gpu/drm: use container_of where possible

2014-09-14 Thread Fabian Frederick
Small patchset using container_of instead of casting on first structure member 
address.

Fabian Frederick (9):
  drm/cirrus: use container_of to resolve cirrus_fbdev from
drm_fb_helper
  drm/mgag200: use container_of to resolve mga_fbdev from drm_fb_helper
  drm/radeon: use container_of to resolve radeon_fbdev from
drm_fb_helper
  drm/nouveau: use container_of to resolve nouveau_fbdev from
drm_fb_helper
  drm/nouveau: use container_of to resolve nouveau_plane from drm_plane
  drm/qxl: use container_of to resolve qxl_fbdev from drm_fb_helper
  drm/gma500: use container_of to resolve psb_fbdev from drm_fb_helper
  drm/ast: use container_of to resolve ast_fbdev from drm_fb_helper
  drm/udl: use container_of to resolve udl_fbdev from drm_fb_helper

 drivers/gpu/drm/ast/ast_fb.c   |  3 ++-
 drivers/gpu/drm/cirrus/cirrus_fbdev.c  |  3 ++-
 drivers/gpu/drm/gma500/framebuffer.c   |  3 ++-
 drivers/gpu/drm/mgag200/mgag200_fb.c   |  3 ++-
 drivers/gpu/drm/nouveau/dispnv04/overlay.c | 15 ++-
 drivers/gpu/drm/nouveau/nouveau_fbcon.c|  3 ++-
 drivers/gpu/drm/qxl/qxl_fb.c   |  3 ++-
 drivers/gpu/drm/radeon/radeon_fb.c |  3 ++-
 drivers/gpu/drm/udl/udl_fb.c   |  3 ++-
 9 files changed, 26 insertions(+), 13 deletions(-)

-- 
1.9.1



[PATCH 5/9 linux-next] drm/nouveau: use container_of to resolve nouveau_plane from drm_plane

2014-09-14 Thread Fabian Frederick
Use container_of instead of casting first structure member.

Signed-off-by: Fabian Frederick 
---
Compiled but untested.

 drivers/gpu/drm/nouveau/dispnv04/overlay.c | 15 ++-
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/nouveau/dispnv04/overlay.c 
b/drivers/gpu/drm/nouveau/dispnv04/overlay.c
index b36afcb..1e9056a 100644
--- a/drivers/gpu/drm/nouveau/dispnv04/overlay.c
+++ b/drivers/gpu/drm/nouveau/dispnv04/overlay.c
@@ -97,7 +97,8 @@ nv10_update_plane(struct drm_plane *plane, struct drm_crtc 
*crtc,
  uint32_t src_w, uint32_t src_h)
 {
struct nvif_device *dev = &nouveau_drm(plane->dev)->device;
-   struct nouveau_plane *nv_plane = (struct nouveau_plane *)plane;
+   struct nouveau_plane *nv_plane =
+   container_of(plane, struct nouveau_plane, base);
struct nouveau_framebuffer *nv_fb = nouveau_framebuffer(fb);
struct nouveau_crtc *nv_crtc = nouveau_crtc(crtc);
struct nouveau_bo *cur = nv_plane->cur;
@@ -173,7 +174,8 @@ static int
 nv10_disable_plane(struct drm_plane *plane)
 {
struct nvif_device *dev = &nouveau_drm(plane->dev)->device;
-   struct nouveau_plane *nv_plane = (struct nouveau_plane *)plane;
+   struct nouveau_plane *nv_plane =
+   container_of(plane, struct nouveau_plane, base);

nvif_wr32(dev, NV_PVIDEO_STOP, 1);
if (nv_plane->cur) {
@@ -224,7 +226,8 @@ nv_set_property(struct drm_plane *plane,
struct drm_property *property,
uint64_t value)
 {
-   struct nouveau_plane *nv_plane = (struct nouveau_plane *)plane;
+   struct nouveau_plane *nv_plane =
+   container_of(plane, struct nouveau_plane, base);

if (property == nv_plane->props.colorkey)
nv_plane->colorkey = value;
@@ -344,7 +347,8 @@ nv04_update_plane(struct drm_plane *plane, struct drm_crtc 
*crtc,
  uint32_t src_w, uint32_t src_h)
 {
struct nvif_device *dev = &nouveau_drm(plane->dev)->device;
-   struct nouveau_plane *nv_plane = (struct nouveau_plane *)plane;
+   struct nouveau_plane *nv_plane =
+   container_of(plane, struct nouveau_plane, base);
struct nouveau_framebuffer *nv_fb = nouveau_framebuffer(fb);
struct nouveau_bo *cur = nv_plane->cur;
uint32_t overlay = 1;
@@ -423,7 +427,8 @@ static int
 nv04_disable_plane(struct drm_plane *plane)
 {
struct nvif_device *dev = &nouveau_drm(plane->dev)->device;
-   struct nouveau_plane *nv_plane = (struct nouveau_plane *)plane;
+   struct nouveau_plane *nv_plane =
+   container_of(plane, struct nouveau_plane, base);

nvif_mask(dev, NV_PVIDEO_OVERLAY, 1, 0);
nvif_wr32(dev, NV_PVIDEO_OE_STATE, 0);
-- 
1.9.1



[PATCH 6/9 linux-next] drm/qxl: use container_of to resolve qxl_fbdev from drm_fb_helper

2014-09-14 Thread Fabian Frederick
Use container_of instead of casting first structure member.

Signed-off-by: Fabian Frederick 
---
Compiled but untested.

 drivers/gpu/drm/qxl/qxl_fb.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/qxl/qxl_fb.c b/drivers/gpu/drm/qxl/qxl_fb.c
index df56788..3d7c1d0 100644
--- a/drivers/gpu/drm/qxl/qxl_fb.c
+++ b/drivers/gpu/drm/qxl/qxl_fb.c
@@ -625,7 +625,8 @@ static int qxl_fb_find_or_create_single(
struct drm_fb_helper *helper,
struct drm_fb_helper_surface_size *sizes)
 {
-   struct qxl_fbdev *qfbdev = (struct qxl_fbdev *)helper;
+   struct qxl_fbdev *qfbdev =
+   container_of(helper, struct qxl_fbdev, helper);
int new_fb = 0;
int ret;

-- 
1.9.1



[PATCH 3/9 linux-next] drm/radeon: use container_of to resolve radeon_fbdev from drm_fb_helper

2014-09-14 Thread Fabian Frederick
Use container_of instead of casting first structure member.

Signed-off-by: Fabian Frederick 
---
Compiled but untested.

 drivers/gpu/drm/radeon/radeon_fb.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/radeon/radeon_fb.c 
b/drivers/gpu/drm/radeon/radeon_fb.c
index 94b0f2a..0ea1db8 100644
--- a/drivers/gpu/drm/radeon/radeon_fb.c
+++ b/drivers/gpu/drm/radeon/radeon_fb.c
@@ -189,7 +189,8 @@ out_unref:
 static int radeonfb_create(struct drm_fb_helper *helper,
   struct drm_fb_helper_surface_size *sizes)
 {
-   struct radeon_fbdev *rfbdev = (struct radeon_fbdev *)helper;
+   struct radeon_fbdev *rfbdev =
+   container_of(helper, struct radeon_fbdev, helper);
struct radeon_device *rdev = rfbdev->rdev;
struct fb_info *info;
struct drm_framebuffer *fb = NULL;
-- 
1.9.1



[PATCH 8/9 linux-next] drm/ast: use container_of to resolve ast_fbdev from drm_fb_helper

2014-09-14 Thread Fabian Frederick
Use container_of instead of casting first structure member.

Signed-off-by: Fabian Frederick 
---
Compiled but untested.

 drivers/gpu/drm/ast/ast_fb.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/ast/ast_fb.c b/drivers/gpu/drm/ast/ast_fb.c
index cba45c7..5c60ae5 100644
--- a/drivers/gpu/drm/ast/ast_fb.c
+++ b/drivers/gpu/drm/ast/ast_fb.c
@@ -186,7 +186,8 @@ static int astfb_create_object(struct ast_fbdev *afbdev,
 static int astfb_create(struct drm_fb_helper *helper,
struct drm_fb_helper_surface_size *sizes)
 {
-   struct ast_fbdev *afbdev = (struct ast_fbdev *)helper;
+   struct ast_fbdev *afbdev =
+   container_of(helper, struct ast_fbdev, helper);
struct drm_device *dev = afbdev->helper.dev;
struct drm_mode_fb_cmd2 mode_cmd;
struct drm_framebuffer *fb;
-- 
1.9.1



[PATCH 9/9 linux-next] drm/udl: use container_of to resolve udl_fbdev from drm_fb_helper

2014-09-14 Thread Fabian Frederick
Use container_of instead of casting first structure member.

Signed-off-by: Fabian Frederick 
---
Compiled but untested.

 drivers/gpu/drm/udl/udl_fb.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/udl/udl_fb.c b/drivers/gpu/drm/udl/udl_fb.c
index d1da339..8cbcb45 100644
--- a/drivers/gpu/drm/udl/udl_fb.c
+++ b/drivers/gpu/drm/udl/udl_fb.c
@@ -472,7 +472,8 @@ udl_framebuffer_init(struct drm_device *dev,
 static int udlfb_create(struct drm_fb_helper *helper,
struct drm_fb_helper_surface_size *sizes)
 {
-   struct udl_fbdev *ufbdev = (struct udl_fbdev *)helper;
+   struct udl_fbdev *ufbdev =
+   container_of(helper, struct udl_fbdev, helper);
struct drm_device *dev = ufbdev->helper.dev;
struct fb_info *info;
struct device *device = dev->dev;
-- 
1.9.1



[PATCH 1/9 linux-next] drm/cirrus: use container_of to resolve cirrus_fbdev from drm_fb_helper

2014-09-14 Thread Fabian Frederick
Use container_of instead of casting first structure member.

Signed-off-by: Fabian Frederick 
---
Compiled but untested.

 drivers/gpu/drm/cirrus/cirrus_fbdev.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/cirrus/cirrus_fbdev.c 
b/drivers/gpu/drm/cirrus/cirrus_fbdev.c
index 2a135f2..d231b1c 100644
--- a/drivers/gpu/drm/cirrus/cirrus_fbdev.c
+++ b/drivers/gpu/drm/cirrus/cirrus_fbdev.c
@@ -160,7 +160,8 @@ static int cirrusfb_create_object(struct cirrus_fbdev 
*afbdev,
 static int cirrusfb_create(struct drm_fb_helper *helper,
   struct drm_fb_helper_surface_size *sizes)
 {
-   struct cirrus_fbdev *gfbdev = (struct cirrus_fbdev *)helper;
+   struct cirrus_fbdev *gfbdev =
+   container_of(helper, struct cirrus_fbdev, helper);
struct drm_device *dev = gfbdev->helper.dev;
struct cirrus_device *cdev = gfbdev->helper.dev->dev_private;
struct fb_info *info;
-- 
1.9.1



[PATCH 4/9 linux-next] drm/nouveau: use container_of to resolve nouveau_fbdev from drm_fb_helper

2014-09-14 Thread Fabian Frederick
Use container_of instead of casting first structure member.

Signed-off-by: Fabian Frederick 
---
Compiled but untested.

 drivers/gpu/drm/nouveau/nouveau_fbcon.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/nouveau/nouveau_fbcon.c 
b/drivers/gpu/drm/nouveau/nouveau_fbcon.c
index 8bdd270..673d270 100644
--- a/drivers/gpu/drm/nouveau/nouveau_fbcon.c
+++ b/drivers/gpu/drm/nouveau/nouveau_fbcon.c
@@ -308,7 +308,8 @@ static int
 nouveau_fbcon_create(struct drm_fb_helper *helper,
 struct drm_fb_helper_surface_size *sizes)
 {
-   struct nouveau_fbdev *fbcon = (struct nouveau_fbdev *)helper;
+   struct nouveau_fbdev *fbcon =
+   container_of(helper, struct nouveau_fbdev, helper);
struct drm_device *dev = fbcon->dev;
struct nouveau_drm *drm = nouveau_drm(dev);
struct nvif_device *device = &drm->device;
-- 
1.9.1



[PATCH 7/9 linux-next] drm/gma500: use container_of to resolve psb_fbdev from drm_fb_helper

2014-09-14 Thread Fabian Frederick
Use container_of instead of casting first structure member.

Signed-off-by: Fabian Frederick 
---
Compiled but untested.

 drivers/gpu/drm/gma500/framebuffer.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/gma500/framebuffer.c 
b/drivers/gpu/drm/gma500/framebuffer.c
index d0dd3be..ddd90dd 100644
--- a/drivers/gpu/drm/gma500/framebuffer.c
+++ b/drivers/gpu/drm/gma500/framebuffer.c
@@ -540,7 +540,8 @@ static void psbfb_gamma_get(struct drm_crtc *crtc, u16 *red,
 static int psbfb_probe(struct drm_fb_helper *helper,
struct drm_fb_helper_surface_size *sizes)
 {
-   struct psb_fbdev *psb_fbdev = (struct psb_fbdev *)helper;
+   struct psb_fbdev *psb_fbdev =
+   container_of(helper, struct psb_fbdev, psb_fb_helper);
struct drm_device *dev = psb_fbdev->psb_fb_helper.dev;
struct drm_psb_private *dev_priv = dev->dev_private;
int bytespp;
-- 
1.9.1



[PATCH 2/9 linux-next] drm/mgag200: use container_of to resolve mga_fbdev from drm_fb_helper

2014-09-14 Thread Fabian Frederick
Use container_of instead of casting first structure member.

Signed-off-by: Fabian Frederick 
---
Compiled but untested.

 drivers/gpu/drm/mgag200/mgag200_fb.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/mgag200/mgag200_fb.c 
b/drivers/gpu/drm/mgag200/mgag200_fb.c
index 5451dc5..4415af3 100644
--- a/drivers/gpu/drm/mgag200/mgag200_fb.c
+++ b/drivers/gpu/drm/mgag200/mgag200_fb.c
@@ -158,7 +158,8 @@ static int mgag200fb_create_object(struct mga_fbdev *afbdev,
 static int mgag200fb_create(struct drm_fb_helper *helper,
   struct drm_fb_helper_surface_size *sizes)
 {
-   struct mga_fbdev *mfbdev = (struct mga_fbdev *)helper;
+   struct mga_fbdev *mfbdev =
+   container_of(helper, struct mga_fbdev, helper);
struct drm_device *dev = mfbdev->helper.dev;
struct drm_mode_fb_cmd2 mode_cmd;
struct mga_device *mdev = dev->dev_private;
-- 
1.9.1



[PATCH 0/9 linux-next] drivers/gpu/drm: use container_of where possible

2014-09-15 Thread Fabian Frederick


> On 15 September 2014 at 01:13 One Thousand Gnomes  lxorguk.ukuu.org.uk>
> wrote:
>
>
> On Sun, 14 Sep 2014 18:40:13 +0200
> Fabian Frederick  wrote:
>
> > Small patchset using container_of instead of casting on first structure
> > member address.
>
> Why. Container_of is useful for random offsets but its just convoluting
> and confusing code which is designed with the fields intentionally at the
> start.
>
> Alan

What if someone doesn't know about that intention one day and inserts
some field in the structure at the "wrong place" ?
This would need at least some comment in each declaration
but once again it's hard to control.One other way is to
commonly use container_of and get rid of every casting with
some semantic script.

Peter has been asking for container_of in the following:

http://marc.info/?l=linux-arm-kernel&m=140838705729653&w=2


struct uart_amba_port *uap = (struct uart_amba_port *)port

(port/uart_port is the first field in uart_amba_port though)

Regards,
Fabian


[PATCH 1/1] drivers/gpu/drm/drm_buffer.c: remove unnecessary null test before kfree

2014-06-28 Thread Fabian Frederick
This patch removes special case of last element and loops from idx to 0.

Cc: David Airlie 
Cc: dri-devel at lists.freedesktop.org
Signed-off-by: Fabian Frederick 
---

This is untested.

 drivers/gpu/drm/drm_buffer.c | 6 +-
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/drm_buffer.c b/drivers/gpu/drm/drm_buffer.c
index 0406110..86a4a4a 100644
--- a/drivers/gpu/drm/drm_buffer.c
+++ b/drivers/gpu/drm/drm_buffer.c
@@ -80,11 +80,7 @@ int drm_buffer_alloc(struct drm_buffer **buf, int size)

 error_out:

-   /* Only last element can be null pointer so check for it first. */
-   if ((*buf)->data[idx])
-   kfree((*buf)->data[idx]);
-
-   for (--idx; idx >= 0; --idx)
+   for (; idx >= 0; --idx)
kfree((*buf)->data[idx]);

kfree(*buf);
-- 
1.8.4.5



[PATCH 1/1 linux-next] drm/nouveau/disp: replace 0x0000 by NULL for pointer

2014-12-27 Thread Fabian Frederick
Fix sparse warning:
drivers/gpu/drm/nouveau/core/engine/disp/nvd0.c:
815:32: warning: Using plain integer as NULL pointer

Signed-off-by: Fabian Frederick 
---
 drivers/gpu/drm/nouveau/core/engine/disp/nvd0.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/nouveau/core/engine/disp/nvd0.c 
b/drivers/gpu/drm/nouveau/core/engine/disp/nvd0.c
index 181a2d5..e5ba510 100644
--- a/drivers/gpu/drm/nouveau/core/engine/disp/nvd0.c
+++ b/drivers/gpu/drm/nouveau/core/engine/disp/nvd0.c
@@ -812,7 +812,7 @@ exec_lookup(struct nv50_disp_priv *priv, int head, int or, 
u32 ctrl,
case 0x0900: type = DCB_OUTPUT_DP; mask = 2; break;
default:
nv_error(priv, "unknown SOR mc 0x%08x\n", ctrl);
-   return 0x;
+   return NULL;
}
}

-- 
2.1.0



[PATCH 1/1 linux-next] drm/gma500: replace 0 by NULL for pointer

2014-12-27 Thread Fabian Frederick
Fix sparse warning: 
drivers/gpu/drm/gma500/psb_drv.c:
328:56: warning: Using plain integer as NULL pointer

Signed-off-by: Fabian Frederick 
---
 drivers/gpu/drm/gma500/psb_drv.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/gma500/psb_drv.c b/drivers/gpu/drm/gma500/psb_drv.c
index 92e7e57..9b49c155 100644
--- a/drivers/gpu/drm/gma500/psb_drv.c
+++ b/drivers/gpu/drm/gma500/psb_drv.c
@@ -325,7 +325,7 @@ static int psb_driver_load(struct drm_device *dev, unsigned 
long flags)
if (ret)
goto out_err;

-   dev_priv->mmu = psb_mmu_driver_init(dev, 1, 0, 0);
+   dev_priv->mmu = psb_mmu_driver_init(dev, 1, 0, NULL);
if (!dev_priv->mmu)
goto out_err;

-- 
2.1.0



[PATCH 1/1] drm/i915: replace ALIGN(PAGE_SIZE) by PAGE_ALIGN

2014-07-01 Thread Fabian Frederick
use mm.h definition

Cc: Daniel Vetter 
Cc: Jani Nikula 
Cc: intel-gfx at lists.freedesktop.org
Cc: dri-devel at lists.freedesktop.org
Signed-off-by: Fabian Frederick 
---
 drivers/gpu/drm/i915/intel_display.c | 10 +-
 drivers/gpu/drm/i915/intel_fbdev.c   |  2 +-
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_display.c 
b/drivers/gpu/drm/i915/intel_display.c
index 5f285fb..f07cb83 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -6116,8 +6116,8 @@ static void i9xx_get_plane_config(struct intel_crtc *crtc,
aligned_height = intel_align_height(dev, crtc->base.primary->fb->height,
plane_config->tiled);

-   plane_config->size = ALIGN(crtc->base.primary->fb->pitches[0] *
-  aligned_height, PAGE_SIZE);
+   plane_config->size = PAGE_ALIGN(crtc->base.primary->fb->pitches[0] *
+   aligned_height);

DRM_DEBUG_KMS("pipe/plane %d/%d with fb: size=%dx%d@%d, offset=%x, 
pitch %d, size 0x%x\n",
  pipe, plane, crtc->base.primary->fb->width,
@@ -7136,8 +7136,8 @@ static void ironlake_get_plane_config(struct intel_crtc 
*crtc,
aligned_height = intel_align_height(dev, crtc->base.primary->fb->height,
plane_config->tiled);

-   plane_config->size = ALIGN(crtc->base.primary->fb->pitches[0] *
-  aligned_height, PAGE_SIZE);
+   plane_config->size = PAGE_ALIGN(crtc->base.primary->fb->pitches[0] *
+   aligned_height);

DRM_DEBUG_KMS("pipe/plane %d/%d with fb: size=%dx%d@%d, offset=%x, 
pitch %d, size 0x%x\n",
  pipe, plane, crtc->base.primary->fb->width,
@@ -8233,7 +8233,7 @@ static u32
 intel_framebuffer_size_for_mode(struct drm_display_mode *mode, int bpp)
 {
u32 pitch = intel_framebuffer_pitch_for_width(mode->hdisplay, bpp);
-   return ALIGN(pitch * mode->vdisplay, PAGE_SIZE);
+   return PAGE_ALIGN(pitch * mode->vdisplay);
 }

 static struct drm_framebuffer *
diff --git a/drivers/gpu/drm/i915/intel_fbdev.c 
b/drivers/gpu/drm/i915/intel_fbdev.c
index 088fe93..182fbc2 100644
--- a/drivers/gpu/drm/i915/intel_fbdev.c
+++ b/drivers/gpu/drm/i915/intel_fbdev.c
@@ -81,7 +81,7 @@ static int intelfb_alloc(struct drm_fb_helper *helper,
  sizes->surface_depth);

size = mode_cmd.pitches[0] * mode_cmd.height;
-   size = ALIGN(size, PAGE_SIZE);
+   size = PAGE_ALIGN(size);
obj = i915_gem_object_create_stolen(dev, size);
if (obj == NULL)
obj = i915_gem_alloc_object(dev, size);
-- 
1.9.1



[PATCH 1/1] drm/bochs: replace ALIGN(PAGE_SIZE) by PAGE_ALIGN

2014-07-01 Thread Fabian Frederick
use mm.h definition

Cc: David Airlie 
Cc: David Herrmann 
Cc: dri-devel at lists.freedesktop.org
Signed-off-by: Fabian Frederick 
---
 drivers/gpu/drm/bochs/bochs_mm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/bochs/bochs_mm.c b/drivers/gpu/drm/bochs/bochs_mm.c
index b9a695d..1728a1b 100644
--- a/drivers/gpu/drm/bochs/bochs_mm.c
+++ b/drivers/gpu/drm/bochs/bochs_mm.c
@@ -387,7 +387,7 @@ int bochs_gem_create(struct drm_device *dev, u32 size, bool 
iskernel,

*obj = NULL;

-   size = ALIGN(size, PAGE_SIZE);
+   size = PAGE_ALIGN(size);
if (size == 0)
return -EINVAL;

-- 
1.9.1



[PATCH 1/1] drm/omap: replace ALIGN(PAGE_SIZE) by PAGE_ALIGN

2014-07-01 Thread Fabian Frederick
use mm.h definition

Cc: David Airlie 
Cc: Tomi Valkeinen 
Cc: dri-devel at lists.freedesktop.org
Signed-off-by: Fabian Frederick 
---
 drivers/gpu/drm/omapdrm/omap_fbdev.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/omapdrm/omap_fbdev.c 
b/drivers/gpu/drm/omapdrm/omap_fbdev.c
index 1388ca7..8068612 100644
--- a/drivers/gpu/drm/omapdrm/omap_fbdev.c
+++ b/drivers/gpu/drm/omapdrm/omap_fbdev.c
@@ -169,7 +169,7 @@ static int omap_fbdev_create(struct drm_fb_helper *helper,
fbdev->ywrap_enabled = priv->has_dmm && ywrap_enabled;
if (fbdev->ywrap_enabled) {
/* need to align pitch to page size if using DMM scrolling */
-   mode_cmd.pitches[0] = ALIGN(mode_cmd.pitches[0], PAGE_SIZE);
+   mode_cmd.pitches[0] = PAGE_ALIGN(mode_cmd.pitches[0]);
}

/* allocate backing bo */
-- 
1.9.1



[PATCH 1/1] drm/omap: remove null test before kfree

2014-07-04 Thread Fabian Frederick
Fix checkpatch warning:
WARNING: kfree(NULL) is safe this check is probably not required

Cc: David Airlie 
Cc: David Herrmann 
Cc: Tomi Valkeinen 
Cc: dri-devel at lists.freedesktop.org
Signed-off-by: Fabian Frederick 
---
 drivers/gpu/drm/omapdrm/omap_gem.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/omap_gem.c 
b/drivers/gpu/drm/omapdrm/omap_gem.c
index 95dbce2..be0c2e8 100644
--- a/drivers/gpu/drm/omapdrm/omap_gem.c
+++ b/drivers/gpu/drm/omapdrm/omap_gem.c
@@ -1183,9 +1183,7 @@ int omap_gem_op_sync(struct drm_gem_object *obj, enum 
omap_gem_op op)
}
}
spin_unlock(&sync_lock);
-
-   if (waiter)
-   kfree(waiter);
+   kfree(waiter);
}
return ret;
 }
-- 
1.9.1



[PATCH 1/1] drm/radeon: remove null test before kfree

2014-07-04 Thread Fabian Frederick
Fix checkpatch warning:
WARNING: kfree(NULL) is safe this check is probably not required

Cc: Alex Deucher 
Cc: David Airlie 
Cc: dri-devel at lists.freedesktop.org
Signed-off-by: Fabian Frederick 
---
 drivers/gpu/drm/radeon/radeon_pm.c | 8 ++--
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/radeon/radeon_pm.c 
b/drivers/gpu/drm/radeon/radeon_pm.c
index e447e39..a06afee 100644
--- a/drivers/gpu/drm/radeon/radeon_pm.c
+++ b/drivers/gpu/drm/radeon/radeon_pm.c
@@ -1400,9 +1400,7 @@ static void radeon_pm_fini_old(struct radeon_device *rdev)
}

radeon_hwmon_fini(rdev);
-
-   if (rdev->pm.power_state)
-   kfree(rdev->pm.power_state);
+   kfree(rdev->pm.power_state);
 }

 static void radeon_pm_fini_dpm(struct radeon_device *rdev)
@@ -1421,9 +1419,7 @@ static void radeon_pm_fini_dpm(struct radeon_device *rdev)
radeon_dpm_fini(rdev);

radeon_hwmon_fini(rdev);
-
-   if (rdev->pm.power_state)
-   kfree(rdev->pm.power_state);
+   kfree(rdev->pm.power_state);
 }

 void radeon_pm_fini(struct radeon_device *rdev)
-- 
1.9.1



[PATCH 1/1] drm: replace ALIGN(PAGE_SIZE) by PAGE_ALIGN

2014-07-07 Thread Fabian Frederick
use mm.h definition

Cc: Alex Deucher 
Cc: David Airlie 
Cc: dri-devel at lists.freedesktop.org
Signed-off-by: Fabian Frederick 
---
 drivers/gpu/drm/radeon/radeon_fb.c | 2 +-
 drivers/gpu/drm/radeon/radeon_gem.c| 2 +-
 drivers/gpu/drm/radeon/radeon_object.c | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/radeon/radeon_fb.c 
b/drivers/gpu/drm/radeon/radeon_fb.c
index 665ced3..9f82605 100644
--- a/drivers/gpu/drm/radeon/radeon_fb.c
+++ b/drivers/gpu/drm/radeon/radeon_fb.c
@@ -124,7 +124,7 @@ static int radeonfb_create_pinned_object(struct 
radeon_fbdev *rfbdev,
if (rdev->family >= CHIP_R600)
height = ALIGN(mode_cmd->height, 8);
size = mode_cmd->pitches[0] * height;
-   aligned_size = ALIGN(size, PAGE_SIZE);
+   aligned_size = PAGE_ALIGN(size);
ret = radeon_gem_object_create(rdev, aligned_size, 0,
   RADEON_GEM_DOMAIN_VRAM,
   false, true,
diff --git a/drivers/gpu/drm/radeon/radeon_gem.c 
b/drivers/gpu/drm/radeon/radeon_gem.c
index d09650c..ae14fa4 100644
--- a/drivers/gpu/drm/radeon/radeon_gem.c
+++ b/drivers/gpu/drm/radeon/radeon_gem.c
@@ -569,7 +569,7 @@ int radeon_mode_dumb_create(struct drm_file *file_priv,

args->pitch = radeon_align_pitch(rdev, args->width, args->bpp, 0) * 
((args->bpp + 1) / 8);
args->size = args->pitch * args->height;
-   args->size = ALIGN(args->size, PAGE_SIZE);
+   args->size = PAGE_ALIGN(args->size);

r = radeon_gem_object_create(rdev, args->size, 0,
 RADEON_GEM_DOMAIN_VRAM,
diff --git a/drivers/gpu/drm/radeon/radeon_object.c 
b/drivers/gpu/drm/radeon/radeon_object.c
index 6c717b2..80cb77e 100644
--- a/drivers/gpu/drm/radeon/radeon_object.c
+++ b/drivers/gpu/drm/radeon/radeon_object.c
@@ -154,7 +154,7 @@ int radeon_bo_create(struct radeon_device *rdev,
size_t acc_size;
int r;

-   size = ALIGN(size, PAGE_SIZE);
+   size = PAGE_ALIGN(size);

if (kernel) {
type = ttm_bo_type_kernel;
-- 
1.8.4.5



[PATCH 1/1] drm/gma500: replace ALIGN(PAGE_SIZE) by PAGE_ALIGN

2014-07-07 Thread Fabian Frederick
use mm.h definition

Cc: David Airlie 
Cc: Patrik Jakobsson 
Cc: Daniel Vetter 
Cc: dri-devel at lists.freedesktop.org
Signed-off-by: Fabian Frederick 
---
 drivers/gpu/drm/gma500/framebuffer.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/gma500/framebuffer.c 
b/drivers/gpu/drm/gma500/framebuffer.c
index e7fcc14..fc1f4e8 100644
--- a/drivers/gpu/drm/gma500/framebuffer.c
+++ b/drivers/gpu/drm/gma500/framebuffer.c
@@ -369,7 +369,7 @@ static int psbfb_create(struct psb_fbdev *fbdev,
mode_cmd.pitches[0] =  ALIGN(mode_cmd.width * ((bpp + 7) / 8), 
4096 >> pitch_lines);

size = mode_cmd.pitches[0] * mode_cmd.height;
-   size = ALIGN(size, PAGE_SIZE);
+   size = PAGE_ALIGN(size);

/* Allocate the fb in the GTT with stolen page backing */
backing = psbfb_alloc(dev, size);
@@ -397,7 +397,7 @@ static int psbfb_create(struct psb_fbdev *fbdev,
mode_cmd.pitches[0] =  ALIGN(mode_cmd.width * ((bpp + 7) / 8), 
64);

size = mode_cmd.pitches[0] * mode_cmd.height;
-   size = ALIGN(size, PAGE_SIZE);
+   size = PAGE_ALIGN(size);

/* Allocate the framebuffer in the GTT with stolen page backing 
*/
backing = psbfb_alloc(dev, size);
-- 
1.8.4.5



[PATCH 00/35 linux-next] constify of_device_id array

2015-03-16 Thread Fabian Frederick
This small patchset adds const to of_device_id arrays in
drivers branch.

Fabian Frederick (35):
  ata: constify of_device_id array
  regulator: constify of_device_id array
  thermal: constify of_device_id array
  tty/hvc_opal: constify of_device_id array
  tty: constify of_device_id array
  power: constify of_device_id array
  char: constify of_device_id array
  dma: constify of_device_id array
  iio: constify of_device_id array
  misc: constify of_device_id array
  usb: gadget: constify of_device_id array
  mtd: constify of_device_id array
  w1: constify of_device_id array
  ide: pmac: constify of_device_id array
  spi: constify of_device_id array
  video: constify of_device_id array
  coresight-replicator: constify of_device_id array
  macintosh: constify of_device_id array
  virtio_mmio: constify of_device_id array
  swim3: constify of_device_id array
  mfd: constify of_device_id array
  soc: ti: constify of_device_id array
  [media]: constify of_device_id array
  Input: constify of_device_id array
  PCI: constify of_device_id array
  hwmon: constify of_device_id array
  reset: sti: constify of_device_id array
  uio: constify of_device_id array
  gpu: constify of_device_id array
  devfreq: constify of_device_id array
  EDAC: constify of_device_id array
  clk: constify of_device_id array
  mmc: constify of_device_id array
  Staging: octeon: constify of_device_id array
  pinctrl: constify of_device_id array

 drivers/ata/pata_macio.c | 2 +-
 drivers/ata/pata_mpc52xx.c   | 2 +-
 drivers/ata/pata_octeon_cf.c | 2 +-
 drivers/ata/pata_of_platform.c   | 2 +-
 drivers/ata/sata_fsl.c   | 2 +-
 drivers/ata/sata_mv.c| 2 +-
 drivers/ata/sata_rcar.c  | 2 +-
 drivers/block/swim3.c| 2 +-
 drivers/char/hw_random/pasemi-rng.c  | 2 +-
 drivers/char/hw_random/powernv-rng.c | 2 +-
 drivers/char/hw_random/ppc4xx-rng.c  | 2 +-
 drivers/char/ipmi/ipmi_si_intf.c | 4 ++--
 drivers/char/xillybus/xillybus_of.c  | 2 +-
 drivers/clk/clk-palmas.c | 2 +-
 drivers/clk/st/clkgen-fsyn.c | 2 +-
 drivers/clk/st/clkgen-mux.c  | 8 
 drivers/clk/st/clkgen-pll.c  | 4 ++--
 drivers/clk/ti/clk-dra7-atl.c| 2 +-
 drivers/clk/ti/clockdomain.c | 2 +-
 drivers/clk/versatile/clk-vexpress-osc.c | 2 +-
 drivers/coresight/coresight-replicator.c | 2 +-
 drivers/devfreq/event/exynos-ppmu.c  | 2 +-
 drivers/devfreq/tegra-devfreq.c  | 2 +-
 drivers/dma/bestcomm/bestcomm.c  | 4 ++--
 drivers/dma/k3dma.c  | 2 +-
 drivers/dma/mmp_pdma.c   | 2 +-
 drivers/dma/mmp_tdma.c   | 2 +-
 drivers/dma/mpc512x_dma.c| 2 +-
 drivers/dma/mv_xor.c | 2 +-
 drivers/dma/sirf-dma.c   | 2 +-
 drivers/dma/sun6i-dma.c  | 2 +-
 drivers/edac/highbank_mc_edac.c  | 2 +-
 drivers/edac/mpc85xx_edac.c  | 4 ++--
 drivers/edac/ppc4xx_edac.c   | 2 +-
 drivers/edac/synopsys_edac.c | 2 +-
 drivers/gpio/gpio-mpc8xxx.c  | 2 +-
 drivers/gpio/gpio-octeon.c   | 2 +-
 drivers/gpio/gpio-tz1090-pdc.c   | 2 +-
 drivers/gpio/gpio-tz1090.c   | 2 +-
 drivers/gpio/gpio-zynq.c | 2 +-
 drivers/gpu/drm/armada/armada_crtc.c | 2 +-
 drivers/gpu/drm/exynos/exynos_drm_dsi.c  | 2 +-
 drivers/gpu/drm/exynos/exynos_hdmi.c | 2 +-
 drivers/gpu/drm/exynos/exynos_mixer.c| 2 +-
 drivers/gpu/drm/panel/panel-ld9040.c | 2 +-
 drivers/gpu/drm/panel/panel-s6e8aa0.c| 2 +-
 drivers/gpu/drm/sti/sti_dvo.c| 2 +-
 drivers/gpu/drm/sti/sti_hqvdp.c  | 2 +-
 drivers/gpu/drm/tilcdc/tilcdc_drv.c  | 4 ++--
 drivers/gpu/drm/tilcdc/tilcdc_panel.c| 2 +-
 drivers/gpu/drm/tilcdc/tilcdc_slave.c| 4 ++--
 drivers/gpu/drm/tilcdc/tilcdc_tfp410.c   | 4 ++--
 drivers/gpu/host1x/dev.c | 2 +-
 drivers/gpu/host1x/mipi.c| 2 +-
 drivers/hwmon/pwm-fan.c  | 2 +-
 drivers/hwmon/vexpress.c | 2 +-
 drivers/ide/pmac.c   | 2 +-
 drivers/iio/common/ssp_sensors/ssp_dev.c | 2 +-
 drivers/input/misc/palmas-pwrbutton.c| 2 +-
 drivers/input/misc/regulator-haptic.c| 2 +-
 drivers/input/misc/tps65218-pwrbutton.c  | 2 +-
 drivers/input/touchscreen/ar1021_i2c.c   | 2 +-
 drivers/macintosh/mediabay.c | 2 +-
 drivers/macintosh/rack-meter.c   | 2 +-
 drivers/media/i2c/adv7604.c  | 2 +-
 drivers/media/platform/fsl-viu.c | 2 +-
 drivers/media/platform/soc_camera/rcar_vin.c

[PATCH 29/35 linux-next] gpu: constify of_device_id array

2015-03-16 Thread Fabian Frederick
of_device_id is always used as const.
(See driver.of_match_table and open firmware functions)

Signed-off-by: Fabian Frederick 
---
 drivers/gpu/drm/armada/armada_crtc.c| 2 +-
 drivers/gpu/drm/exynos/exynos_drm_dsi.c | 2 +-
 drivers/gpu/drm/exynos/exynos_hdmi.c| 2 +-
 drivers/gpu/drm/exynos/exynos_mixer.c   | 2 +-
 drivers/gpu/drm/panel/panel-ld9040.c| 2 +-
 drivers/gpu/drm/panel/panel-s6e8aa0.c   | 2 +-
 drivers/gpu/drm/sti/sti_dvo.c   | 2 +-
 drivers/gpu/drm/sti/sti_hqvdp.c | 2 +-
 drivers/gpu/drm/tilcdc/tilcdc_drv.c | 4 ++--
 drivers/gpu/drm/tilcdc/tilcdc_panel.c   | 2 +-
 drivers/gpu/drm/tilcdc/tilcdc_slave.c   | 4 ++--
 drivers/gpu/drm/tilcdc/tilcdc_tfp410.c  | 4 ++--
 drivers/gpu/host1x/dev.c| 2 +-
 drivers/gpu/host1x/mipi.c   | 2 +-
 14 files changed, 17 insertions(+), 17 deletions(-)

diff --git a/drivers/gpu/drm/armada/armada_crtc.c 
b/drivers/gpu/drm/armada/armada_crtc.c
index 42d2ffa..517542f 100644
--- a/drivers/gpu/drm/armada/armada_crtc.c
+++ b/drivers/gpu/drm/armada/armada_crtc.c
@@ -1201,7 +1201,7 @@ static int armada_lcd_remove(struct platform_device *pdev)
return 0;
 }

-static struct of_device_id armada_lcd_of_match[] = {
+static const struct of_device_id armada_lcd_of_match[] = {
{
.compatible = "marvell,dove-lcd",
.data   = &armada510_ops,
diff --git a/drivers/gpu/drm/exynos/exynos_drm_dsi.c 
b/drivers/gpu/drm/exynos/exynos_drm_dsi.c
index 05fe93d..78afb45 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_dsi.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_dsi.c
@@ -330,7 +330,7 @@ static struct exynos_dsi_driver_data 
exynos5_dsi_driver_data = {
.plltmr_reg = 0x58,
 };

-static struct of_device_id exynos_dsi_of_match[] = {
+static const struct of_device_id exynos_dsi_of_match[] = {
{ .compatible = "samsung,exynos3250-mipi-dsi",
  .data = &exynos3_dsi_driver_data },
{ .compatible = "samsung,exynos4210-mipi-dsi",
diff --git a/drivers/gpu/drm/exynos/exynos_hdmi.c 
b/drivers/gpu/drm/exynos/exynos_hdmi.c
index 229b361..0294402 100644
--- a/drivers/gpu/drm/exynos/exynos_hdmi.c
+++ b/drivers/gpu/drm/exynos/exynos_hdmi.c
@@ -2274,7 +2274,7 @@ err_data:
return NULL;
 }

-static struct of_device_id hdmi_match_types[] = {
+static const struct of_device_id hdmi_match_types[] = {
{
.compatible = "samsung,exynos5-hdmi",
.data = &exynos5_hdmi_driver_data,
diff --git a/drivers/gpu/drm/exynos/exynos_mixer.c 
b/drivers/gpu/drm/exynos/exynos_mixer.c
index 3518bc4..6297105 100644
--- a/drivers/gpu/drm/exynos/exynos_mixer.c
+++ b/drivers/gpu/drm/exynos/exynos_mixer.c
@@ -1224,7 +1224,7 @@ static struct platform_device_id mixer_driver_types[] = {
}
 };

-static struct of_device_id mixer_match_types[] = {
+static const struct of_device_id mixer_match_types[] = {
{
.compatible = "samsung,exynos4210-mixer",
.data   = &exynos4210_mxr_drv_data,
diff --git a/drivers/gpu/drm/panel/panel-ld9040.c 
b/drivers/gpu/drm/panel/panel-ld9040.c
index 08cf2c5..0ab5b69 100644
--- a/drivers/gpu/drm/panel/panel-ld9040.c
+++ b/drivers/gpu/drm/panel/panel-ld9040.c
@@ -367,7 +367,7 @@ static int ld9040_remove(struct spi_device *spi)
return 0;
 }

-static struct of_device_id ld9040_of_match[] = {
+static const struct of_device_id ld9040_of_match[] = {
{ .compatible = "samsung,ld9040" },
{ }
 };
diff --git a/drivers/gpu/drm/panel/panel-s6e8aa0.c 
b/drivers/gpu/drm/panel/panel-s6e8aa0.c
index 144b273..3005110 100644
--- a/drivers/gpu/drm/panel/panel-s6e8aa0.c
+++ b/drivers/gpu/drm/panel/panel-s6e8aa0.c
@@ -1041,7 +1041,7 @@ static int s6e8aa0_remove(struct mipi_dsi_device *dsi)
return 0;
 }

-static struct of_device_id s6e8aa0_of_match[] = {
+static const struct of_device_id s6e8aa0_of_match[] = {
{ .compatible = "samsung,s6e8aa0" },
{ }
 };
diff --git a/drivers/gpu/drm/sti/sti_dvo.c b/drivers/gpu/drm/sti/sti_dvo.c
index aeb5070..f619ae2 100644
--- a/drivers/gpu/drm/sti/sti_dvo.c
+++ b/drivers/gpu/drm/sti/sti_dvo.c
@@ -537,7 +537,7 @@ static int sti_dvo_remove(struct platform_device *pdev)
return 0;
 }

-static struct of_device_id dvo_of_match[] = {
+static const struct of_device_id dvo_of_match[] = {
{ .compatible = "st,stih407-dvo", },
{ /* end node */ }
 };
diff --git a/drivers/gpu/drm/sti/sti_hqvdp.c b/drivers/gpu/drm/sti/sti_hqvdp.c
index b0eb62d..d4324f1 100644
--- a/drivers/gpu/drm/sti/sti_hqvdp.c
+++ b/drivers/gpu/drm/sti/sti_hqvdp.c
@@ -1050,7 +1050,7 @@ static int sti_hqvdp_remove(struct platform_device *pdev)
return 0;
 }

-static struct of_device_id hqvdp_of_match[] = {
+static const struct of_device_id hqvdp_of_match[] = {
{ .compatible = "st,stih407-hqvdp", },
{ /* end node */ }

[PATCH 1/2 linux-next] drm/msm: use IS_ERR() to check msm_ioremap() return

2015-05-04 Thread Fabian Frederick
msm_ioremap() never returns NULL. There's no need for IS_ERR_OR_NULL()

Signed-off-by: Fabian Frederick 
---
 drivers/gpu/drm/msm/dsi/dsi_phy.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/msm/dsi/dsi_phy.c 
b/drivers/gpu/drm/msm/dsi/dsi_phy.c
index f0cea89..61af193 100644
--- a/drivers/gpu/drm/msm/dsi/dsi_phy.c
+++ b/drivers/gpu/drm/msm/dsi/dsi_phy.c
@@ -300,12 +300,12 @@ struct msm_dsi_phy *msm_dsi_phy_init(struct 
platform_device *pdev,
return NULL;

phy->base = msm_ioremap(pdev, "dsi_phy", "DSI_PHY");
-   if (IS_ERR_OR_NULL(phy->base)) {
+   if (IS_ERR(phy->base)) {
pr_err("%s: failed to map phy base\n", __func__);
return NULL;
}
phy->reg_base = msm_ioremap(pdev, "dsi_phy_regulator", "DSI_PHY_REG");
-   if (IS_ERR_OR_NULL(phy->reg_base)) {
+   if (IS_ERR(phy->reg_base)) {
pr_err("%s: failed to map phy regulator base\n", __func__);
return NULL;
}
-- 
1.9.1



[PATCH 2/2 linux-next] drm/msm: use IS_ERR() to check regulator_get() return

2015-05-04 Thread Fabian Frederick
regulator_get() never returns NULL. There's no need for IS_ERR_OR_NULL()

Signed-off-by: Fabian Frederick 
---
 drivers/gpu/drm/msm/dsi/dsi_host.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/msm/dsi/dsi_host.c 
b/drivers/gpu/drm/msm/dsi/dsi_host.c
index 956b224..642cbaf 100644
--- a/drivers/gpu/drm/msm/dsi/dsi_host.c
+++ b/drivers/gpu/drm/msm/dsi/dsi_host.c
@@ -273,7 +273,7 @@ static const struct dsi_config *dsi_get_config(struct 
msm_dsi_host *msm_host)
u32 major = 0, minor = 0;

gdsc_reg = regulator_get(&msm_host->pdev->dev, "gdsc");
-   if (IS_ERR_OR_NULL(gdsc_reg)) {
+   if (IS_ERR(gdsc_reg)) {
pr_err("%s: cannot get gdsc\n", __func__);
goto fail;
}
-- 
1.9.1



[PATCH 2/2 linux-next] drm/msm: use IS_ERR() to check regulator_get() return

2015-05-06 Thread Fabian Frederick
Please ignore this patch, I just noticed conditional regulator_get()
definition (#if defined(CONFIG_REGULATOR))

Regards,
Fabian


[PATCH 1/1 linux-next] drm: atmel-hlcdc: use swap() in atmel_hlcdc_plane_atomic_check()

2015-06-10 Thread Fabian Frederick
Use kernel.h macro definition.

Thanks to Julia Lawall for Coccinelle scripting support.

Signed-off-by: Fabian Frederick 
---
 drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c | 9 ++---
 1 file changed, 2 insertions(+), 7 deletions(-)

diff --git a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c 
b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c
index be9fa82..abe3ba9 100644
--- a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c
+++ b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c
@@ -548,7 +548,6 @@ static int atmel_hlcdc_plane_atomic_check(struct drm_plane 
*p,
unsigned int patched_crtc_h;
unsigned int patched_src_w;
unsigned int patched_src_h;
-   unsigned int tmp;
int x_offset = 0;
int y_offset = 0;
int hsub = 1;
@@ -586,12 +585,8 @@ static int atmel_hlcdc_plane_atomic_check(struct drm_plane 
*p,
 * Swap width and size in case of 90 or 270 degrees rotation
 */
if (state->base.rotation & (BIT(DRM_ROTATE_90) | BIT(DRM_ROTATE_270))) {
-   tmp = state->crtc_w;
-   state->crtc_w = state->crtc_h;
-   state->crtc_h = tmp;
-   tmp = state->src_w;
-   state->src_w = state->src_h;
-   state->src_h = tmp;
+   swap(state->crtc_w, state->crtc_h);
+   swap(state->src_w, state->src_h);
}

if (state->crtc_x + state->crtc_w > mode->hdisplay)
-- 
2.4.2



[PATCH 1/1 linux-next] drm/i915: use ERR_CAST instead of ERR_PTR/PTR_ERR

2015-04-25 Thread Fabian Frederick
Inspired by scripts/coccinelle/api/err_cast.cocci

Signed-off-by: Fabian Frederick 
---
 drivers/gpu/drm/i915/intel_drv.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
index 897f17d..d52f267 100644
--- a/drivers/gpu/drm/i915/intel_drv.h
+++ b/drivers/gpu/drm/i915/intel_drv.h
@@ -1310,7 +1310,7 @@ intel_atomic_get_crtc_state(struct drm_atomic_state 
*state,
struct drm_crtc_state *crtc_state;
crtc_state = drm_atomic_get_crtc_state(state, &crtc->base);
if (IS_ERR(crtc_state))
-   return ERR_PTR(PTR_ERR(crtc_state));
+   return ERR_CAST(crtc_state);

return to_intel_crtc_state(crtc_state);
 }
-- 
1.9.1