From: Jani Nikula <jani.nikula@linux.intel.com>
To: Bob Paauwe <bob.j.paauwe@intel.com>, dri-devel@lists.freedesktop.org
Subject: Re: [PATCH] drm/edid: Allow comma separated edid binaries. (v2)
Date: Thu, 27 Aug 2015 13:38:07 +0300 [thread overview]
Message-ID: <8737z5819s.fsf@intel.com> (raw)
In-Reply-To: <1440606600-24530-1-git-send-email-bob.j.paauwe@intel.com>
On Wed, 26 Aug 2015, Bob Paauwe <bob.j.paauwe@intel.com> wrote:
> Allow comma separated filenames in the edid_firmware parameter.
>
> For example:
>
> edid_firmware=eDP-1:edid/1280x480.bin,DP-2:edid/1920x1080.bin
>
> v2: Use strsep() to simplify parsing of comma seperated string. (Matt)
> Move initial bail before strdup. (Matt)
>
> Reviewed-by: Matt Roper <matthew.d.roper@intel.com>
> Signed-off-by: Bob Paauwe <bob.j.paauwe@intel.com>
> ---
> drivers/gpu/drm/drm_edid_load.c | 44 ++++++++++++++++++++++++++++++++---------
> 1 file changed, 35 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/gpu/drm/drm_edid_load.c b/drivers/gpu/drm/drm_edid_load.c
> index c5605fe..93b9275 100644
> --- a/drivers/gpu/drm/drm_edid_load.c
> +++ b/drivers/gpu/drm/drm_edid_load.c
> @@ -264,27 +264,53 @@ out:
> int drm_load_edid_firmware(struct drm_connector *connector)
> {
> const char *connector_name = connector->name;
> - char *edidname = edid_firmware, *last, *colon;
> + char *edidname, *last, *colon, *fwstr, *edidstr, *fallback = NULL;
> int ret;
> struct edid *edid;
>
> - if (*edidname == '\0')
> + if (edid_firmware[0] == '\0')
> return 0;
>
> - colon = strchr(edidname, ':');
> - if (colon != NULL) {
> - if (strncmp(connector_name, edidname, colon - edidname))
> - return 0;
> - edidname = colon + 1;
> - if (*edidname == '\0')
> - return 0;
> + /*
> + * If there are multiple edid files specified and separated
> + * by commas, search through the list looking for one that
> + * matches the connector.
> + *
> + * If there's one or more that don't't specify a connector, keep
> + * the last one found one as a fallback.
> + */
> + fwstr = kstrdup(edid_firmware, GFP_KERNEL);
> + edidstr = fwstr;
> +
> + while ((edidname = strsep(&edidstr, ","))) {
> + colon = strchr(edidname, ':');
> + if (colon != NULL) {
> + if (strncmp(connector_name, edidname, colon-edidname))
> + continue;
> + edidname = colon + 1;
> + break;
> + } else {
> + if (*edidname != '\0') /* corner case: multiple ',' */
> + fallback = edidname;
> + }
> +
> }
>
> + if (fallback == NULL && edidname == NULL) {
> + kfree(fwstr);
> + return 0;
> + }
> +
> + if (edidname == NULL && fallback)
> + edidname = fallback;
> +
I guess I might write that as either:
if (!edidname)
edidname = fallback;
if (!edidname) {
kfree(fwstr);
return 0;
}
or:
if (!edidname) {
if (!fallback) {
kfree(fwstr);
return 0;
}
edidname = fallback;
}
to make it faster to read, but meh. Up to you.
This will need an update to Documentation/kernel-parameters.txt
though. With that updated, this is
Reviewed-by: Jani Nikula <jani.nikula@intel.com>
> last = edidname + strlen(edidname) - 1;
> if (*last == '\n')
> *last = '\0';
>
> edid = edid_load(connector, edidname, connector_name);
> + kfree(fwstr);
> +
> if (IS_ERR_OR_NULL(edid))
> return 0;
>
> --
> 2.1.0
>
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/dri-devel
--
Jani Nikula, Intel Open Source Technology Center
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel
next prev parent reply other threads:[~2015-08-27 10:35 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-08-26 16:30 [PATCH] drm/edid: Allow comma separated edid binaries. (v2) Bob Paauwe
2015-08-27 10:38 ` Jani Nikula [this message]
2015-08-27 17:04 ` [PATCH] drm/edid: Allow comma separated edid binaries. (v3) Bob Paauwe
2015-08-28 6:30 ` Jani Nikula
2015-08-28 13:50 ` Daniel Vetter
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=8737z5819s.fsf@intel.com \
--to=jani.nikula@linux.intel.com \
--cc=bob.j.paauwe@intel.com \
--cc=dri-devel@lists.freedesktop.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.