[PATCH] staging: bcm2835-audio: Fix memory corruption

2017-08-11 Thread Phil Elwell
The previous commit (0adbfd46) fixed a memory leak but also freed a
block in the success case, causing a stale pointer to be used with
potentially fatal results. Only free the vchi_instance block in the
case that vchi_connect fails; once connected, the instance is
retained for subsequent connections.

Simplifying the code by removing a bunch of gotos and returning errors
directly.

Signed-off-by: Phil Elwell 
Fixes: 0adbfd4694c2 ("staging: bcm2835-audio: fix memory leak in 
bcm2835_audio_open_connection()")
---
v2: Simplified following feedback from Dan Carpenter.
---
 .../vc04_services/bcm2835-audio/bcm2835-vchiq.c   | 19 +++
 1 file changed, 7 insertions(+), 12 deletions(-)

diff --git a/drivers/staging/vc04_services/bcm2835-audio/bcm2835-vchiq.c 
b/drivers/staging/vc04_services/bcm2835-audio/bcm2835-vchiq.c
index 5f3d8f2..4be864d 100644
--- a/drivers/staging/vc04_services/bcm2835-audio/bcm2835-vchiq.c
+++ b/drivers/staging/vc04_services/bcm2835-audio/bcm2835-vchiq.c
@@ -390,8 +390,7 @@ static int bcm2835_audio_open_connection(struct 
bcm2835_alsa_stream *alsa_stream
__func__, instance);
instance->alsa_stream = alsa_stream;
alsa_stream->instance = instance;
-   ret = 0; // xxx todo -1;
-   goto err_free_mem;
+   return 0;
}
 
/* Initialize and create a VCHI connection */
@@ -401,16 +400,15 @@ static int bcm2835_audio_open_connection(struct 
bcm2835_alsa_stream *alsa_stream
LOG_ERR("%s: failed to initialise VCHI instance 
(ret=%d)\n",
__func__, ret);
 
-   ret = -EIO;
-   goto err_free_mem;
+   return -EIO;
}
ret = vchi_connect(NULL, 0, vchi_instance);
if (ret) {
LOG_ERR("%s: failed to connect VCHI instance 
(ret=%d)\n",
__func__, ret);
 
-   ret = -EIO;
-   goto err_free_mem;
+   kfree(vchi_instance);
+   return -EIO;
}
initted = 1;
}
@@ -421,19 +419,16 @@ static int bcm2835_audio_open_connection(struct 
bcm2835_alsa_stream *alsa_stream
if (IS_ERR(instance)) {
LOG_ERR("%s: failed to initialize audio service\n", __func__);
 
-   ret = PTR_ERR(instance);
-   goto err_free_mem;
+   /* vchi_instance is retained for use the next time. */
+   return PTR_ERR(instance);
}
 
instance->alsa_stream = alsa_stream;
alsa_stream->instance = instance;
 
LOG_DBG(" success !\n");
-   ret = 0;
-err_free_mem:
-   kfree(vchi_instance);
 
-   return ret;
+   return 0;
 }
 
 int bcm2835_audio_open(struct bcm2835_alsa_stream *alsa_stream)
-- 
1.9.1

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


[PATCH v2] staging: bcm2835-audio: Fix memory corruption

2017-08-11 Thread Phil Elwell
The previous commit (0adbfd46) fixed a memory leak but also freed a
block in the success case, causing a stale pointer to be used with
potentially fatal results. Only free the vchi_instance block in the
case that vchi_connect fails; once connected, the instance is
retained for subsequent connections.

Simplifying the code by removing a bunch of gotos and returning errors
directly.

Signed-off-by: Phil Elwell 
Fixes: 0adbfd4694c2 ("staging: bcm2835-audio: fix memory leak in 
bcm2835_audio_open_connection()")
---
[Resend with v2 in subject]
v2: Simplified following feedback from Dan Carpenter.
---
 .../vc04_services/bcm2835-audio/bcm2835-vchiq.c   | 19 +++
 1 file changed, 7 insertions(+), 12 deletions(-)

diff --git a/drivers/staging/vc04_services/bcm2835-audio/bcm2835-vchiq.c 
b/drivers/staging/vc04_services/bcm2835-audio/bcm2835-vchiq.c
index 5f3d8f2..4be864d 100644
--- a/drivers/staging/vc04_services/bcm2835-audio/bcm2835-vchiq.c
+++ b/drivers/staging/vc04_services/bcm2835-audio/bcm2835-vchiq.c
@@ -390,8 +390,7 @@ static int bcm2835_audio_open_connection(struct 
bcm2835_alsa_stream *alsa_stream
__func__, instance);
instance->alsa_stream = alsa_stream;
alsa_stream->instance = instance;
-   ret = 0; // xxx todo -1;
-   goto err_free_mem;
+   return 0;
}
 
/* Initialize and create a VCHI connection */
@@ -401,16 +400,15 @@ static int bcm2835_audio_open_connection(struct 
bcm2835_alsa_stream *alsa_stream
LOG_ERR("%s: failed to initialise VCHI instance 
(ret=%d)\n",
__func__, ret);
 
-   ret = -EIO;
-   goto err_free_mem;
+   return -EIO;
}
ret = vchi_connect(NULL, 0, vchi_instance);
if (ret) {
LOG_ERR("%s: failed to connect VCHI instance 
(ret=%d)\n",
__func__, ret);
 
-   ret = -EIO;
-   goto err_free_mem;
+   kfree(vchi_instance);
+   return -EIO;
}
initted = 1;
}
@@ -421,19 +419,16 @@ static int bcm2835_audio_open_connection(struct 
bcm2835_alsa_stream *alsa_stream
if (IS_ERR(instance)) {
LOG_ERR("%s: failed to initialize audio service\n", __func__);
 
-   ret = PTR_ERR(instance);
-   goto err_free_mem;
+   /* vchi_instance is retained for use the next time. */
+   return PTR_ERR(instance);
}
 
instance->alsa_stream = alsa_stream;
alsa_stream->instance = instance;
 
LOG_DBG(" success !\n");
-   ret = 0;
-err_free_mem:
-   kfree(vchi_instance);
 
-   return ret;
+   return 0;
 }
 
 int bcm2835_audio_open(struct bcm2835_alsa_stream *alsa_stream)
-- 
1.9.1

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


BIDDING PARTNERSHIP

2017-08-11 Thread Jason Hammond
Dearest Partner

We solicit your partnership in a multi million dollars bid repayment proposal 
for contract in Iraq.We would be happy to work with your esteemed person or 
company in this capacity. We would appreciate if you send a positive response 
to us on investme...@yc-assets.biz to enable us send you full details of the 
contract bid.

Thanks

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


[PATCH v3 00/28] DRM API Conversions

2017-08-11 Thread Cihangir Akturk
Changes since v2:

- Patch series is based on *drm-misc-next* as suggested by Sean Paul.

- Dropped patch 05 (drm/atmel-hlcdc) and patch 25 (drm/vc4) from v2,
  since they were already pulled in the drm-misc-next

Changes since v1:

- This time patches were generated with coccinelle instead of my own
  script, as suggested by Daniel Vetter.

- Fixed the typo in commit messages. s/adn/and

Note: I've included r-b, a-b tags, as these patches are identical to v1
except for the file: drivers/gpu/drm/i915/i915_gem_object.h

This patch set replaces the occurrences of drm_*_reference() and
drm_*_unreference() with the new drm_*_get() and drm_*_put() functions.
All patches in the series do the same thing, converting to the new APIs.
I created patches per DRM driver as suggested by Daniel Vetter.

This patch set was generated by scripts/coccinelle/api/drm-get-put.cocci

Previous thread can be reached at:
https://marc.info/?l=dri-devel&m=150178288816047

Background:

In the kernel, reference counting APIs use *_get(), *_put() style naming
to reference-count the objects. But DRM subsystem uses a different
naming for them such as *_reference(), *_unreference() which is
inconsistent with the other reference counting APIs in the kernel. To
solve this consistency issue, Thierry Reding introduced a couple of
functions and compatibility aliases in the following commits for them.

commit 020a218f95bd3ceff7dd1022ff7ebc0497bc7bf9
Author: Thierry Reding 
Date:   Tue Feb 28 15:46:38 2017 +0100

drm: Introduce drm_mode_object_{get,put}()

commit ad09360750afa18a0a0ce0253d6ea6033abc22e7
Author: Thierry Reding 
Date:   Tue Feb 28 15:46:39 2017 +0100

drm: Introduce drm_connector_{get,put}()

commit a4a69da06bc11a937a6e417938b1bb698ee1fa46
Author: Thierry Reding 
Date:   Tue Feb 28 15:46:40 2017 +0100

