From: Jani Nikula <jani.nikula@intel.com>
To: "Golani,
Mitulkumar Ajitkumar" <mitulkumar.ajitkumar.golani@intel.com>,
"dri-devel@lists.freedesktop.org"
<dri-devel@lists.freedesktop.org>
Cc: "intel-gfx@lists.freedesktop.org" <intel-gfx@lists.freedesktop.org>
Subject: Re: [Intel-gfx] [PATCH 4/6] drm/edid: use a temp variable for sads to drop one level of dereferences
Date: Tue, 26 Sep 2023 10:44:23 +0300 [thread overview]
Message-ID: <871qelml9k.fsf@intel.com> (raw)
In-Reply-To: <IA1PR11MB63480D7CC408A0340BB2C777B2FCA@IA1PR11MB6348.namprd11.prod.outlook.com>
On Mon, 25 Sep 2023, "Golani, Mitulkumar Ajitkumar" <mitulkumar.ajitkumar.golani@intel.com> wrote:
> Hi Jani,
>
> added comments in-line.
>
>> -----Original Message-----
>> From: Nikula, Jani <jani.nikula@intel.com>
>> Sent: Thursday, September 7, 2023 2:58 PM
>> To: dri-devel@lists.freedesktop.org
>> Cc: intel-gfx@lists.freedesktop.org; Nikula, Jani <jani.nikula@intel.com>;
>> Golani, Mitulkumar Ajitkumar <mitulkumar.ajitkumar.golani@intel.com>
>> Subject: [PATCH 4/6] drm/edid: use a temp variable for sads to drop one level
>> of dereferences
>>
>> It's arguably easier on the eyes, and drops a set of parenthesis too.
>
> Please consider providing a bit more context in the commit message for better clarity.
>
>>
>> Cc: Mitul Golani <mitulkumar.ajitkumar.golani@intel.com>
>> Signed-off-by: Jani Nikula <jani.nikula@intel.com>
>> ---
>> drivers/gpu/drm/drm_edid.c | 16 +++++++++-------
>> 1 file changed, 9 insertions(+), 7 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c index
>> 2025970816c9..fcdc2c314cde 100644
>> --- a/drivers/gpu/drm/drm_edid.c
>> +++ b/drivers/gpu/drm/drm_edid.c
>> @@ -5583,7 +5583,7 @@ static void drm_edid_to_eld(struct drm_connector
>> *connector, }
>>
>> static int _drm_edid_to_sad(const struct drm_edid *drm_edid,
>> - struct cea_sad **sads)
>> + struct cea_sad **psads)
>> {
>> const struct cea_db *db;
>> struct cea_db_iter iter;
>> @@ -5592,19 +5592,21 @@ static int _drm_edid_to_sad(const struct
>> drm_edid *drm_edid,
>> cea_db_iter_edid_begin(drm_edid, &iter);
>> cea_db_iter_for_each(db, &iter) {
>> if (cea_db_tag(db) == CTA_DB_AUDIO) {
>> + struct cea_sad *sads;
>> int j;
>>
>> count = cea_db_payload_len(db) / 3; /* SAD is 3B */
>> - *sads = kcalloc(count, sizeof(**sads), GFP_KERNEL);
>> - if (!*sads)
>> + sads = kcalloc(count, sizeof(*sads), GFP_KERNEL);
>> + *psads = sads;
>> + if (!sads)
>> return -ENOMEM;
>> for (j = 0; j < count; j++) {
>> const u8 *sad = &db->data[j * 3];
>>
>> - (*sads)[j].format = (sad[0] & 0x78) >> 3;
>> - (*sads)[j].channels = sad[0] & 0x7;
>> - (*sads)[j].freq = sad[1] & 0x7F;
>> - (*sads)[j].byte2 = sad[2];
>> + sads[j].format = (sad[0] & 0x78) >> 3;
>> + sads[j].channels = sad[0] & 0x7;
>> + sads[j].freq = sad[1] & 0x7F;
>> + sads[j].byte2 = sad[2];
>
> Thanks for the code update. I noticed the use of magic values in this section, which can make the code less clear
> and harder to maintain. Would it be possible to define constants or use descriptive names instead of these magic
> values?
Yes, but that would be for a separate patch. The magic values aren't
added here.
BR,
Jani.
>
> Regards,
> Mitul
>> }
>> break;
>> }
>> --
>> 2.39.2
>
--
Jani Nikula, Intel
WARNING: multiple messages have this Message-ID (diff)
From: Jani Nikula <jani.nikula@intel.com>
To: "Golani,
Mitulkumar Ajitkumar" <mitulkumar.ajitkumar.golani@intel.com>,
"dri-devel@lists.freedesktop.org"
<dri-devel@lists.freedesktop.org>
Cc: "intel-gfx@lists.freedesktop.org" <intel-gfx@lists.freedesktop.org>
Subject: RE: [PATCH 4/6] drm/edid: use a temp variable for sads to drop one level of dereferences
Date: Tue, 26 Sep 2023 10:44:23 +0300 [thread overview]
Message-ID: <871qelml9k.fsf@intel.com> (raw)
In-Reply-To: <IA1PR11MB63480D7CC408A0340BB2C777B2FCA@IA1PR11MB6348.namprd11.prod.outlook.com>
On Mon, 25 Sep 2023, "Golani, Mitulkumar Ajitkumar" <mitulkumar.ajitkumar.golani@intel.com> wrote:
> Hi Jani,
>
> added comments in-line.
>
>> -----Original Message-----
>> From: Nikula, Jani <jani.nikula@intel.com>
>> Sent: Thursday, September 7, 2023 2:58 PM
>> To: dri-devel@lists.freedesktop.org
>> Cc: intel-gfx@lists.freedesktop.org; Nikula, Jani <jani.nikula@intel.com>;
>> Golani, Mitulkumar Ajitkumar <mitulkumar.ajitkumar.golani@intel.com>
>> Subject: [PATCH 4/6] drm/edid: use a temp variable for sads to drop one level
>> of dereferences
>>
>> It's arguably easier on the eyes, and drops a set of parenthesis too.
>
> Please consider providing a bit more context in the commit message for better clarity.
>
>>
>> Cc: Mitul Golani <mitulkumar.ajitkumar.golani@intel.com>
>> Signed-off-by: Jani Nikula <jani.nikula@intel.com>
>> ---
>> drivers/gpu/drm/drm_edid.c | 16 +++++++++-------
>> 1 file changed, 9 insertions(+), 7 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c index
>> 2025970816c9..fcdc2c314cde 100644
>> --- a/drivers/gpu/drm/drm_edid.c
>> +++ b/drivers/gpu/drm/drm_edid.c
>> @@ -5583,7 +5583,7 @@ static void drm_edid_to_eld(struct drm_connector
>> *connector, }
>>
>> static int _drm_edid_to_sad(const struct drm_edid *drm_edid,
>> - struct cea_sad **sads)
>> + struct cea_sad **psads)
>> {
>> const struct cea_db *db;
>> struct cea_db_iter iter;
>> @@ -5592,19 +5592,21 @@ static int _drm_edid_to_sad(const struct
>> drm_edid *drm_edid,
>> cea_db_iter_edid_begin(drm_edid, &iter);
>> cea_db_iter_for_each(db, &iter) {
>> if (cea_db_tag(db) == CTA_DB_AUDIO) {
>> + struct cea_sad *sads;
>> int j;
>>
>> count = cea_db_payload_len(db) / 3; /* SAD is 3B */
>> - *sads = kcalloc(count, sizeof(**sads), GFP_KERNEL);
>> - if (!*sads)
>> + sads = kcalloc(count, sizeof(*sads), GFP_KERNEL);
>> + *psads = sads;
>> + if (!sads)
>> return -ENOMEM;
>> for (j = 0; j < count; j++) {
>> const u8 *sad = &db->data[j * 3];
>>
>> - (*sads)[j].format = (sad[0] & 0x78) >> 3;
>> - (*sads)[j].channels = sad[0] & 0x7;
>> - (*sads)[j].freq = sad[1] & 0x7F;
>> - (*sads)[j].byte2 = sad[2];
>> + sads[j].format = (sad[0] & 0x78) >> 3;
>> + sads[j].channels = sad[0] & 0x7;
>> + sads[j].freq = sad[1] & 0x7F;
>> + sads[j].byte2 = sad[2];
>
> Thanks for the code update. I noticed the use of magic values in this section, which can make the code less clear
> and harder to maintain. Would it be possible to define constants or use descriptive names instead of these magic
> values?
Yes, but that would be for a separate patch. The magic values aren't
added here.
BR,
Jani.
>
> Regards,
> Mitul
>> }
>> break;
>> }
>> --
>> 2.39.2
>
--
Jani Nikula, Intel
next prev parent reply other threads:[~2023-09-26 7:44 UTC|newest]
Thread overview: 41+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-09-07 9:28 [Intel-gfx] [PATCH 0/6] drm/edid: split out drm_eld.[ch], add some SAD helpers Jani Nikula
2023-09-07 9:28 ` Jani Nikula
2023-09-07 9:28 ` [Intel-gfx] [PATCH 1/6] drm/edid: split out drm_eld.h from drm_edid.h Jani Nikula
2023-09-07 9:28 ` Jani Nikula
2023-09-25 15:52 ` [Intel-gfx] " Golani, Mitulkumar Ajitkumar
2023-09-25 15:52 ` Golani, Mitulkumar Ajitkumar
2023-09-07 9:28 ` [Intel-gfx] [PATCH 2/6] drm/eld: replace uint8_t with u8 Jani Nikula
2023-09-07 9:28 ` Jani Nikula
2023-09-08 5:25 ` [Intel-gfx] " Borah, Chaitanya Kumar
2023-09-08 5:25 ` Borah, Chaitanya Kumar
2023-09-25 16:32 ` Golani, Mitulkumar Ajitkumar
2023-09-25 16:32 ` Golani, Mitulkumar Ajitkumar
2023-09-07 9:28 ` [Intel-gfx] [PATCH 3/6] drm/edid: include drm_eld.h only where required Jani Nikula
2023-09-07 9:28 ` Jani Nikula
2023-09-25 16:59 ` [Intel-gfx] " Golani, Mitulkumar Ajitkumar
2023-09-25 16:59 ` Golani, Mitulkumar Ajitkumar
2023-09-07 9:28 ` [Intel-gfx] [PATCH 4/6] drm/edid: use a temp variable for sads to drop one level of dereferences Jani Nikula
2023-09-07 9:28 ` Jani Nikula
2023-09-25 17:46 ` [Intel-gfx] " Golani, Mitulkumar Ajitkumar
2023-09-25 17:46 ` Golani, Mitulkumar Ajitkumar
2023-09-26 7:44 ` Jani Nikula [this message]
2023-09-26 7:44 ` Jani Nikula
2023-09-26 16:14 ` [Intel-gfx] " Golani, Mitulkumar Ajitkumar
2023-09-26 16:14 ` Golani, Mitulkumar Ajitkumar
2023-09-07 9:28 ` [Intel-gfx] [PATCH 5/6] drm/edid: add helpers to get/set struct cea_sad from/to 3-byte sad Jani Nikula
2023-09-07 9:28 ` Jani Nikula
2023-09-07 11:49 ` [Intel-gfx] " kernel test robot
2023-09-07 11:49 ` kernel test robot
2023-09-07 11:49 ` kernel test robot
2023-09-07 13:37 ` [Intel-gfx] " kernel test robot
2023-09-07 13:37 ` kernel test robot
2023-09-07 13:37 ` kernel test robot
2023-09-26 18:13 ` [Intel-gfx] " Golani, Mitulkumar Ajitkumar
2023-09-26 18:13 ` Golani, Mitulkumar Ajitkumar
2023-09-07 9:28 ` [Intel-gfx] [PATCH 6/6] drm/eld: add helpers to modify the SADs of an ELD Jani Nikula
2023-09-07 9:28 ` Jani Nikula
2023-09-26 18:04 ` [Intel-gfx] " Golani, Mitulkumar Ajitkumar
2023-09-26 18:04 ` Golani, Mitulkumar Ajitkumar
2023-09-07 12:14 ` [Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for drm/edid: split out drm_eld.[ch], add some SAD helpers Patchwork
2023-09-07 12:14 ` [Intel-gfx] ✗ Fi.CI.SPARSE: " Patchwork
2023-09-07 12:31 ` [Intel-gfx] ✗ Fi.CI.BAT: failure " Patchwork
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=871qelml9k.fsf@intel.com \
--to=jani.nikula@intel.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=intel-gfx@lists.freedesktop.org \
--cc=mitulkumar.ajitkumar.golani@intel.com \
/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.