Jean Pihet <jean.pi...@newoldbits.com> writes:

> On Thu, Nov 17, 2011 at 10:24 PM, Kevin Hilman <khil...@ti.com> wrote:
>> jean.pi...@newoldbits.com writes:
>>
>>> From: Jean Pihet <j-pi...@ti.com>
>>>
>>> Implement the devices wake-up latency constraints using the global
>>> device PM QoS notification handler which applies the constraints to the
>>> underlying layer by calling the corresponding function at hwmod level.
>>>
>>> Tested on OMAP3 Beagleboard and OMAP4 Pandaboard in RET/OFF using wake-up
>>> latency constraints on MPU, CORE and PER.
>>>
>>> Signed-off-by: Jean Pihet <j-pi...@ti.com>
> ...
>
>>> +/* Interface to the per-device PM QoS framework */
>>> +static int omap2_dev_pm_qos_handler(struct notifier_block *nb,
>>> +                                 unsigned long new_value,
>>> +                                 void *req)
>>> +{
>>> +     struct omap_device *od;
>>> +     struct omap_hwmod *oh;
>>> +     struct platform_device *pdev;
>>> +     struct dev_pm_qos_request *dev_pm_qos_req = req;
>>> +
>>> +     pr_debug("OMAP PM CONSTRAINTS: req@0x%p, new_value=%lu\n",
>>
>> s/CONSTRAINTS/constraints/
>> another one below.
> Ok
>
>>
>>> +              req, new_value);
>>> +
>>> +     /* Look for the platform device for the constraint target device */
>>> +     pdev = to_platform_device(dev_pm_qos_req->dev);
>>> +
>>> +     /* Try to catch non platform devices */
>>
>> why?
> The constraints targets are the power domains, which you find by
> walking through the chain of structs dev, pdev, omap_device, hwmod and
> finally pwrdm.

OK

>>
>>> +     if (pdev->name == NULL) {
>>> +             pr_err("%s: Error: platform device for device %s not valid\n",
>>> +                    __func__, dev_name(dev_pm_qos_req->dev));
>>> +             return -EINVAL;
>>> +     }
>>> +
>>> +     /* Find the associated omap_device for dev */
>>> +     od = container_of(pdev, struct omap_device, pdev);
>>
>> What about devices that are valid platform_devices, but not omap_devices?
> Do you mean that od should be tested for NULL value?

First, it should be using the to_omap_device() helper function from
omap_device.h.

Until v3.2, it was based on container_of() so checking for NULL will not
help.  However, as of v3.2, because I decoupled platform_device and
omap_device, checking for a NULL return from to_omap_device() will be a
good enough check.

Kevin
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to