drm: Introduce drm_framebuffer_{get,put}()

commit e6b62714e87c8811d5564b6a0738dcde63a51774
Author: Thierry Reding 
Date:   Tue Feb 28 15:46:41 2017 +0100

drm: Introduce drm_gem_object_{get,put}()

commit 6472e5090be7c78749a3c279b4faae87ab835c40
Author: Thierry Reding 
Date:   Tue Feb 28 15:46:42 2017 +0100

drm: Introduce drm_property_blob_{get,put}()

Cihangir Akturk (28):
  drm/amdgpu: switch to drm_*_get(), drm_*_put() helpers
  drm: mali-dp: switch to drm_*_get(), drm_*_put() helpers
  drm/armada: switch to drm_*_get(), drm_*_put() helpers
  drm/ast: switch to drm_*_get(), drm_*_put() helpers
  drm/bochs: switch to drm_*_get(), drm_*_put() helpers
  drm/cirrus: switch to drm_*_get(), drm_*_put() helpers
  drm/etnaviv: switch to drm_*_get(), drm_*_put() helpers
  drm/exynos: switch to drm_*_get(), drm_*_put() helpers
  drm/gma500: switch to drm_*_get(), drm_*_put() helpers
  drm/hisilicon: switch to drm_*_get(), drm_*_put() helpers
  drm/i915: switch to drm_*_get(), drm_*_put() helpers
  drm/imx: switch to drm_*_get(), drm_*_put() helpers
  drm/mediatek: switch to drm_*_get(), drm_*_put() helpers
  drm/mgag200: switch to drm_*_get(), drm_*_put() helpers
  drm/msm: switch to drm_*_get(), drm_*_put() helpers
  drm/nouveau: switch to drm_*_get(), drm_*_put() helpers
  drm/omapdrm: switch to drm_*_get(), drm_*_put() helpers
  drm/qxl: switch to drm_*_get(), drm_*_put() helpers
  drm/radeon: switch to drm_*_get(), drm_*_put() helpers
  drm/rockchip: switch to drm_*_get(), drm_*_put() helpers
  drm/tegra: switch to drm_*_get(), drm_*_put() helpers
  drm/tilcdc: switch to drm_*_get(), drm_*_put() helpers
  drm/udl: switch to drm_*_get(), drm_*_put() helpers
  drm/vc4: switch to drm_*_get(), drm_*_put() helpers
  drm/vgem: switch to drm_*_get(), drm_*_put() helpers
  drm/virtio: switch to drm_*_get(), drm_*_put() helpers
  drm/vmwgfx: switch to drm_*_get(), drm_*_put() helpers
  drm: vboxvideo: switch to drm_*_get(), drm_*_put() helpers

 drivers/gpu/drm/amd/amdgpu/amdgpu_bo_list.c   |  2 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c|  2 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_display.c   |  6 ++---
 drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c|  4 +--
 drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c   | 22 -
 drivers/gpu/drm/amd/amdgpu/dce_v10_0.c|  6 ++---
 drivers/gpu/drm/amd/amdgpu/dce_v11_0.c|  6 ++---
 drivers/gpu/drm/amd/amdgpu/dce_v6_0.c |  6 ++---
 drivers/gpu/drm/amd/amdgpu/dce_v8_0.c |  6 ++---
 drivers/gpu/drm/arm/malidp_planes.c   |  2 +-
 drivers/gpu/drm/armada/armada_crtc.c  | 22 -
 drivers/gpu/drm/armada/armada_drv.c   |  2 +-
 drivers/gpu/drm/armada/armada_fb.c|  8 +++---
 drivers/gpu/drm/armada/armada_fbdev.c |  6 ++---
 drivers/gpu/drm/armada/armada_gem.c   | 14 +--
 drivers/gpu/drm/armada/armada_overlay.c   |  4 +--
 drivers/gpu/drm/ast/ast_fb.c  |  2 +-
 drivers/gpu/drm/ast/ast_main.c| 10 
 drivers/gpu/drm/ast/ast_mode.c|  6 ++---
 drivers/

[PATCH v3 28/28] drm: vboxvideo: switch to drm_*_get(), drm_*_put() helpers

2017-08-11 Thread Cihangir Akturk
Use drm_*_get() and drm_*_put() helpers instead of drm_*_reference()
and drm_*_unreference() helpers.

drm_*_reference() and drm_*_unreference() functions are just
compatibility alias for drm_*_get() and drm_*_put() and should not be
used by new code. So convert all users of compatibility functions to
use the new APIs.

Generated by: scripts/coccinelle/api/drm-get-put.cocci

Signed-off-by: Cihangir Akturk 
---
 drivers/staging/vboxvideo/vbox_fb.c   | 2 +-
 drivers/staging/vboxvideo/vbox_main.c | 8 
 drivers/staging/vboxvideo/vbox_mode.c | 2 +-
 3 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/vboxvideo/vbox_fb.c 
b/drivers/staging/vboxvideo/vbox_fb.c
index bf66358..c157284 100644
--- a/drivers/staging/vboxvideo/vbox_fb.c
+++ b/drivers/staging/vboxvideo/vbox_fb.c
@@ -343,7 +343,7 @@ void vbox_fbdev_fini(struct drm_device *dev)
vbox_bo_unpin(bo);
vbox_bo_unreserve(bo);
}
-   drm_gem_object_unreference_unlocked(afb->obj);
+   drm_gem_object_put_unlocked(afb->obj);
afb->obj = NULL;
}
drm_fb_helper_fini(&fbdev->helper);
diff --git a/drivers/staging/vboxvideo/vbox_main.c 
b/drivers/staging/vboxvideo/vbox_main.c
index d0c6ec7..80bd039 100644
--- a/drivers/staging/vboxvideo/vbox_main.c
+++ b/drivers/staging/vboxvideo/vbox_main.c
@@ -40,7 +40,7 @@ static void vbox_user_framebuffer_destroy(struct 
drm_framebuffer *fb)
struct vbox_framebuffer *vbox_fb = to_vbox_framebuffer(fb);
 
if (vbox_fb->obj)
-   drm_gem_object_unreference_unlocked(vbox_fb->obj);
+   drm_gem_object_put_unlocked(vbox_fb->obj);
 
drm_framebuffer_cleanup(fb);
kfree(fb);
@@ -198,7 +198,7 @@ static struct drm_framebuffer *vbox_user_framebuffer_create(
 err_free_vbox_fb:
kfree(vbox_fb);
 err_unref_obj:
-   drm_gem_object_unreference_unlocked(obj);
+   drm_gem_object_put_unlocked(obj);
return ERR_PTR(ret);
 }
 
@@ -472,7 +472,7 @@ int vbox_dumb_create(struct drm_file *file,
return ret;
 
ret = drm_gem_handle_create(file, gobj, &handle);
-   drm_gem_object_unreference_unlocked(gobj);
+   drm_gem_object_put_unlocked(gobj);
if (ret)
return ret;
 
@@ -525,7 +525,7 @@ vbox_dumb_mmap_offset(struct drm_file *file,
bo = gem_to_vbox_bo(obj);
*offset = vbox_bo_mmap_offset(bo);
 
-   drm_gem_object_unreference(obj);
+   drm_gem_object_put(obj);
ret = 0;
 
 out_unlock:
diff --git a/drivers/staging/vboxvideo/vbox_mode.c 
b/drivers/staging/vboxvideo/vbox_mode.c
index 996da1c..e5b6383 100644
--- a/drivers/staging/vboxvideo/vbox_mode.c
+++ b/drivers/staging/vboxvideo/vbox_mode.c
@@ -812,7 +812,7 @@ static int vbox_cursor_set2(struct drm_crtc *crtc, struct 
drm_file *file_priv,
 out_unreserve_bo:
vbox_bo_unreserve(bo);
 out_unref_obj:
-   drm_gem_object_unreference_unlocked(obj);
+   drm_gem_object_put_unlocked(obj);
 
return ret;
 }
-- 
2.7.4

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


Re: [PATCH v3 28/28] drm: vboxvideo: switch to drm_*_get(), drm_*_put() helpers

2017-08-11 Thread Hans de Goede

Hi,

On 11-08-17 14:33, Cihangir Akturk wrote:

Use drm_*_get() and drm_*_put() helpers instead of drm_*_reference()
and drm_*_unreference() helpers.

drm_*_reference() and drm_*_unreference() functions are just
compatibility alias for drm_*_get() and drm_*_put() and should not be
used by new code. So convert all users of compatibility functions to
use the new APIs.

Generated by: scripts/coccinelle/api/drm-get-put.cocci

Signed-off-by: Cihangir Akturk 


Thank you for doing this, looks good to me:

Reviewed-by: Hans de Goede 

Regards,

Hans




---
  drivers/staging/vboxvideo/vbox_fb.c   | 2 +-
  drivers/staging/vboxvideo/vbox_main.c | 8 
  drivers/staging/vboxvideo/vbox_mode.c | 2 +-
  3 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/vboxvideo/vbox_fb.c 
b/drivers/staging/vboxvideo/vbox_fb.c
index bf66358..c157284 100644
--- a/drivers/staging/vboxvideo/vbox_fb.c
+++ b/drivers/staging/vboxvideo/vbox_fb.c
@@ -343,7 +343,7 @@ void vbox_fbdev_fini(struct drm_device *dev)
vbox_bo_unpin(bo);
vbox_bo_unreserve(bo);
}
-   drm_gem_object_unreference_unlocked(afb->obj);
+   drm_gem_object_put_unlocked(afb->obj);
afb->obj = NULL;
}
drm_fb_helper_fini(&fbdev->helper);
diff --git a/drivers/staging/vboxvideo/vbox_main.c 
b/drivers/staging/vboxvideo/vbox_main.c
index d0c6ec7..80bd039 100644
--- a/drivers/staging/vboxvideo/vbox_main.c
+++ b/drivers/staging/vboxvideo/vbox_main.c
@@ -40,7 +40,7 @@ static void vbox_user_framebuffer_destroy(struct 
drm_framebuffer *fb)
struct vbox_framebuffer *vbox_fb = to_vbox_framebuffer(fb);
  
  	if (vbox_fb->obj)

