Thread (3 messages) 3 messages, 3 authors, 2016-01-20

Re: [PATCH v5 1/2] mfd: act8945a: add Active-semi ACT8945A PMIC MFD driver

flat view

From: Krzysztof Kozlowski <hidden>
Date: 2016-01-20 07:53:17
Also in: linux-arm-kernel, lkml

On 20.01.2016 16:50, Yang, Wenyou wrote:
Hi Peter,

On 2016/1/20 15:40, Peter Korsgaard wrote:
quoted
quoted
quoted
quoted
quoted
quoted
"Yang," == Yang, Wenyou [off-list ref] writes:
Hi,
quoted
quoted
But the charger driver can just as well do:
  >>
  >> dev_get_regmap(dev->parent);
  >>
  >> instead of:
  >>
  >> dev_get_drvdata(pdev->dev.parent)->regmap.

  > For regulator, it works use the core do dev_get_regmap(dev->parent),
  > but for charger, it need to export *act8945a.

Why?
There is a callback (*get_property)(...), who will read the charger
register via regmap,

but it doesn't provide the argument for regmap.

include/linux/power_supply.h

struct power_supply_desc {
        [ ... ]
        int (*get_property)(struct power_supply *psy,
                             enum power_supply_property psp,
                             union power_supply_propval *val);
        [ ... ]

}
quoted
Just like the regulator core does, your battery driver can do:

dev_get_regmap(dev->parent);
Why can't you store the pointer to regmap as power supply driver data?
There is really no need for the structure containing only one pointer.

BR,
Krzysztof
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help