From: Hans de Goede <hdegoede@redhat.com>
To: Andy Shevchenko <andy.shevchenko@gmail.com>
Cc: Mauro Carvalho Chehab <mchehab@kernel.org>,
Sakari Ailus <sakari.ailus@linux.intel.com>,
Andy Shevchenko <andy@kernel.org>, Kate Hsuan <hpa@redhat.com>,
Tsuchiya Yuto <kitakar@gmail.com>,
Yury Luneff <yury.lunev@gmail.com>,
Nable <nable.maininbox@googlemail.com>,
andrey.i.trufanov@gmail.com, Fabio Aiuto <fabioaiuto83@gmail.com>,
linux-media@vger.kernel.org, linux-staging@lists.linux.dev
Subject: Re: [PATCH 9/9] media: atomisp: Add support for v4l2-async sensor registration
Date: Fri, 19 May 2023 15:19:48 +0200 [thread overview]
Message-ID: <ece718a3-4d8c-17c7-ded0-0096c2f0fdc7@redhat.com> (raw)
In-Reply-To: <CAHp75Vf2CjdtchvOAYFpCdsqDxMy8d2CB5O6ApeqJsx98+gyXQ@mail.gmail.com>
Hi Andy,
As always thank you for the review. I know you spend a lot of time
on reviews and it is much appreciated!
I agree with all your comments and I'll address them as suggested
for the next version.
Regards,
Hans
On 5/19/23 14:45, Andy Shevchenko wrote:
> On Thu, May 18, 2023 at 6:38 PM Hans de Goede <hdegoede@redhat.com> wrote:
>
> ...
>
>> +static const guid_t atomisp_dsm_guid = GUID_INIT(0xdc2f6c4f, 0x045b, 0x4f1d,
>> + 0x97, 0xb9, 0x88, 0x2a,
>> + 0x68, 0x60, 0xa4, 0xbe);
>
> Can we use the de facto pattern for this kind of assignments?
>
> ... guid_t foo =
> <TAB>GUID_INIT(...first 3 parameters...
> <TAB><TAB>[spaces if needed)...last 8 parameters...);
> ?
>
> Also would be nice to have a comment where the GUID is represented in
> text format so it can be easily googled/searched for in
> internet/documentation.
>
> ...
>
>> + for (i = 0; i < obj->package.count - 1; i += 2) {
>> + /* The package should only contain strings */
>
>> + if (obj->package.elements[i].type != ACPI_TYPE_STRING ||
>
> i + 0 ?
>
>> + obj->package.elements[i + 1].type != ACPI_TYPE_STRING)
>> + break;
>> +
>> + if (!strcmp(obj->package.elements[i].string.pointer, key)) {
>
> Ditto?
>
>> + val = kstrdup(obj->package.elements[i + 1].string.pointer, GFP_KERNEL);
>> + dev_info(&adev->dev, "Using DSM entry %s=%s\n", key, val);
>> + break;
>> + }
>
> I would even go for temporary for element pointer
>
> ... *elem0 = &[i + 0];
> ... *elem1 = &[i + 1];
>
>> + }
>
> ...
>
>> +use_default:
>
> out_use_default:
>
> ...
>
>> + status = acpi_evaluate_object(adev->handle, "_PR0", NULL, &buffer);
>
> acpi_evaluate_object_typed()
>
>> + if (!ACPI_SUCCESS(status))
>> + return -ENOENT;
>
> ...
>
>> + if (!buffer.length || !package || package->type != ACPI_TYPE_PACKAGE)
>
> See above.
>
>> + goto fail;
>
> ...
>
>> + if (strlen(name) == 4 && !strncmp(name, "CLK", 3) &&
>
> strlen() assumes that name is NUL-terminated, hence it can be simply
> replaced with name[5] == '\0' check which can go at the end of
> conditional, so that it's also implied in strncmp() for the start of
> the string, but why not using str_has_prefix()?
>
>> + name[3] >= '0' && name[3] <= '4') {
>
> It's also possible to have it done via kstrtou8() that does almost all
> checks along with conversion. You will only need to check for > 4.
>
>> + clock_num = name[3] - '0';
>> + break;
>> + }
>> + }
>
> Altogether
>
> if (str_has_prefix()) {
> ret = kstrto...(&clock_num);
> if (ret)
> ...
> check for clock_num range if needed.
> }
>
> Yes it's longer in code.
>
> ...
>
>> +fail:
>
> err_free_pointer:
> (It will be also in align with the rest of the code AFAICS)
>
>> + ACPI_FREE(buffer.pointer);
>> +
>> + return clock_num;
>
> ...
>
>> + /* Intel DSM or DMI quirk overrides PR0 derived default */
>> + port = gmin_cfg_get_int(adev, "CsiPort", port);
>> +
>> + return port;
>
> return gmin_...;
>
> ...
>
>> + if (dev->fwnode && dev->fwnode->secondary)
>
> Please, use dev_fwnode() instead of direct access to the fwnode in
> struct device.
>
>> + return 0;
>
> ...
>
>> + struct v4l2_fwnode_endpoint vep = {
>> + .bus_type = V4L2_MBUS_CSI2_DPHY
>
> I would add a trailing comma here.
>
>> + };
>
next prev parent reply other threads:[~2023-05-19 13:19 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-05-18 15:37 [PATCH 0/9] media: atomisp: Add support for v4l2-async sensor registration Hans de Goede
2023-05-18 15:37 ` [PATCH 1/9] media: atomisp: Drop MRFLD_PORT_NUM define Hans de Goede
2023-05-18 16:05 ` Andy Shevchenko
2023-05-18 15:37 ` [PATCH 2/9] media: atomisp: Remove unused fields from struct atomisp_input_subdev Hans de Goede
2023-05-18 15:37 ` [PATCH 3/9] media: atomisp: Remove atomisp_video_init() parametrization Hans de Goede
2023-05-18 15:37 ` [PATCH 4/9] media: atomisp: Rename __get_mipi_port() to atomisp_port_to_mipi_port() Hans de Goede
2023-05-18 15:37 ` [PATCH 5/9] media: atomisp: Store number of sensor lanes per port in struct atomisp_device Hans de Goede
2023-05-18 15:37 ` [PATCH 6/9] media: atomisp: Delay mapping sensors to inputs till atomisp_register_device_nodes() Hans de Goede
2023-05-18 15:37 ` [PATCH 7/9] media: atomisp: Move pad linking to atomisp_register_device_nodes() Hans de Goede
2023-05-18 15:37 ` [PATCH 8/9] media: atomisp: Allow camera_mipi_info to be NULL Hans de Goede
2023-05-18 15:37 ` [PATCH 9/9] media: atomisp: Add support for v4l2-async sensor registration Hans de Goede
2023-05-18 17:36 ` Hans de Goede
2023-05-19 12:45 ` Andy Shevchenko
2023-05-19 13:19 ` Hans de Goede [this message]
2023-05-18 16:19 ` [PATCH 0/9] " Andy Shevchenko
2023-05-18 16:36 ` Hans de Goede
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=ece718a3-4d8c-17c7-ded0-0096c2f0fdc7@redhat.com \
--to=hdegoede@redhat.com \
--cc=andrey.i.trufanov@gmail.com \
--cc=andy.shevchenko@gmail.com \
--cc=andy@kernel.org \
--cc=fabioaiuto83@gmail.com \
--cc=hpa@redhat.com \
--cc=kitakar@gmail.com \
--cc=linux-media@vger.kernel.org \
--cc=linux-staging@lists.linux.dev \
--cc=mchehab@kernel.org \
--cc=nable.maininbox@googlemail.com \
--cc=sakari.ailus@linux.intel.com \
--cc=yury.lunev@gmail.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox