From: Peter Rosin <peda@axentia.se>
To: linux-kernel@vger.kernel.org
Cc: Peter Rosin <peda@axentia.se>,
Daniel Vetter <daniel.vetter@intel.com>,
Jani Nikula <jani.nikula@linux.intel.com>,
Sean Paul <seanpaul@chromium.org>,
David Airlie <airlied@linux.ie>,
dri-devel@lists.freedesktop.org,
Lionel Landwerlin <lionel.g.landwerlin@intel.com>,
Boris Brezillon <boris.brezillon@free-electrons.com>
Subject: [PATCH v5 01/14] drm: rename, adjust and export drm_atomic_replace_property_blob
Date: Thu, 13 Jul 2017 18:25:25 +0200 [thread overview]
Message-ID: <20170713162538.22788-2-peda@axentia.se> (raw)
In-Reply-To: <20170713162538.22788-1-peda@axentia.se>
The function has little to do with atomic, it's just where it has so
far been needed. So, rename it to drm_property_replace_blob, move it
to drm_property.c and export it.
Change the semantics to return whether the blob was replaced instead
of using an extra argument for that.
Signed-off-by: Peter Rosin <peda@axentia.se>
---
drivers/gpu/drm/drm_atomic.c | 30 +-----------------------------
drivers/gpu/drm/drm_property.c | 23 +++++++++++++++++++++++
include/drm/drm_property.h | 2 ++
3 files changed, 26 insertions(+), 29 deletions(-)
diff --git a/drivers/gpu/drm/drm_atomic.c b/drivers/gpu/drm/drm_atomic.c
index 09ca662fcd35..16d73be6f76d 100644
--- a/drivers/gpu/drm/drm_atomic.c
+++ b/drivers/gpu/drm/drm_atomic.c
@@ -408,34 +408,6 @@ int drm_atomic_set_mode_prop_for_crtc(struct drm_crtc_state *state,
}
EXPORT_SYMBOL(drm_atomic_set_mode_prop_for_crtc);
-/**
- * drm_atomic_replace_property_blob - replace a blob property
- * @blob: a pointer to the member blob to be replaced
- * @new_blob: the new blob to replace with
- * @replaced: whether the blob has been replaced
- *
- * RETURNS:
- * Zero on success, error code on failure
- */
-static void
-drm_atomic_replace_property_blob(struct drm_property_blob **blob,
- struct drm_property_blob *new_blob,
- bool *replaced)
-{
- struct drm_property_blob *old_blob = *blob;
-
- if (old_blob == new_blob)
- return;
-
- drm_property_blob_put(old_blob);
- if (new_blob)
- drm_property_blob_get(new_blob);
- *blob = new_blob;
- *replaced = true;
-
- return;
-}
-
static int
drm_atomic_replace_property_blob_from_id(struct drm_device *dev,
struct drm_property_blob **blob,
@@ -456,7 +428,7 @@ drm_atomic_replace_property_blob_from_id(struct drm_device *dev,
}
}
- drm_atomic_replace_property_blob(blob, new_blob, replaced);
+ *replaced |= drm_property_replace_blob(blob, new_blob);
drm_property_blob_put(new_blob);
return 0;
diff --git a/drivers/gpu/drm/drm_property.c b/drivers/gpu/drm/drm_property.c
index 3e88fa24eab3..bc5128203056 100644
--- a/drivers/gpu/drm/drm_property.c
+++ b/drivers/gpu/drm/drm_property.c
@@ -709,6 +709,29 @@ int drm_property_replace_global_blob(struct drm_device *dev,
}
EXPORT_SYMBOL(drm_property_replace_global_blob);
+/**
+ * drm_property_replace_blob - replace a blob property
+ * @blob: a pointer to the member blob to be replaced
+ * @new_blob: the new blob to replace with
+ *
+ * Return: true if the blob was in fact replaced.
+ */
+bool drm_property_replace_blob(struct drm_property_blob **blob,
+ struct drm_property_blob *new_blob)
+{
+ struct drm_property_blob *old_blob = *blob;
+
+ if (old_blob == new_blob)
+ return false;
+
+ drm_property_blob_put(old_blob);
+ if (new_blob)
+ drm_property_blob_get(new_blob);
+ *blob = new_blob;
+ return true;
+}
+EXPORT_SYMBOL(drm_property_replace_blob);
+
int drm_mode_getblob_ioctl(struct drm_device *dev,
void *data, struct drm_file *file_priv)
{
diff --git a/include/drm/drm_property.h b/include/drm/drm_property.h
index 619868dc08d8..37355c623e6c 100644
--- a/include/drm/drm_property.h
+++ b/include/drm/drm_property.h
@@ -273,6 +273,8 @@ int drm_property_replace_global_blob(struct drm_device *dev,
const void *data,
struct drm_mode_object *obj_holds_id,
struct drm_property *prop_holds_id);
+bool drm_property_replace_blob(struct drm_property_blob **blob,
+ struct drm_property_blob *new_blob);
struct drm_property_blob *drm_property_blob_get(struct drm_property_blob *blob);
void drm_property_blob_put(struct drm_property_blob *blob);
--
2.11.0
next prev parent reply other threads:[~2017-07-13 16:24 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-07-13 16:25 [PATCH v5 00/14] improve the fb_setcmap helper Peter Rosin
2017-07-13 16:25 ` Peter Rosin [this message]
2017-07-13 16:25 ` [PATCH v5 02/14] drm/atomic-helper: update lut props directly in ..._legacy_gamma_set Peter Rosin
2017-07-13 16:25 ` [PATCH v5 03/14] drm/fb-helper: separate the fb_setcmap helper into atomic and legacy paths Peter Rosin
2017-07-14 13:54 ` Daniel Vetter
2017-08-03 22:49 ` Peter Rosin
2017-08-04 9:38 ` Daniel Vetter
2017-08-04 10:30 ` [PATCH] staging: vboxvideo: remove dead gamma lut code Peter Rosin
2017-08-04 10:45 ` [RESEND PATCH] " Peter Rosin
2017-08-05 11:11 ` Hans de Goede
2017-08-07 9:21 ` Daniel Vetter
2017-08-08 11:54 ` Peter Rosin
2017-08-09 15:14 ` Daniel Vetter
2017-07-13 16:25 ` [PATCH v5 04/14] drm: amd: remove dead code and pointless local lut storage Peter Rosin
2017-07-14 14:06 ` Alex Deucher
2017-07-13 16:25 ` [PATCH v5 05/14] drm: armada: remove dead empty functions Peter Rosin
2017-07-13 16:25 ` [PATCH v5 06/14] drm: ast: remove dead code and pointless local lut storage Peter Rosin
2017-07-13 16:25 ` [PATCH v5 07/14] drm: cirrus: " Peter Rosin
2017-07-13 16:25 ` [PATCH v5 08/14] drm: gma500: " Peter Rosin
2017-07-13 16:25 ` [PATCH v5 09/14] drm: i915: " Peter Rosin
2017-07-13 16:25 ` [PATCH v5 10/14] drm: mgag200: " Peter Rosin
2017-07-13 16:25 ` [PATCH v5 11/14] drm: nouveau: " Peter Rosin
2017-07-13 16:25 ` [PATCH v5 12/14] drm: radeon: " Peter Rosin
2017-07-14 14:06 ` Alex Deucher
2017-07-13 16:25 ` [PATCH v5 13/14] drm: stm: " Peter Rosin
2017-07-17 9:47 ` Philippe CORNU
2017-07-13 16:25 ` [PATCH v5 14/14] drm: remove unused and redundant callbacks Peter Rosin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170713162538.22788-2-peda@axentia.se \
--to=peda@axentia.se \
--cc=airlied@linux.ie \
--cc=boris.brezillon@free-electrons.com \
--cc=daniel.vetter@intel.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=jani.nikula@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=lionel.g.landwerlin@intel.com \
--cc=seanpaul@chromium.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).