Skip to contentSkip to conversation

thermal: of: look for sensor driver parent node if device node missing

PATCH In review Laxman Dewangan 6 participants 10 messages Jul 14, 2014 – Jul 30, 2014 Thermal

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 thermal: of: look for sensor driver parent node if device node missing

There are some mfd devices which supports junction thermal interrupt like ams,AS3722. The DT binding of these devices are defined as the flat and drivers for sub module of such devices are registered as the mfd_add_devices. In this method, the sub devices registered as platform driver and these do not have the of_node pointer on their device structure. In this case, use the parent of_node pointer to get the required of_node pointer.

---
 drivers/thermal/of-thermal.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/thermal/of-thermal.c +2 -0
index 04b1be7..85a7d71 100644
@@ -396,6 +396,8 @@ thermal_zone_of_sensor_register(struct device *dev, int sensor_id,
 		return ERR_PTR(-EINVAL);
 
 	sensor_np = dev->of_node;
+	if (!sensor_np && dev->parent)
+		sensor_np = dev->parent->of_node;
 
 	for_each_child_of_node(np, child) {
 		struct of_phandle_args sensor_specs;
Signature · 1 line
1.8.1.5
#1 lore raw

Am Montag, den 14.07.2014, 16:42 +0530 schrieb Laxman Dewangan:

Quoted 18 lines

There are some mfd devices which supports junction thermal interrupt like ams,AS3722. The DT binding of these devices are defined as the flat and drivers for sub module of such devices are registered as the mfd_add_devices. In this method, the sub devices registered as platform driver and these do not have the of_node pointer on their device structure. In this case, use the parent of_node pointer to get the required of_node pointer.

---
 drivers/thermal/of-thermal.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/thermal/of-thermal.c +0 -0
index 04b1be7..85a7d71 100644

drivers/thermal/of-thermal.c thermal_zone_of_sensor_register(struct device *dev, int sensor_id, · line 403

Quoted 8 lines
drivers/thermal/of-thermal.c +2 -0
@@ -396,6 +396,8 @@ thermal_zone_of_sensor_register(struct device *dev, int sensor_id,
 		return ERR_PTR(-EINVAL);
 
 	sensor_np = dev->of_node;
+	if (!sensor_np && dev->parent)
+		sensor_np = dev->parent->of_node;
 
 	for_each_child_of_node(np, child) {
 		struct of_phandle_args sensor_specs;

This seems like the wrong way around. If the MFD has subdev information stored in the parent node it should be the MFD drivers responsibility to populate the subdev of_node with its own node. The subdev should not be forced to make such possible unsafe assumptions.

Regards,
Lucas

Signature · 2 lines
Pengutronix e.K.             | Lucas Stach                 |
Industrial Linux Solutions   | http://www.pengutronix.de/  |
#2 lore raw

Laxman,

Quoted 25 lines · Lucas Stach

Am Montag, den 14.07.2014, 16:42 +0530 schrieb Laxman Dewangan:

Quoted 24 lines

There are some mfd devices which supports junction thermal interrupt like ams,AS3722. The DT binding of these devices are defined as the flat and drivers for sub module of such devices are registered as the mfd_add_devices. In this method, the sub devices registered as platform driver and these do not have the of_node pointer on their device structure. In this case, use the parent of_node pointer to get the required of_node pointer.

---
 drivers/thermal/of-thermal.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/thermal/of-thermal.c +2 -0
index 04b1be7..85a7d71 100644
@@ -396,6 +396,8 @@ thermal_zone_of_sensor_register(struct device *dev, int sensor_id,
 		return ERR_PTR(-EINVAL);
 
 	sensor_np = dev->of_node;
+	if (!sensor_np && dev->parent)
+		sensor_np = dev->parent->of_node;
 
Quoted 8 lines

drivers/thermal/of-thermal.c thermal_zone_of_sensor_register(struct device *dev, int sensor_id, · line 403

Quoted 2 lines
drivers/thermal/of-thermal.c +0 -0
 	for_each_child_of_node(np, child) {
 		struct of_phandle_args sensor_specs;

This seems like the wrong way around. If the MFD has subdev information stored in the parent node it should be the MFD drivers responsibility to populate the subdev of_node with its own node. The subdev should not be forced to make such possible unsafe assumptions.

This is my understanding too. MFD device drivers must populate the required data onto their sub devices while creating them.

Quoted 10 lines

Regards,
Lucas

Signature · 7 lines
Pengutronix e.K.             | Lucas Stach                 |
Industrial Linux Solutions   | http://www.pengutronix.de/  |

--
To unsubscribe from this list: send the line "unsubscribe linux-pm" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#3 lore raw
Quoted 35 lines · Eduardo Valentin

Laxman,

Quoted 25 lines · Lucas Stach

Am Montag, den 14.07.2014, 16:42 +0530 schrieb Laxman Dewangan:

Quoted 24 lines

There are some mfd devices which supports junction thermal interrupt like ams,AS3722. The DT binding of these devices are defined as the flat and drivers for sub module of such devices are registered as the mfd_add_devices. In this method, the sub devices registered as platform driver and these do not have the of_node pointer on their device structure. In this case, use the parent of_node pointer to get the required of_node pointer.

---
  drivers/thermal/of-thermal.c | 2 ++
  1 file changed, 2 insertions(+)
drivers/thermal/of-thermal.c +2 -0
index 04b1be7..85a7d71 100644
@@ -396,6 +396,8 @@ thermal_zone_of_sensor_register(struct device *dev, int sensor_id,
  		return ERR_PTR(-EINVAL);
 
  	sensor_np = dev->of_node;
+	if (!sensor_np && dev->parent)
+		sensor_np = dev->parent->of_node;
 
Quoted 7 lines

drivers/thermal/of-thermal.c thermal_zone_of_sensor_register(struct device *dev, int sensor_id, · line 403

Quoted 2 lines
drivers/thermal/of-thermal.c +0 -0
  	for_each_child_of_node(np, child) {
  		struct of_phandle_args sensor_specs;

This seems like the wrong way around. If the MFD has subdev information stored in the parent node it should be the MFD drivers responsibility to populate the subdev of_node with its own node. The subdev should not be forced to make such possible unsafe assumptions.

Quoted 3 lines

This is my understanding too. MFD device drivers must populate the required data onto their sub devices while creating them.

Sometime ago, Stephen sent patch on MFD to initialize the mfd sub devices of_node with parent node.

mfd: always assign of_node in mfd_add_device()
http://lists.infradead.org/pipermail/linux-arm-kernel/2013-December/217482.html

But it has unforeseen issue and reverted with patch
mfd: Revert "mfd: Always assign of_node in mfd_add_device()"
https://groups.google.com/forum/#!msg/rtc-linux/2LeLipSPFs0/XfPCKpT1BnUJ

So we do not have any mechanism here to pass the parent of_node to the of-thermal.

Adding Stephen and Lee for more comment.

#4 lore raw

Hello Laxman,

Quoted 40 lines · Laxman Dewangan
Quoted 35 lines · Eduardo Valentin

Laxman,

Quoted 25 lines · Lucas Stach

Am Montag, den 14.07.2014, 16:42 +0530 schrieb Laxman Dewangan:

Quoted 24 lines

There are some mfd devices which supports junction thermal interrupt like ams,AS3722. The DT binding of these devices are defined as the flat and drivers for sub module of such devices are registered as the mfd_add_devices. In this method, the sub devices registered as platform driver and these do not have the of_node pointer on their device structure. In this case, use the parent of_node pointer to get the required of_node pointer.

---
  drivers/thermal/of-thermal.c | 2 ++
  1 file changed, 2 insertions(+)
drivers/thermal/of-thermal.c +2 -0
index 04b1be7..85a7d71 100644
@@ -396,6 +396,8 @@ thermal_zone_of_sensor_register(struct device *dev, int sensor_id,
  		return ERR_PTR(-EINVAL);
 
  	sensor_np = dev->of_node;
+	if (!sensor_np && dev->parent)
+		sensor_np = dev->parent->of_node;
 
Quoted 7 lines

drivers/thermal/of-thermal.c thermal_zone_of_sensor_register(struct device *dev, int sensor_id, · line 403

Quoted 2 lines
drivers/thermal/of-thermal.c +0 -0
  	for_each_child_of_node(np, child) {
  		struct of_phandle_args sensor_specs;

This seems like the wrong way around. If the MFD has subdev information stored in the parent node it should be the MFD drivers responsibility to populate the subdev of_node with its own node. The subdev should not be forced to make such possible unsafe assumptions.

Quoted 3 lines

This is my understanding too. MFD device drivers must populate the required data onto their sub devices while creating them.

Quoted 6 lines

Sometime ago, Stephen sent patch on MFD to initialize the mfd sub devices of_node with parent node.

mfd: always assign of_node in mfd_add_device()
http://lists.infradead.org/pipermail/linux-arm-kernel/2013-December/217482.html

In fact, as I mentioned, this is a controversal subject.

Quoted 4 lines

But it has unforeseen issue and reverted with patch
mfd: Revert "mfd: Always assign of_node in mfd_add_device()"
https://groups.google.com/forum/#!msg/rtc-linux/2LeLipSPFs0/XfPCKpT1BnUJ

Indeed, the strategy had issues.

Quoted 2 lines

So we do not have any mechanism here to pass the parent of_node to the of-thermal.

Yeah, but still, as you can see this issue is present in other places apart from of-thermal. Therefore, it is clear that needs to be fixed somewhere else than in of-thermal so that others benefit too, don't you agree?

Quoted 2 lines

Adding Stephen and Lee for more comment.

Sure.

In general, I believe letting sub devices to access the MFD core data (in this case, the parent of node data) is somehow racy. I would prefer we could have a way to populate the of_node of subdevs with only the required info.

#5 lore raw
In reply to Laxman Dewangan
Quoted 8 lines · Laxman Dewangan

There are some mfd devices which supports junction thermal interrupt like ams,AS3722. The DT binding of these devices are defined as the flat and drivers for sub module of such devices are registered as the mfd_add_devices. In this method, the sub devices registered as platform driver and these do not have the of_node pointer on their device structure. In this case, use the parent of_node pointer to get the required of_node pointer.

Any comment please?

reviewer
#6 lore raw

Hi, Laxman,

As Eduardo is the of thermal author and maintainer, I will take your patch only if you can get ACK from Eduardo.

Eduardo,
Do you have any comments on this?

Thanks,
rui

Quoted 19 lines

-----Original Message-----
From: Laxman Dewangan [mailto:[email protected]]
Sent: Thursday, July 24, 2014 5:49 PM
To: Zhang, Rui; [email protected]
Cc: [email protected]; [email protected]
Subject: Re: [PATCH] thermal: of: look for sensor driver parent node if device node missing
Importance: High

Quoted 8 lines · Laxman Dewangan

There are some mfd devices which supports junction thermal interrupt like ams,AS3722. The DT binding of these devices are defined as the flat and drivers for sub module of such devices are registered as the mfd_add_devices. In this method, the sub devices registered as platform driver and these do not have the of_node pointer on their device structure. In this case, use the parent of_node pointer to get the required of_node pointer.

Any comment please?

#7 lore raw

Hello,

Perhaps you may have sent this email to the wrong Eduardo as I do not recognize the topic you are discussing.

Regards,

Sent from my iPhone

Quoted 30 lines · Rui

Hi, Laxman,

As Eduardo is the of thermal author and maintainer, I will take your patch only if you can get ACK from Eduardo.

Eduardo,
Do you have any comments on this?

Thanks,
rui

Quoted 18 lines

-----Original Message-----
From: Laxman Dewangan [mailto:[email protected]]
Sent: Thursday, July 24, 2014 5:49 PM
To: Zhang, Rui; [email protected]
Cc: [email protected]; [email protected]
Subject: Re: [PATCH] thermal: of: look for sensor driver parent node if device node missing
Importance: High

Quoted 8 lines · Laxman Dewangan

There are some mfd devices which supports junction thermal interrupt like ams,AS3722. The DT binding of these devices are defined as the flat and drivers for sub module of such devices are registered as the mfd_add_devices. In this method, the sub devices registered as platform driver and these do not have the of_node pointer on their device structure. In this case, use the parent of_node pointer to get the required of_node pointer.

Any comment please?

#8 lore raw
In reply to Zhang, Rui

Thanks Rui.
It seems I have put the wrong email-id for Eduardo (which I got from get_maintainer) and the original patch not reached to Eduardo.

Do I need to re-post patch?

Thanks,
Laxman

Quoted 29 lines · Rui

Hi, Laxman,

As Eduardo is the of thermal author and maintainer, I will take your patch only if you can get ACK from Eduardo.

Eduardo,
Do you have any comments on this?

Thanks,
rui

Quoted 19 lines

-----Original Message-----
From: Laxman Dewangan [mailto:[email protected]]
Sent: Thursday, July 24, 2014 5:49 PM
To: Zhang, Rui; [email protected]
Cc: [email protected]; [email protected]
Subject: Re: [PATCH] thermal: of: look for sensor driver parent node if device node missing
Importance: High

Quoted 8 lines · Laxman Dewangan

There are some mfd devices which supports junction thermal interrupt like ams,AS3722. The DT binding of these devices are defined as the flat and drivers for sub module of such devices are registered as the mfd_add_devices. In this method, the sub devices registered as platform driver and these do not have the of_node pointer on their device structure. In this case, use the parent of_node pointer to get the required of_node pointer.

Any comment please?

#9 lore raw
Quoted 4 lines · Laxman Dewangan

Thanks Rui.
It seems I have put the wrong email-id for Eduardo (which I got from get_maintainer) and the original patch not reached to Eduardo.

Quoted 12 lines

Do I need to re-post patch?

Thanks,
Laxman

Quoted 6 lines · Rui

Hi, Laxman,

As Eduardo is the of thermal author and maintainer, I will take your patch only if you can get ACK from Eduardo.

Eduardo,
Do you have any comments on this?

[Fixed Eduardo's email.]

Quoted 25 lines
Quoted 18 lines
Quoted 18 lines

-----Original Message-----
From: Laxman Dewangan [mailto:[email protected]]
Sent: Thursday, July 24, 2014 5:49 PM
To: Zhang, Rui; [email protected]
Cc: [email protected]; [email protected]
Subject: Re: [PATCH] thermal: of: look for sensor driver parent node if device node missing
Importance: High

Quoted 8 lines · Laxman Dewangan

There are some mfd devices which supports junction thermal interrupt like ams,AS3722. The DT binding of these devices are defined as the flat and drivers for sub module of such devices are registered as the mfd_add_devices. In this method, the sub devices registered as platform driver and these do not have the of_node pointer on their device structure. In this case, use the parent of_node pointer to get the required of_node pointer.

Quoted 1 line
Quoted 1 line

Any comment please?

--
To unsubscribe from this list: send the line "unsubscribe linux-pm" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html