From: Jacek Anaszewski <j.anaszewski@samsung.com>
To: Sylwester Nawrocki <s.nawrocki@samsung.com>
Cc: linux-leds@vger.kernel.org, linux-media@vger.kernel.org,
devicetree@vger.kernel.org, kyungmin.park@samsung.com,
pavel@ucw.cz, cooloney@gmail.com, rpurdie@rpsys.net,
sakari.ailus@iki.fi
Subject: Re: [PATCH v9 8/8] exynos4-is: Add support for v4l2-flash subdevs
Date: Tue, 26 May 2015 11:28:45 +0200 [thread overview]
Message-ID: <55643CCD.4070607@samsung.com> (raw)
In-Reply-To: <5564371E.2040705@samsung.com>
Hi Sylwester,
Thanks for the review.
On 05/26/2015 11:04 AM, Sylwester Nawrocki wrote:
> On 25/05/15 17:14, Jacek Anaszewski wrote:
>> This patch adds support for external v4l2-flash devices.
>> The support includes parsing "camera-flashes" DT property
>
> "samsung,camera-flashes" ?
Right.
>> and asynchronous sub-device registration.
>
>> +static int fimc_md_register_flash_entities(struct fimc_md *fmd)
>> +{
>> + struct device_node *parent = fmd->pdev->dev.of_node, *np_sensor,
>> + *np_flash;
>> + struct v4l2_async_notifier *notifier = &fmd->subdev_notifier;
>> + struct v4l2_async_subdev *asd;
>> + int i, j, num_flashes = 0, num_elems;
>> +
>> + num_elems = of_property_count_elems_of_size(parent,
>> + "samsung,camera-flashes", sizeof(np_flash));
>
> I think this should be of_property_count_u32_elems(), phandle is always
> a 32-bit value [1], while size of a pointer depends on the architecture.
Thanks for spotting this.
>
>> + /* samsung,camera-flashes property is optional */
>> + if (num_elems < 0)
>> + return 0;
>> +
>> + /* samsung,camera-flashes array must have even number of elements */
>> + if ((num_elems & 1) || (num_elems > FIMC_MAX_SENSORS * 2))
>> + return -EINVAL;
>> +
>> + for (i = 0; i < num_elems; i += 2) {
>> + np_sensor = of_parse_phandle(parent,
>> + "samsung,camera-flashes", i);
>> +
>> + for (j = 0; j < fmd->num_sensors; j++)
>> + if (fmd->async_subdevs.sensors[j].match.of.node ==
>> + np_sensor)
>> + break;
>> +
>> + of_node_put(np_sensor);
>
> Would be good to add some comment here, why is the sensor required.
> It's just a DT correctness check?
Yes, it checks whether the phandle points to the sensor node
which was previously registered.
> Couldn't we carry on with the flash
> registration after just emitting some warning?
Hmm, I've just realized that with this code the flash phandle associated
with the sensor phandle that hasn't been previously registered would be
silently ignored.
I agree that we should register the flash and emit warning in case
sensor phandle doesn't point the known sensor.
>> + if (j == fmd->num_sensors)
>> + continue;
>> +
>> + np_flash = of_parse_phandle(parent, "samsung,camera-flashes",
>> + i + 1);
>> +
>> + asd = &fmd->async_subdevs.flashes[num_flashes++];
>> + asd->match_type = V4L2_ASYNC_MATCH_OF;
>> + asd->match.of.node = np_flash;
>> + notifier->subdevs[notifier->num_subdevs++] = asd;
>> +
>> + of_node_put(np_flash);
>> + }
>> +
>> + return 0;
>> +}
>
> Otherwise looks good to me.
>
--
Best Regards,
Jacek Anaszewski
prev parent reply other threads:[~2015-05-26 13:43 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-05-25 15:13 [PATCH v9 0/8] LED / flash API integration Jacek Anaszewski
2015-05-25 15:13 ` [PATCH v9 1/8] Documentation: leds: Add description of v4l2-flash sub-device Jacek Anaszewski
2015-06-01 20:58 ` Sakari Ailus
2015-05-25 15:13 ` [PATCH v9 2/8] media: Add registration helpers for V4L2 flash sub-devices Jacek Anaszewski
2015-06-01 20:59 ` Sakari Ailus
2015-06-02 9:13 ` Jacek Anaszewski
2015-06-02 15:32 ` Sakari Ailus
2015-06-03 7:56 ` Jacek Anaszewski
2015-06-03 20:59 ` Sakari Ailus
2015-06-08 7:21 ` Jacek Anaszewski
2015-06-08 7:37 ` Sakari Ailus
2015-06-08 7:43 ` Jacek Anaszewski
2015-06-18 17:45 ` Alexey Klimov
2015-06-19 6:27 ` Jacek Anaszewski
2015-05-25 15:13 ` [PATCH v9 3/8] leds: max77693: add support for V4L2 Flash sub-device Jacek Anaszewski
2015-06-01 21:21 ` Sakari Ailus
2015-05-25 15:13 ` [PATCH v9 4/8] DT: aat1290: Document handling external strobe sources Jacek Anaszewski
2015-05-25 15:14 ` [PATCH v9 5/8] leds: aat1290: add support for V4L2 Flash sub-device Jacek Anaszewski
2015-05-25 15:14 ` [PATCH v9 6/8] exynos4-is: Improve the mechanism of async subdevs verification Jacek Anaszewski
2015-05-25 15:14 ` [PATCH v9 7/8] DT: Add documentation for exynos4-is 'flashes' property Jacek Anaszewski
2015-05-25 15:14 ` [PATCH v9 8/8] exynos4-is: Add support for v4l2-flash subdevs Jacek Anaszewski
2015-05-26 9:04 ` Sylwester Nawrocki
2015-05-26 9:28 ` Jacek Anaszewski [this message]
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=55643CCD.4070607@samsung.com \
--to=j.anaszewski@samsung.com \
--cc=cooloney@gmail.com \
--cc=devicetree@vger.kernel.org \
--cc=kyungmin.park@samsung.com \
--cc=linux-leds@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=pavel@ucw.cz \
--cc=rpurdie@rpsys.net \
--cc=s.nawrocki@samsung.com \
--cc=sakari.ailus@iki.fi \
/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).