diff mbox

ACPI / Fan: Use bus id for INT3404 Fan

Message ID 1418158385-5070-1-git-send-email-srinivas.pandruvada@linux.intel.com (mailing list archive)
State Superseded, archived
Headers show

Commit Message

srinivas pandruvada Dec. 9, 2014, 8:53 p.m. UTC
The ART table refers to actual bus id name for specifying relationship.
Naming "Fan" is not enough as name in the ART table can change on every
platform.

Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
---
 drivers/acpi/fan.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

Comments

Rafael J. Wysocki Dec. 9, 2014, 9:43 p.m. UTC | #1
On Tuesday, December 09, 2014 12:53:05 PM Srinivas Pandruvada wrote:
> The ART table refers to actual bus id name for specifying relationship.
> Naming "Fan" is not enough as name in the ART table can change on every
> platform.
> 
> Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
> ---
>  drivers/acpi/fan.c | 8 +++++++-
>  1 file changed, 7 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/acpi/fan.c b/drivers/acpi/fan.c
> index caf9b76..c9213bc 100644
> --- a/drivers/acpi/fan.c
> +++ b/drivers/acpi/fan.c
> @@ -325,6 +325,7 @@ static int acpi_fan_probe(struct platform_device *pdev)
>  	struct thermal_cooling_device *cdev;
>  	struct acpi_fan *fan;
>  	struct acpi_device *device = ACPI_COMPANION(&pdev->dev);
> +	char *name;
>  
>  	fan = devm_kzalloc(&pdev->dev, sizeof(*fan), GFP_KERNEL);
>  	if (!fan) {
> @@ -346,7 +347,12 @@ static int acpi_fan_probe(struct platform_device *pdev)
>  		}
>  	}
>  
> -	cdev = thermal_cooling_device_register("Fan", device,
> +	if (!strncmp(pdev->name, "INT3404", strlen("INT3404")))

strcmp() should be sufficient here (we need to have a match to get to this point
anyway).

That said I'd compare with "PNP0C0B" and then use "Fan" if that's matching
or the device ID otherwise.

> +		name = acpi_device_bid(device);
> +	else
> +		name = "Fan";
> +
> +	cdev = thermal_cooling_device_register(name, device,
>  						&fan_cooling_ops);
>  	if (IS_ERR(cdev)) {
>  		result = PTR_ERR(cdev);
> 

And please CC ACPI patches to linux-acpi.
srinivas pandruvada Dec. 9, 2014, 11:26 p.m. UTC | #2
On Tue, 2014-12-09 at 22:43 +0100, Rafael J. Wysocki wrote: 
> On Tuesday, December 09, 2014 12:53:05 PM Srinivas Pandruvada wrote:
> > The ART table refers to actual bus id name for specifying relationship.
> > Naming "Fan" is not enough as name in the ART table can change on every
> > platform.
> > 
> > Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
> > ---
> >  drivers/acpi/fan.c | 8 +++++++-
> >  1 file changed, 7 insertions(+), 1 deletion(-)
> > 
> > diff --git a/drivers/acpi/fan.c b/drivers/acpi/fan.c
> > index caf9b76..c9213bc 100644
> > --- a/drivers/acpi/fan.c
> > +++ b/drivers/acpi/fan.c
> > @@ -325,6 +325,7 @@ static int acpi_fan_probe(struct platform_device *pdev)
> >  	struct thermal_cooling_device *cdev;
> >  	struct acpi_fan *fan;
> >  	struct acpi_device *device = ACPI_COMPANION(&pdev->dev);
> > +	char *name;
> >  
> >  	fan = devm_kzalloc(&pdev->dev, sizeof(*fan), GFP_KERNEL);
> >  	if (!fan) {
> > @@ -346,7 +347,12 @@ static int acpi_fan_probe(struct platform_device *pdev)
> >  		}
> >  	}
> >  
> > -	cdev = thermal_cooling_device_register("Fan", device,
> > +	if (!strncmp(pdev->name, "INT3404", strlen("INT3404")))
> 
> strcmp() should be sufficient here (we need to have a match to get to this point
> anyway).
The pdev->name comes up with instance number: INT3404:00, so only
comparing "INT3404" as we can have multiple instances.

> 
> That said I'd compare with "PNP0C0B" and then use "Fan" if that's matching
> or the device ID otherwise.
I will submit another patch with this change.
Here also it comes up with PNPC0B:instance number, so still have to
compare only "PNPC0B"

Thanks,
Srinivas 
> > +		name = acpi_device_bid(device);
> > +	else
> > +		name = "Fan";
> > +
> > +	cdev = thermal_cooling_device_register(name, device,
> >  						&fan_cooling_ops);
> >  	if (IS_ERR(cdev)) {
> >  		result = PTR_ERR(cdev);
> > 
> 
> And please CC ACPI patches to linux-acpi.
> 


--
To unsubscribe from this list: send the line "unsubscribe linux-pm" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Pandruvada, Srinivas Dec. 9, 2014, 11:30 p.m. UTC | #3
Corrected email address.
On Tue, 2014-12-09 at 15:26 -0800, Srinivas Pandruvada wrote: 
> On Tue, 2014-12-09 at 22:43 +0100, Rafael J. Wysocki wrote: 

> > On Tuesday, December 09, 2014 12:53:05 PM Srinivas Pandruvada wrote:

> > > The ART table refers to actual bus id name for specifying relationship.

> > > Naming "Fan" is not enough as name in the ART table can change on every

> > > platform.

> > > 

> > > Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>

> > > ---

> > >  drivers/acpi/fan.c | 8 +++++++-

> > >  1 file changed, 7 insertions(+), 1 deletion(-)

> > > 

> > > diff --git a/drivers/acpi/fan.c b/drivers/acpi/fan.c

> > > index caf9b76..c9213bc 100644

> > > --- a/drivers/acpi/fan.c

> > > +++ b/drivers/acpi/fan.c

> > > @@ -325,6 +325,7 @@ static int acpi_fan_probe(struct platform_device *pdev)

> > >  	struct thermal_cooling_device *cdev;

> > >  	struct acpi_fan *fan;

> > >  	struct acpi_device *device = ACPI_COMPANION(&pdev->dev);

> > > +	char *name;

> > >  

> > >  	fan = devm_kzalloc(&pdev->dev, sizeof(*fan), GFP_KERNEL);

> > >  	if (!fan) {

> > > @@ -346,7 +347,12 @@ static int acpi_fan_probe(struct platform_device *pdev)

> > >  		}

> > >  	}

> > >  

> > > -	cdev = thermal_cooling_device_register("Fan", device,

> > > +	if (!strncmp(pdev->name, "INT3404", strlen("INT3404")))

> > 

> > strcmp() should be sufficient here (we need to have a match to get to this point

> > anyway).

> The pdev->name comes up with instance number: INT3404:00, so only

> comparing "INT3404" as we can have multiple instances.

> 

> > 

> > That said I'd compare with "PNP0C0B" and then use "Fan" if that's matching

> > or the device ID otherwise.

> I will submit another patch with this change.

> Here also it comes up with PNPC0B:instance number, so still have to

> compare only "PNPC0B"

> 

> Thanks,

> Srinivas 

> > > +		name = acpi_device_bid(device);

> > > +	else

> > > +		name = "Fan";

> > > +

> > > +	cdev = thermal_cooling_device_register(name, device,

> > >  						&fan_cooling_ops);

> > >  	if (IS_ERR(cdev)) {

> > >  		result = PTR_ERR(cdev);

> > > 

> > 

> > And please CC ACPI patches to linux-acpi.

> > 

>
diff mbox

Patch

diff --git a/drivers/acpi/fan.c b/drivers/acpi/fan.c
index caf9b76..c9213bc 100644
--- a/drivers/acpi/fan.c
+++ b/drivers/acpi/fan.c
@@ -325,6 +325,7 @@  static int acpi_fan_probe(struct platform_device *pdev)
 	struct thermal_cooling_device *cdev;
 	struct acpi_fan *fan;
 	struct acpi_device *device = ACPI_COMPANION(&pdev->dev);
+	char *name;
 
 	fan = devm_kzalloc(&pdev->dev, sizeof(*fan), GFP_KERNEL);
 	if (!fan) {
@@ -346,7 +347,12 @@  static int acpi_fan_probe(struct platform_device *pdev)
 		}
 	}
 
-	cdev = thermal_cooling_device_register("Fan", device,
+	if (!strncmp(pdev->name, "INT3404", strlen("INT3404")))
+		name = acpi_device_bid(device);
+	else
+		name = "Fan";
+
+	cdev = thermal_cooling_device_register(name, device,
 						&fan_cooling_ops);
 	if (IS_ERR(cdev)) {
 		result = PTR_ERR(cdev);