-   drm_gem_object_unreference_unlocked(vbox_fb->obj);
+   drm_gem_object_put_unlocked(vbox_fb->obj);
  
  	drm_framebuffer_cleanup(fb);

kfree(fb);
@@ -198,7 +198,7 @@ static struct drm_framebuffer *vbox_user_framebuffer_create(
  err_free_vbox_fb:
kfree(vbox_fb);
  err_unref_obj:
-   drm_gem_object_unreference_unlocked(obj);
+   drm_gem_object_put_unlocked(obj);
return ERR_PTR(ret);
  }
  
@@ -472,7 +472,7 @@ int vbox_dumb_create(struct drm_file *file,

return ret;
  
  	ret = drm_gem_handle_create(file, gobj, &handle);

-   drm_gem_object_unreference_unlocked(gobj);
+   drm_gem_object_put_unlocked(gobj);
if (ret)
return ret;
  
@@ -525,7 +525,7 @@ vbox_dumb_mmap_offset(struct drm_file *file,

bo = gem_to_vbox_bo(obj);
*offset = vbox_bo_mmap_offset(bo);
  
-	drm_gem_object_unreference(obj);

+   drm_gem_object_put(obj);
ret = 0;
  
  out_unlock:

diff --git a/drivers/staging/vboxvideo/vbox_mode.c 
b/drivers/staging/vboxvideo/vbox_mode.c
index 996da1c..e5b6383 100644
--- a/drivers/staging/vboxvideo/vbox_mode.c
+++ b/drivers/staging/vboxvideo/vbox_mode.c
@@ -812,7 +812,7 @@ static int vbox_cursor_set2(struct drm_crtc *crtc, struct 
drm_file *file_priv,
  out_unreserve_bo:
vbox_bo_unreserve(bo);
  out_unref_obj:
-   drm_gem_object_unreference_unlocked(obj);
+   drm_gem_object_put_unlocked(obj);
  
  	return ret;

  }


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


Re: [PATCH v2] staging: bcm2835-audio: Fix memory corruption

2017-08-11 Thread Dan Carpenter
Looks Ok to me.

regards,
dan carpenter

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


Re: [PATCH v3 00/28] DRM API Conversions

2017-08-11 Thread Cihangir Akturk
On Fri, Aug 11, 2017 at 02:24:19PM +, Deucher, Alexander wrote:
> > -Original Message-
> > From: amd-gfx [mailto:amd-gfx-boun...@lists.freedesktop.org] On Behalf
> > Of Cihangir Akturk
> > Sent: Friday, August 11, 2017 8:33 AM
> > Cc: de...@driverdev.osuosl.org; linux-arm-...@vger.kernel.org; intel-
> > g...@lists.freedesktop.org; linux-ker...@vger.kernel.org; dri-
> > de...@lists.freedesktop.org; etna...@lists.freedesktop.org; Cihangir Akturk;
> > amd-...@lists.freedesktop.org; dan...@ffwll.ch;
> > nouv...@lists.freedesktop.org; linux-te...@vger.kernel.org;
> > virtualizat...@lists.linux-foundation.org; freedr...@lists.freedesktop.org
> > Subject: [PATCH v3 00/28] DRM API Conversions
> > 
> > Changes since v2:
> > 
> > - Patch series is based on *drm-misc-next* as suggested by Sean Paul.
> > 
> > - Dropped patch 05 (drm/atmel-hlcdc) and patch 25 (drm/vc4) from v2,
> >   since they were already pulled in the drm-misc-next
> > 
> > Changes since v1:
> > 
> > - This time patches were generated with coccinelle instead of my own
> >   script, as suggested by Daniel Vetter.
> > 
> > - Fixed the typo in commit messages. s/adn/and
> > 
> 
> FWIW, I already picked up v1 of these patches for radeon and amdgpu.

I think you can skip these patches of v3 for amdgpu and radeon, as
they have remained unchanged since v1.

> 
> Alex
> 
> > Note: I've included r-b, a-b tags, as these patches are identical to v1
> > except for the file: drivers/gpu/drm/i915/i915_gem_object.h
> > 
> > This patch set replaces the occurrences of drm_*_reference() and
> > drm_*_unreference() with the new drm_*_get() and drm_*_put()
> > functions.
> > All patches in the series do the same thing, converting to the new APIs.
> > I created patches per DRM driver as suggested by Daniel Vetter.
> > 
> > This patch set was generated by scripts/coccinelle/api/drm-get-put.cocci
> > 
> > Previous thread can be reached at:
> > https://marc.info/?l=dri-devel&m=150178288816047
> > 
> > Background:
> > 
> > In the kernel, reference counting APIs use *_get(), *_put() style naming
> > to reference-count the objects. But DRM subsystem uses a different
> > naming for them such as *_reference(), *_unreference() which is
> > inconsistent with the other reference counting APIs in the kernel. To
> > solve this consistency issue, Thierry Reding introduced a couple of
> > functions and compatibility aliases in the following commits for them.
> > 
> > commit 020a218f95bd3ceff7dd1022ff7ebc0497bc7bf9
> > Author: Thierry Reding 
> > Date:   Tue Feb 28 15:46:38 2017 +0100
> > 
> > drm: Introduce drm_mode_object_{get,put}()
> > 
> > commit ad09360750afa18a0a0ce0253d6ea6033abc22e7
> > Author: Thierry Reding 
> > Date:   Tue Feb 28 15:46:39 2017 +0100
> > 
> > drm: Introduce drm_connector_{get,put}()
> > 
> > commit a4a69da06bc11a937a6e417938b1bb698ee1fa46
> > Author: Thierry Reding 
> > Date:   Tue Feb 28 15:46:40 2017 +0100
> > 
> > drm: Introduce drm_framebuffer_{get,put}()
> > 
> > commit e6b62714e87c8811d5564b6a0738dcde63a51774
> > Author: Thierry Reding 
> > Date:   Tue Feb 28 15:46:41 2017 +0100
> > 
> > drm: Introduce drm_gem_object_{get,put}()
> > 
> > commit 6472e5090be7c78749a3c279b4faae87ab835c40
> > Author: Thierry Reding 
> > Date:   Tue Feb 28 15:46:42 2017 +0100
> > 
> > drm: Introduce drm_property_blob_{get,put}()
> > 
> > Cihangir Akturk (28):
> >   drm/amdgpu: switch to drm_*_get(), drm_*_put() helpers
> >   drm: mali-dp: switch to drm_*_get(), drm_*_put() helpers
> >   drm/armada: switch to drm_*_get(), drm_*_put() helpers
> >   drm/ast: switch to drm_*_get(), drm_*_put() helpers
> >   drm/bochs: switch to drm_*_get(), drm_*_put() helpers
> >   drm/cirrus: switch to drm_*_get(), drm_*_put() helpers
> >   drm/etnaviv: switch to drm_*_get(), drm_*_put() helpers
> >   drm/exynos: switch to drm_*_get(), drm_*_put() helpers
> >   drm/gma500: switch to drm_*_get(), drm_*_put() helpers
> >   drm/hisilicon: switch to drm_*_get(), drm_*_put() helpers
> >   drm/i915: switch to drm_*_get(), drm_*_put() helpers
> >   drm/imx: switch to drm_*_get(), drm_*_put() helpers
> >   drm/mediatek: switch to drm_*_get(), drm_*_put() helpers
> >   drm/mgag200: switch to drm_*_get(), drm_*_put() helpers
> >   drm/msm: switch to drm_*_get(), drm_*_put() helpers
> >   drm/nouveau: switch to drm_*_get(), drm_*_put() helpers
> >   drm/omapdrm: switch to drm_*_get(), drm_*_put() helpers
> >   drm/qxl: switch to drm_*_get(), drm_*_put() helpers
> >   drm/radeon: switch to drm_*_get(), drm_*_put() helpers
> >   drm/rockchip: switch to drm_*_get(), drm_*_put() helpers
> >   drm/tegra: switch to drm_*_get(), drm_*_put() helpers
> >   drm/tilcdc: switch to drm_*_get(), drm_*_put() helpers
> >   drm/udl: switch to drm_*_get(), drm_*_put() helpers
> >   drm/vc4: switch to drm_*_get(), drm_*_put() helpers
> >   drm/vgem: switch to drm_*_get(), drm_*_put() helpers
> >   drm/virtio: switch to drm_*_get(), drm_*_put() helpers
> >   drm/vmwgfx: switch to drm_*_get()

Re: [PATCH v3 28/28] drm: vboxvideo: switch to drm_*_get(), drm_*_put() helpers

2017-08-11 Thread Hans de Goede

Hi,

On 11-08-17 18:04, Sean Paul wrote:

On Fri, Aug 11, 2017 at 03:26:45PM +0200, Hans de Goede wrote:

Hi,

On 11-08-17 14:33, Cihangir Akturk wrote:

Use drm_*_get() and drm_*_put() helpers instead of drm_*_reference()
and drm_*_unreference() helpers.

drm_*_reference() and drm_*_unreference() functions are just
compatibility alias for drm_*_get() and drm_*_put() and should not be
used by new code. So convert all users of compatibility functions to
use the new APIs.

Generated by: scripts/coccinelle/api/drm-get-put.cocci

Signed-off-by: Cihangir Akturk 


Thank you for doing this, looks good to me:

Reviewed-by: Hans de Goede 



Applied to drm-misc-next, thank you for the review!


Erm vboxvideo is in staging, does this mean all patches for
it will now go through drm-misc-next despite it being in
staging (*) ?  Because if some patches get merged through
drm-misc-next and some through Greg's staging repo that
is not going to end well.

Regards,

Hans



*) that is fine, the same is done for e.g. the media drivers afaik




Sean


Regards,

Hans




---
   drivers/staging/vboxvideo/vbox_fb.c   | 2 +-
   drivers/staging/vboxvideo/vbox_main.c | 8 
   drivers/staging/vboxvideo/vbox_mode.c | 2 +-
   3 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/vboxvideo/vbox_fb.c 
b/drivers/staging/vboxvideo/vbox_fb.c
index bf66358..c157284 100644
--- a/drivers/staging/vboxvideo/vbox_fb.c
+++ b/drivers/staging/vboxvideo/vbox_fb.c
@@ -343,7 +343,7 @@ void vbox_fbdev_fini(struct drm_device *dev)
vbox_bo_unpin(bo);
vbox_bo_unreserve(bo);
}
-   drm_gem_object_unreference_unlocked(afb->obj);
+   drm_gem_object_put_unlocked(afb->obj);
afb->obj = NULL;
}
drm_fb_helper_fini(&fbdev->helper);
diff --git a/drivers/staging/vboxvideo/vbox_main.c 
b/drivers/staging/vboxvideo/vbox_main.c
index d0c6ec7..80bd039 100644
--- a/drivers/staging/vboxvideo/vbox_main.c
+++ b/drivers/staging/vboxvideo/vbox_main.c
@@ -40,7 +40,7 @@ static void vbox_user_framebuffer_destroy(struct 
drm_framebuffer *fb)
struct vbox_framebuffer *vbox_fb = to_vbox_framebuffer(fb);
if (vbox_fb->obj)
-   drm_gem_object_unreference_unlocked(vbox_fb->obj);
+   drm_gem_object_put_unlocked(vbox_fb->obj);
drm_framebuffer_cleanup(fb);
kfree(fb);
@@ -198,7 +198,7 @@ static struct drm_framebuffer *vbox_user_framebuffer_create(
   err_free_vbox_fb:
kfree(vbox_fb);
   err_unref_obj:
-   drm_gem_object_unreference_unlocked(obj);
+   drm_gem_object_put_unlocked(obj);
return ERR_PTR(ret);
   }
@@ -472,7 +472,7 @@ int vbox_dumb_create(struct drm_file *file,
return ret;
ret = drm_gem_handle_create(file, gobj, &handle);
-   drm_gem_object_unreference_unlocked(gobj);
+   drm_gem_object_put_unlocked(gobj);
if (ret)
return ret;
@@ -525,7 +525,7 @@ vbox_dumb_mmap_offset(struct drm_file *file,
bo = gem_to_vbox_bo(obj);
*offset = vbox_bo_mmap_offset(bo);
-   drm_gem_object_unreference(obj);
+   drm_gem_object_put(obj);
ret = 0;
   out_unlock:
diff --git a/drivers/staging/vboxvideo/vbox_mode.c 
b/drivers/staging/vboxvideo/vbox_mode.c
index 996da1c..e5b6383 100644
--- a/drivers/staging/vboxvideo/vbox_mode.c
+++ b/drivers/staging/vboxvideo/vbox_mode.c
@@ -812,7 +812,7 @@ static int vbox_cursor_set2(struct drm_crtc *crtc, struct 
drm_file *file_priv,
   out_unreserve_bo:
vbox_bo_unreserve(bo);
   out_unref_obj:
-   drm_gem_object_unreference_unlocked(obj);
+   drm_gem_object_put_unlocked(obj);
return ret;
   }


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



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


Re: [PATCH v3 28/28] drm: vboxvideo: switch to drm_*_get(), drm_*_put() helpers

2017-08-11 Thread Sean Paul
On Fri, Aug 11, 2017 at 03:26:45PM +0200, Hans de Goede wrote:
> Hi,
> 
> On 11-08-17 14:33, Cihangir Akturk wrote:
> > Use drm_*_get() and drm_*_put() helpers instead of drm_*_reference()
> > and drm_*_unreference() helpers.
> > 
> > drm_*_reference() and drm_*_unreference() functions are just
> > compatibility alias for drm_*_get() and drm_*_put() and should not be
> > used by new code. So convert all users of compatibility functions to
> > use the new APIs.
> > 
> > Generated by: scripts/coccinelle/api/drm-get-put.cocci
> > 
> > Signed-off-by: Cihangir Akturk 
> 
> Thank you for doing this, looks good to me:
> 
> Reviewed-by: Hans de Goede 
> 

Applied to drm-misc-next, thank you for the review!

Sean

> Regards,
> 
> Hans
> 
> 
> 
> > ---
> >   drivers/staging/vboxvideo/vbox_fb.c   | 2 +-
> >   drivers/staging/vboxvideo/vbox_main.c | 8 
> >   drivers/staging/vboxvideo/vbox_mode.c | 2 +-
> >   3 files changed, 6 insertions(+), 6 deletions(-)
> > 
> > diff --git a/drivers/staging/vboxvideo/vbox_fb.c 
> > b/drivers/staging/vboxvideo/vbox_fb.c
> > index bf66358..c157284 100644
> > --- a/drivers/staging/vboxvideo/vbox_fb.c
> > +++ b/drivers/staging/vboxvideo/vbox_fb.c
> > @@ -343,7 +343,7 @@ void vbox_fbdev_fini(struct drm_device *dev)
> > vbox_bo_unpin(bo);
> > vbox_bo_unreserve(bo);
> > }
> > -   drm_gem_object_unreference_unlocked(afb->obj);
> > +   drm_gem_object_put_unlocked(afb->obj);
> > afb->obj = NULL;
> > }
> > drm_fb_helper_fini(&fbdev->helper);
> > diff --git a/drivers/staging/vboxvideo/vbox_main.c 
> > b/drivers/staging/vboxvideo/vbox_main.c
> > index d0c6ec7..80bd039 100644
> > --- a/drivers/staging/vboxvideo/vbox_main.c
> > +++ b/drivers/staging/vboxvideo/vbox_main.c
> > @@ -40,7 +40,7 @@ static void vbox_user_framebuffer_destroy(struct 
> > drm_framebuffer *fb)
> > struct vbox_framebuffer *vbox_fb = to_vbox_framebuffer(fb);
> > if (vbox_fb->obj)
> > -   drm_gem_object_unreference_unlocked(vbox_fb->obj);
> > +   drm_gem_object_put_unlocked(vbox_fb->obj);
> > drm_framebuffer_cleanup(fb);
> > kfree(fb);
> > @@ -198,7 +198,7 @@ static struct drm_framebuffer 
> > *vbox_user_framebuffer_create(
> >   err_free_vbox_fb:
> > kfree(vbox_fb);
> >   err_unref_obj:
> > -   drm_gem_object_unreference_unlocked(obj);
> > +   drm_gem_object_put_unlocked(obj);
> > return ERR_PTR(ret);
> >   }
> > @@ -472,7 +472,7 @@ int vbox_dumb_create(struct drm_file *file,
> > return ret;
> > ret = drm_gem_handle_create(file, gobj, &handle);
> > -   drm_gem_object_unreference_unlocked(gobj);
> > +   drm_gem_object_put_unlocked(gobj);
> > if (ret)
> > return ret;
> > @@ -525,7 +525,7 @@ vbox_dumb_mmap_offset(struct drm_file *file,
> > bo = gem_to_vbox_bo(obj);
> > *offset = vbox_bo_mmap_offset(bo);
> > -   drm_gem_object_unreference(obj);
> > +   drm_gem_object_put(obj);
> > ret = 0;
> >   out_unlock:
> > diff --git a/drivers/staging/vboxvideo/vbox_mode.c 
> > b/drivers/staging/vboxvideo/vbox_mode.c
> > index 996da1c..e5b6383 100644
> > --- a/drivers/staging/vboxvideo/vbox_mode.c
> > +++ b/drivers/staging/vboxvideo/vbox_mode.c
> > @@ -812,7 +812,7 @@ static int vbox_cursor_set2(struct drm_crtc *crtc, 
> > struct drm_file *file_priv,
> >   out_unreserve_bo:
> > vbox_bo_unreserve(bo);
> >   out_unref_obj:
> > -   drm_gem_object_unreference_unlocked(obj);
> > +   drm_gem_object_put_unlocked(obj);
> > return ret;
> >   }
> > 
> ___
> dri-devel mailing list
> dri-de...@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel

-- 
Sean Paul, Software Engineer, Google / Chromium OS
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


RE: [PATCH v3 00/28] DRM API Conversions

2017-08-11 Thread Deucher, Alexander
> -Original Message-
> From: amd-gfx [mailto:amd-gfx-boun...@lists.freedesktop.org] On Behalf
> Of Cihangir Akturk
> Sent: Friday, August 11, 2017 8:33 AM
> Cc: de...@driverdev.osuosl.org; linux-arm-...@vger.kernel.org; intel-
> g...@lists.freedesktop.org; linux-ker...@vger.kernel.org; dri-
> de...@lists.freedesktop.org; etna...@lists.freedesktop.org; Cihangir Akturk;
> amd-...@lists.freedesktop.org; dan...@ffwll.ch;
> nouv...@lists.freedesktop.org; linux-te...@vger.kernel.org;
> virtualizat...@lists.linux-foundation.org; freedr...@lists.freedesktop.org
> Subject: [PATCH v3 00/28] DRM API Conversions
> 
> Changes since v2:
> 
> - Patch series is based on *drm-misc-next* as suggested by Sean Paul.
> 
> - Dropped patch 05 (drm/atmel-hlcdc) and patch 25 (drm/vc4) from v2,
>   since they were already pulled in the drm-misc-next
> 
> Changes since v1:
> 
> - This time patches were generated with coccinelle instead of my own
>   script, as suggested by Daniel Vetter.
> 
> - Fixed the typo in commit messages. s/adn/and
> 

FWIW, I already picked up v1 of these patches for radeon and amdgpu.

Alex

> Note: I've included r-b, a-b tags, as these patches are identical to v1
> except for the file: drivers/gpu/drm/i915/i915_gem_object.h
> 
> This patch set replaces the occurrences of drm_*_reference() and
> drm_*_unreference() with the new drm_*_get() and drm_*_put()
> functions.
> All patches in the series do the same thing, converting to the new APIs.
> I created patches per DRM driver as suggested by Daniel Vetter.
> 
> This patch set was generated by scripts/coccinelle/api/drm-get-put.cocci
> 
> Previous thread can be reached at:
> https://marc.info/?l=dri-devel&m=150178288816047
> 
> Background:
> 
> In the kernel, reference counting APIs use *_get(), *_put() style naming
> to reference-count the objects. But DRM subsystem uses a different
> naming for them such as *_reference(), *_unreference() which is
> inconsistent with the other reference counting APIs in the kernel. To
> solve this consistency issue, Thierry Reding introduced a couple of
> functions and compatibility aliases in the following commits for them.
> 
> commit 020a218f95bd3ceff7dd1022ff7ebc0497bc7bf9
> Author: Thierry Reding 
> Date:   Tue Feb 28 15:46:38 2017 +0100
> 
> drm: Introduce drm_mode_object_{get,put}()
> 
> commit ad09360750afa18a0a0ce0253d6ea6033abc22e7
> Author: Thierry Reding 
> Date:   Tue Feb 28 15:46:39 2017 +0100
> 
> drm: Introduce drm_connector_{get,put}()
> 
> commit a4a69da06bc11a937a6e417938b1bb698ee1fa46
> Author: Thierry Reding 
> Date:   Tue Feb 28 15:46:40 2017 +0100
> 
> drm: Introduce drm_framebuffer_{get,put}()
> 
> commit e6b62714e87c8811d5564b6a0738dcde63a51774
> Author: Thierry Reding 
> Date:   Tue Feb 28 15:46:41 2017 +0100
> 
> drm: Introduce drm_gem_object_{get,put}()
> 
> commit 6472e5090be7c78749a3c279b4faae87ab835c40
> Author: Thierry Reding 
> Date:   Tue Feb 28 15:46:42 2017 +0100
> 
> drm: Introduce drm_property_blob_{get,put}()
> 
> Cihangir Akturk (28):
>   drm/amdgpu: switch to drm_*_get(), drm_*_put() helpers
>   drm: mali-dp: switch to drm_*_get(), drm_*_put() helpers
>   drm/armada: switch to drm_*_get(), drm_*_put() helpers
>   drm/ast: switch to drm_*_get(), drm_*_put() helpers
>   drm/bochs: switch to drm_*_get(), drm_*_put() helpers
>   drm/cirrus: switch to drm_*_get(), drm_*_put() helpers
>   drm/etnaviv: switch to drm_*_get(), drm_*_put() helpers
>   drm/exynos: switch to drm_*_get(), drm_*_put() helpers
>   drm/gma500: switch to drm_*_get(), drm_*_put() helpers
>   drm/hisilicon: switch to drm_*_get(), drm_*_put() helpers
>   drm/i915: switch to drm_*_get(), drm_*_put() helpers
>   drm/imx: switch to drm_*_get(), drm_*_put() helpers
>   drm/mediatek: switch to drm_*_get(), drm_*_put() helpers
>   drm/mgag200: switch to drm_*_get(), drm_*_put() helpers
>   drm/msm: switch to drm_*_get(), drm_*_put() helpers
>   drm/nouveau: switch to drm_*_get(), drm_*_put() helpers
>   drm/omapdrm: switch to drm_*_get(), drm_*_put() helpers
>   drm/qxl: switch to drm_*_get(), drm_*_put() helpers
>   drm/radeon: switch to drm_*_get(), drm_*_put() helpers
>   drm/rockchip: switch to drm_*_get(), drm_*_put() helpers
>   drm/tegra: switch to drm_*_get(), drm_*_put() helpers
>   drm/tilcdc: switch to drm_*_get(), drm_*_put() helpers
>   drm/udl: switch to drm_*_get(), drm_*_put() helpers
>   drm/vc4: switch to drm_*_get(), drm_*_put() helpers
>   drm/vgem: switch to drm_*_get(), drm_*_put() helpers
>   drm/virtio: switch to drm_*_get(), drm_*_put() helpers
>   drm/vmwgfx: switch to drm_*_get(), drm_*_put() helpers
>   drm: vboxvideo: switch to drm_*_get(), drm_*_put() helpers
> 
>  drivers/gpu/drm/amd/amdgpu/amdgpu_bo_list.c   |  2 +-
>  drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c|  2 +-
>  drivers/gpu/drm/amd/amdgpu/amdgpu_display.c   |  6 ++---
>  drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c|  4 +--
>  drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c   | 22 ++

[PATCH 1/1] Drivers: hv: vmbus: Fix rescind handling issues

2017-08-11 Thread kys
From: K. Y. Srinivasan 

This patch handles the following issues that were observed when we are
handling racing channel offer message and rescind message for the same
offer:

1. Since the host does not respond to messages on a rescinded channel,
in the current code, we could be indefinitely blocked on the vmbus_open() call.

2. When a rescinded channel is being closed, if there is a pending interrupt on 
the
channel, we could end up freeing the channel that the interrupt handler would 
run on.

Signed-off-by: K. Y. Srinivasan 
Reviewed-by: Dexuan Cui 
Tested-by: Dexuan Cui 
---
 drivers/hv/channel.c  |   14 ++
 drivers/hv/channel_mgmt.c |   29 ++---
 drivers/hv/vmbus_drv.c|3 +++
 include/linux/hyperv.h|2 ++
 4 files changed, 45 insertions(+), 3 deletions(-)

diff --git a/drivers/hv/channel.c b/drivers/hv/channel.c
index e9bf0bb..966a823 100644
--- a/drivers/hv/channel.c
+++ b/drivers/hv/channel.c
@@ -177,6 +177,11 @@ int vmbus_open(struct vmbus_channel *newchannel, u32 
send_ringbuffer_size,
  &vmbus_connection.chn_msg_list);
spin_unlock_irqrestore(&vmbus_connection.channelmsg_lock, flags);
 
+   if (newchannel->rescind) {
+   err = -ENODEV;
+   goto error_free_gpadl;
+   }
+
ret = vmbus_post_msg(open_msg,
 sizeof(struct vmbus_channel_open_channel), true);
 
@@ -421,6 +426,11 @@ int vmbus_establish_gpadl(struct vmbus_channel *channel, 
void *kbuffer,
 
spin_unlock_irqrestore(&vmbus_connection.channelmsg_lock, flags);
 
+   if (channel->rescind) {
+   ret = -ENODEV;
+   goto cleanup;
+   }
+
ret = vmbus_post_msg(gpadlmsg, msginfo->msgsize -
 sizeof(*msginfo), true);
if (ret != 0)
@@ -494,6 +504,10 @@ int vmbus_teardown_gpadl(struct vmbus_channel *channel, 
u32 gpadl_handle)
list_add_tail(&info->msglistentry,
  &vmbus_connection.chn_msg_list);
spin_unlock_irqrestore(&vmbus_connection.channelmsg_lock, flags);
+
+   if (channel->rescind)
+   goto post_msg_err;
+
ret = vmbus_post_msg(msg, sizeof(struct vmbus_channel_gpadl_teardown),
 true);
 
diff --git a/drivers/hv/channel_mgmt.c b/drivers/hv/channel_mgmt.c
index 4bbb8de..968af17 100644
--- a/drivers/hv/channel_mgmt.c
+++ b/drivers/hv/channel_mgmt.c
@@ -451,6 +451,12 @@ static void vmbus_process_offer(struct vmbus_channel 
*newchannel)
/* Make sure this is a new offer */
mutex_lock(&vmbus_connection.channel_mutex);
 
+   /*
+* Now that we have acquired the channel_mutex,
+* we can release the potentially racing rescind thread.
+*/
+   atomic_dec(&vmbus_connection.offer_in_progress);
+
list_for_each_entry(channel, &vmbus_connection.chn_list, listentry) {
if (!uuid_le_cmp(channel->offermsg.offer.if_type,
newchannel->offermsg.offer.if_type) &&
@@ -481,7 +487,6 @@ static void vmbus_process_offer(struct vmbus_channel 
*newchannel)
channel->num_sc++;
spin_unlock_irqrestore(&channel->lock, flags);
} else {
-   atomic_dec(&vmbus_connection.offer_in_progress);
goto err_free_chan;
}
}
@@ -510,7 +515,6 @@ static void vmbus_process_offer(struct vmbus_channel 
*newchannel)
if (!fnew) {
if (channel->sc_creation_callback != NULL)
channel->sc_creation_callback(newchannel);
-   atomic_dec(&vmbus_connection.offer_in_progress);
return;
}
 
@@ -541,7 +545,7 @@ static void vmbus_process_offer(struct vmbus_channel 
*newchannel)
goto err_deq_chan;
}
 
-   atomic_dec(&vmbus_connection.offer_in_progress);
+   newchannel->probe_done = true;
return;
 
 err_deq_chan:
@@ -882,8 +886,27 @@ static void vmbus_onoffer_rescind(struct 
vmbus_channel_message_header *hdr)
channel->rescind = true;
spin_unlock_irqrestore(&channel->lock, flags);
 
+   /*
+* Now that we have posted the rescind state, perform
+* rescind related cleanup.
+*/
vmbus_rescind_cleanup(channel);
 
+   /*
+* Now wait for offer handling to complete.
+*/
+   while (READ_ONCE(channel->probe_done) == false) {
+   /*
+* We wait here until any channel offer is currently
+* being processed.
+*/
+   msleep(1);
+   }
+
+   /*
+* At this point, the rescind handling can proceed safely.
+*/
+
if (channel->device_obj) {
if (channel->chn_rescind_callback) {
channel->chn_rescind_callback(channel);
diff --git a/drivers/hv/vmbus_drv.c b/drivers/hv/vmbus_drv.c
inde

Re: [PATCH v3 28/28] drm: vboxvideo: switch to drm_*_get(), drm_*_put() helpers

2017-08-11 Thread Sean Paul
On Fri, Aug 11, 2017 at 12:11 PM, Hans de Goede  wrote:
> Hi,
>
> On 11-08-17 18:04, Sean Paul wrote:
>>
>> On Fri, Aug 11, 2017 at 03:26:45PM +0200, Hans de Goede wrote:
>>>
>>> Hi,
>>>
>>> On 11-08-17 14:33, Cihangir Akturk wrote:

 Use drm_*_get() and drm_*_put() helpers instead of drm_*_reference()
 and drm_*_unreference() helpers.

 drm_*_reference() and drm_*_unreference() functions are just
 compatibility alias for drm_*_get() and drm_*_put() and should not be
 used by new code. So convert all users of compatibility functions to
 use the new APIs.

 Generated by: scripts/coccinelle/api/drm-get-put.cocci

 Signed-off-by: Cihangir Akturk 
>>>
>>>
>>> Thank you for doing this, looks good to me:
>>>
>>> Reviewed-by: Hans de Goede 
>>>
>>
>> Applied to drm-misc-next, thank you for the review!
>
>
> Erm vboxvideo is in staging, does this mean all patches for
> it will now go through drm-misc-next despite it being in
> staging (*) ?  Because if some patches get merged through
> drm-misc-next and some through Greg's staging repo that
> is not going to end well.
>

Hi Hans,
Thanks for pointing this out. I picked it up as I was vacuuming up the
rest of the set that was not yet applied, not realizing the staging
implications. It's not my intention to start taking vboxvideo through
-misc.

Hopefully this won't cause any nasty conflicts with Greg's staging
tree, and we can treat it as a one-off. If it does cause problems, I
can revert it in -misc in favor of taking it through staging.

Sean

> Regards,
>
> Hans
>
>
>
> *) that is fine, the same is done for e.g. the media drivers afaik
>
>
>
>>
>> Sean
>>
>>> Regards,
>>>
>>> Hans
>>>
>>>
>>>
 ---
drivers/staging/vboxvideo/vbox_fb.c   | 2 +-
drivers/staging/vboxvideo/vbox_main.c | 8 
drivers/staging/vboxvideo/vbox_mode.c | 2 +-
3 files changed, 6 insertions(+), 6 deletions(-)

 diff --git a/drivers/staging/vboxvideo/vbox_fb.c
 b/drivers/staging/vboxvideo/vbox_fb.c
 index bf66358..c157284 100644
 --- a/drivers/staging/vboxvideo/vbox_fb.c
 +++ b/drivers/staging/vboxvideo/vbox_fb.c
 @@ -343,7 +343,7 @@ void vbox_fbdev_fini(struct drm_device *dev)
 vbox_bo_unpin(bo);
 vbox_bo_unreserve(bo);
 }
 -   drm_gem_object_unreference_unlocked(afb->obj);
 +   drm_gem_object_put_unlocked(afb->obj);
 afb->obj = NULL;
 }
 drm_fb_helper_fini(&fbdev->helper);
 diff --git a/drivers/staging/vboxvideo/vbox_main.c
 b/drivers/staging/vboxvideo/vbox_main.c
 index d0c6ec7..80bd039 100644
 --- a/drivers/staging/vboxvideo/vbox_main.c
 +++ b/drivers/staging/vboxvideo/vbox_main.c
 @@ -40,7 +40,7 @@ static void vbox_user_framebuffer_destroy(struct
 drm_framebuffer *fb)
 struct vbox_framebuffer *vbox_fb = to_vbox_framebuffer(fb);
 if (vbox_fb->obj)
 -   drm_gem_object_unreference_unlocked(vbox_fb->obj);
 +   drm_gem_object_put_unlocked(vbox_fb->obj);
 drm_framebuffer_cleanup(fb);
 kfree(fb);
 @@ -198,7 +198,7 @@ static struct drm_framebuffer
 *vbox_user_framebuffer_create(
err_free_vbox_fb:
 kfree(vbox_fb);
err_unref_obj:
 -   drm_gem_object_unreference_unlocked(obj);
 +   drm_gem_object_put_unlocked(obj);
 return ERR_PTR(ret);
}
 @@ -472,7 +472,7 @@ int vbox_dumb_create(struct drm_file *file,
 return ret;
 ret = drm_gem_handle_create(file, gobj, &handle);
 -   drm_gem_object_unreference_unlocked(gobj);
 +   drm_gem_object_put_unlocked(gobj);
 if (ret)
 return ret;
 @@ -525,7 +525,7 @@ vbox_dumb_mmap_offset(struct drm_file *file,
 bo = gem_to_vbox_bo(obj);
 *offset = vbox_bo_mmap_offset(bo);
 -   drm_gem_object_unreference(obj);
 +   drm_gem_object_put(obj);
 ret = 0;
out_unlock:
 diff --git a/drivers/staging/vboxvideo/vbox_mode.c
 b/drivers/staging/vboxvideo/vbox_mode.c
 index 996da1c..e5b6383 100644
 --- a/drivers/staging/vboxvideo/vbox_mode.c
 +++ b/drivers/staging/vboxvideo/vbox_mode.c
 @@ -812,7 +812,7 @@ static int vbox_cursor_set2(struct drm_crtc *crtc,
 struct drm_file *file_priv,
out_unreserve_bo:
 vbox_bo_unreserve(bo);
out_unref_obj:
 -   drm_gem_object_unreference_unlocked(obj);
 +   drm_gem_object_put_unlocked(obj);
 return ret;
}

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

Re: [PATCH net-next 00/10] netvsc: minor fixes and improvements

2017-08-11 Thread David Miller
From: Stephen Hemminger 
Date: Wed,  9 Aug 2017 17:46:02 -0700

> These are non-critical bug fixes, related to functionality now in net-next.
>  1. delaying the automatic bring up of VF device to allow udev to change name.
>  2. performance improvement
>  3. handle MAC address change with VF; mostly propogate the error that VF 
> gives.
>  4. minor cleanups
>  5. allow setting send/receive buffer size with ethtool.

Series applied, thanks Stephen.
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] staging: typec: tcpm: Consider port_type while determining unattached_state

2017-08-11 Thread kbuild test robot
Hi Badhri,

[auto build test ERROR on staging/staging-testing]
[also build test ERROR on v4.13-rc4 next-20170811]
[if your patch is applied to the wrong git tree, please drop us a note to help 
improve the system]

url:
https://github.com/0day-ci/linux/commits/Badhri-Jagan-Sridharan/staging-typec-tcpm-Consider-port_type-while-determining-unattached_state/20170812-071822
config: xtensa-allmodconfig (attached as .config)
compiler: xtensa-linux-gcc (GCC) 4.9.0
reproduce:
wget 
https://raw.githubusercontent.com/01org/lkp-tests/master/sbin/make.cross -O 
~/bin/make.cross
chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
make.cross ARCH=xtensa 

All error/warnings (new ones prefixed by >>):

   drivers/staging/typec/tcpm.c: In function 'unattached_state':
>> drivers/staging/typec/tcpm.c:2101:10: error: 'struct tcpm_port' has no 
>> member named 'port_type'
 if (port->port_type == TYPEC_PORT_DRP) {
 ^
   drivers/staging/typec/tcpm.c:2106:17: error: 'struct tcpm_port' has no 
member named 'port_type'
 } else if (port->port_type == TYPEC_PORT_DFP) {
^
>> drivers/staging/typec/tcpm.c:2111:1: warning: control reaches end of 
>> non-void function [-Wreturn-type]
}
^

vim +2101 drivers/staging/typec/tcpm.c

  2098  
  2099  static inline enum tcpm_state unattached_state(struct tcpm_port *port)
  2100  {
> 2101  if (port->port_type == TYPEC_PORT_DRP) {
  2102  if (port->pwr_role == TYPEC_SOURCE)
  2103  return SRC_UNATTACHED;
  2104  else
  2105  return SNK_UNATTACHED;
  2106  } else if (port->port_type == TYPEC_PORT_DFP) {
  2107  return SRC_UNATTACHED;
  2108  } else {
  2109  return SNK_UNATTACHED;
  2110  }
> 2111  }
  2112  

---
0-DAY kernel test infrastructureOpen Source Technology Center
https://lists.01.org/pipermail/kbuild-all   Intel Corporation


.config.gz
Description: application/gzip
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] staging: typec: tcpm: Consider port_type while determining unattached_state

2017-08-11 Thread kbuild test robot
Hi Badhri,

[auto build test WARNING on staging/staging-testing]
[also build test WARNING on v4.13-rc4 next-20170811]
[if your patch is applied to the wrong git tree, please drop us a note to help 
improve the system]

url:
https://github.com/0day-ci/linux/commits/Badhri-Jagan-Sridharan/staging-typec-tcpm-Consider-port_type-while-determining-unattached_state/20170812-071822
config: i386-randconfig-x019-201732 (attached as .config)
compiler: gcc-6 (Debian 6.2.0-3) 6.2.0 20160901
reproduce:
# save the attached .config to linux build tree
make ARCH=i386 

All warnings (new ones prefixed by >>):

   In file included from include/uapi/linux/stddef.h:1:0,
from include/linux/stddef.h:4,
from include/uapi/linux/posix_types.h:4,
from include/uapi/linux/types.h:13,
from include/linux/types.h:5,
from include/linux/list.h:4,
from include/linux/wait.h:6,
from include/linux/completion.h:11,
from drivers/staging/typec/tcpm.c:17:
   drivers/staging/typec/tcpm.c: In function 'unattached_state':
   drivers/staging/typec/tcpm.c:2101:10: error: 'struct tcpm_port' has no 
member named 'port_type'
 if (port->port_type == TYPEC_PORT_DRP) {
 ^
   include/linux/compiler.h:156:30: note: in definition of macro '__trace_if'
 if (__builtin_constant_p(!!(cond)) ? !!(cond) :   \
 ^~~~
>> drivers/staging/typec/tcpm.c:2101:2: note: in expansion of macro 'if'
 if (port->port_type == TYPEC_PORT_DRP) {
 ^~
   drivers/staging/typec/tcpm.c:2101:10: error: 'struct tcpm_port' has no 
member named 'port_type'
 if (port->port_type == TYPEC_PORT_DRP) {
 ^
   include/linux/compiler.h:156:42: note: in definition of macro '__trace_if'
 if (__builtin_constant_p(!!(cond)) ? !!(cond) :   \
 ^~~~
>> drivers/staging/typec/tcpm.c:2101:2: note: in expansion of macro 'if'
 if (port->port_type == TYPEC_PORT_DRP) {
 ^~
   drivers/staging/typec/tcpm.c:2101:10: error: 'struct tcpm_port' has no 
member named 'port_type'
 if (port->port_type == TYPEC_PORT_DRP) {
 ^
   include/linux/compiler.h:167:16: note: in definition of macro '__trace_if'
  __r = !!(cond); \
   ^~~~
>> drivers/staging/typec/tcpm.c:2101:2: note: in expansion of macro 'if'
 if (port->port_type == TYPEC_PORT_DRP) {
 ^~
   drivers/staging/typec/tcpm.c:2106:17: error: 'struct tcpm_port' has no 
member named 'port_type'
 } else if (port->port_type == TYPEC_PORT_DFP) {
^
   include/linux/compiler.h:156:30: note: in definition of macro '__trace_if'
 if (__builtin_constant_p(!!(cond)) ? !!(cond) :   \
 ^~~~
   drivers/staging/typec/tcpm.c:2106:9: note: in expansion of macro 'if'
 } else if (port->port_type == TYPEC_PORT_DFP) {
^~
   drivers/staging/typec/tcpm.c:2106:17: error: 'struct tcpm_port' has no 
member named 'port_type'
 } else if (port->port_type == TYPEC_PORT_DFP) {
^
   include/linux/compiler.h:156:42: note: in definition of macro '__trace_if'
 if (__builtin_constant_p(!!(cond)) ? !!(cond) :   \
 ^~~~
   drivers/staging/typec/tcpm.c:2106:9: note: in expansion of macro 'if'
 } else if (port->port_type == TYPEC_PORT_DFP) {
^~
   drivers/staging/typec/tcpm.c:2106:17: error: 'struct tcpm_port' has no 
member named 'port_type'
 } else if (port->port_type == TYPEC_PORT_DFP) {
^
   include/linux/compiler.h:167:16: note: in definition of macro '__trace_if'
  __r = !!(cond); \
   ^~~~
   drivers/staging/typec/tcpm.c:2106:9: note: in expansion of macro 'if'
 } else if (port->port_type == TYPEC_PORT_DFP) {
^~
   drivers/staging/typec/tcpm.c: At top level:
   include/linux/compiler.h:162:4: warning: '__f' is static but declared in 
inline function 'strcpy' which is not static
   __f = { \
   ^
   include/linux/compiler.h:154:23: note: in expansion of macro '__trace_if'
#define if(cond, ...) __trace_if( (cond , ## __VA_ARGS__) )
  ^~
   include/linux/string.h:390:2: note: in expansion of macro 'if'
 if (p_size == (size_t)-1 && q_size == (size_t)-1)
 ^~
   include/linux/compiler.h:162:4: warning: '__f' is static but declared in 
inline function 'kmemdup' which is not static
   _

[PATCH] staging/rtl8723bs: Fix some coding style issues in rtw_odm.c.

2017-08-11 Thread Tom Gardi
WARNING: line over 80 characters
WARNING: static const char * array should probably be static const char * const
CHECK: Unnecessary parentheses around hal_data->odmpriv

Signed-off-by: Tom Gardi 
---
 drivers/staging/rtl8723bs/core/rtw_odm.c | 38 ++--
 1 file changed, 21 insertions(+), 17 deletions(-)

diff --git a/drivers/staging/rtl8723bs/core/rtw_odm.c 
b/drivers/staging/rtl8723bs/core/rtw_odm.c
index 3144e8e..edbcaeb 100644
--- a/drivers/staging/rtl8723bs/core/rtw_odm.c
+++ b/drivers/staging/rtl8723bs/core/rtw_odm.c
@@ -18,7 +18,7 @@
 #include 
 #include 
 
-static const char *odm_comp_str[] = {
+static const char * const odm_comp_str[] = {
/* BIT0 */"ODM_COMP_DIG",
/* BIT1 */"ODM_COMP_RA_MASK",
/* BIT2 */"ODM_COMP_DYNAMIC_TXPWR",
@@ -55,7 +55,7 @@ static const char *odm_comp_str[] = {
 
 #define RTW_ODM_COMP_MAX 32
 
-static const char *odm_ability_str[] = {
+static const char * const odm_ability_str[] = {
/* BIT0 */"ODM_BB_DIG",
/* BIT1 */"ODM_BB_RA_MASK",
/* BIT2 */"ODM_BB_DYNAMIC_TXPWR",
@@ -87,7 +87,7 @@ static const char *odm_ability_str[] = {
 
 #define RTW_ODM_ABILITY_MAX 27
 
-static const char *odm_dbg_level_str[] = {
+static const char * const odm_dbg_level_str[] = {
NULL,
"ODM_DBG_OFF",
"ODM_DBG_SERIOUS",
@@ -127,7 +127,8 @@ void rtw_odm_dbg_level_msg(void *sel, struct adapter 
*adapter)
DBG_871X_SEL_NL(sel, "odm.DebugLevel = %u\n", dbg_level);
for (i = 0; i < RTW_ODM_DBG_LEVEL_NUM; i++) {
if (odm_dbg_level_str[i])
-   DBG_871X_SEL_NL(sel, "%u %s\n", i, 
odm_dbg_level_str[i]);
+   DBG_871X_SEL_NL(sel, "%u %s\n",
+   i, odm_dbg_level_str[i]);
}
 }
 
@@ -161,20 +162,23 @@ void rtw_odm_adaptivity_parm_msg(void *sel, struct 
adapter *adapter)
struct hal_com_data *pHalData = GET_HAL_DATA(adapter);
DM_ODM_T *odm = &pHalData->odmpriv;
 
-   DBG_871X_SEL_NL(sel, "%10s %16s %8s %10s %11s %14s\n"
-   , "TH_L2H_ini", "TH_EDCCA_HL_diff", "IGI_Base", "ForceEDCCA", 
"AdapEn_RSSI", "IGI_LowerBound");
-   DBG_871X_SEL_NL(sel, "0x%-8x %-16d 0x%-6x %-10d %-11u %-14u\n"
-   , (u8)odm->TH_L2H_ini
-   , odm->TH_EDCCA_HL_diff
-   , odm->IGI_Base
-   , odm->ForceEDCCA
-   , odm->AdapEn_RSSI
-   , odm->IGI_LowerBound
+   DBG_871X_SEL_NL(sel, "%10s %16s %8s %10s %11s %14s\n",
+   "TH_L2H_ini", "TH_EDCCA_HL_diff", "IGI_Base",
+   "ForceEDCCA", "AdapEn_RSSI", "IGI_LowerBound");
+   DBG_871X_SEL_NL(sel, "0x%-8x %-16d 0x%-6x %-10d %-11u %-14u\n",
+   (u8)odm->TH_L2H_ini,
+   odm->TH_EDCCA_HL_diff,
+   odm->IGI_Base,
+   odm->ForceEDCCA,
+   odm->AdapEn_RSSI,
+   odm->IGI_LowerBound
);
 }
 
-void rtw_odm_adaptivity_parm_set(struct adapter *adapter, s8 TH_L2H_ini, s8 
TH_EDCCA_HL_diff,
-   s8 IGI_Base, bool ForceEDCCA, u8 AdapEn_RSSI, u8 IGI_LowerBound)
+void rtw_odm_adaptivity_parm_set(struct adapter *adapter, s8 TH_L2H_ini,
+s8 TH_EDCCA_HL_diff, s8 IGI_Base,
+bool ForceEDCCA, u8 AdapEn_RSSI,
+u8 IGI_LowerBound)
 {
struct hal_com_data *pHalData = GET_HAL_DATA(adapter);
DM_ODM_T *odm = &pHalData->odmpriv;
@@ -190,8 +194,8 @@ void rtw_odm_adaptivity_parm_set(struct adapter *adapter, 
s8 TH_L2H_ini, s8 TH_E
 void rtw_odm_get_perpkt_rssi(void *sel, struct adapter *adapter)
 {
struct hal_com_data *hal_data = GET_HAL_DATA(adapter);
-   DM_ODM_T *odm = &(hal_data->odmpriv);
+   DM_ODM_T *odm = &hal_data->odmpriv;
 
DBG_871X_SEL_NL(sel, "RxRate = %s, RSSI_A = %d(%%), RSSI_B = %d(%%)\n",
-   HDATA_RATE(odm->RxRate), odm->RSSI_A, odm->RSSI_B);
+   HDATA_RATE(odm->RxRate), odm->RSSI_A, odm->RSSI_B);
 }
-- 
2.7.4

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


Re:Before sudden death we his was devoted christian

2017-08-11 Thread Sis . Pamela Griffin Wells
Day To You Good My Dear,
I Am Mrs Pamela Griffin. I Was Married To Late Mr. Griffin Wells, Who Was A 
Wealthy Business Man In This Country. We Were Married For Many Years Without A 
Child Before He Died After A Brief Illness.

Before sudden death we his was devoted christian.When my late husband was alive 
he deposited the sum of $ 8.5.Eight Million Five Hundred Thousand Dollars.

I am very sick from kidney cancer that i may i decided to donate this decided 
to donate this money to a honest individually who will like it like god's work 
such as orphans, widows and building of churches To fulfill the vow i and my 
late husband made to God.

I have not deep thought that took me some day to make this as I have not been 
any child to inherit this Fund and our relatives are all unbelievers And I Do 
Not Want Our Hard Earned Money To Be Used In An Ungodly Way. So You Will Take 
15 Percent Of The Fund For Your Efforts And Use As Remaining I Stated Above.

As Soon As I Read From You I Will Give You More Details On how to achieve this 
goal and get this flow transferred your bank account to.
I need your urgent reply as I do not know what tomorrow will result.
Your sister in the lord
Mrs Pamela Griffin.

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