All of lore.kernel.org
 help / color / mirror / Atom feed
From: Guenter Roeck <linux@roeck-us.net>
To: Nithin Nayak Sujir <nsujir@broadcom.com>, netdev@vger.kernel.org
Cc: e1000-devel@lists.sourceforge.net,
	Bruce Allan <bruce.w.allan@intel.com>,
	Jesse Brandeburg <jesse.brandeburg@intel.com>,
	lm-sensors@lm-sensors.org, Michael Chan <mchan@broadcom.com>,
	"David S. Miller" <davem@davemloft.net>
Subject: Re: [lm-sensors] [PATCH 1/5] tg3: Convert to use hwmon_device_register_with_groups
Date: Tue, 26 Nov 2013 02:47:48 +0000	[thread overview]
Message-ID: <52940BD4.9000605@roeck-us.net> (raw)
In-Reply-To: <5293FEFA.4000700@broadcom.com>

On 11/25/2013 05:52 PM, Nithin Nayak Sujir wrote:
>
>
> On 11/22/2013 10:07 PM, Guenter Roeck wrote:
>> Use new hwmon API to simplify code, provide missing mandatory 'name'
>> sysfs attribute, and attach hwmon attributes to hwmon device instead
>> of pci device.
>>
>> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
>> ---
>>   drivers/net/ethernet/broadcom/tg3.c |   25 ++++++-------------------
>>   1 file changed, 6 insertions(+), 19 deletions(-)
>>
>> diff --git a/drivers/net/ethernet/broadcom/tg3.c b/drivers/net/ethernet/broadcom/tg3.c
>> index a9e0684..369b736 100644
>> --- a/drivers/net/ethernet/broadcom/tg3.c
>> +++ b/drivers/net/ethernet/broadcom/tg3.c
>> @@ -10629,10 +10629,8 @@ static void tg3_sd_scan_scratchpad(struct tg3 *tp, struct tg3_ocir *ocir)
>>   static ssize_t tg3_show_temp(struct device *dev,
>>                    struct device_attribute *devattr, char *buf)
>>   {
>> -    struct pci_dev *pdev = to_pci_dev(dev);
>> -    struct net_device *netdev = pci_get_drvdata(pdev);
>> -    struct tg3 *tp = netdev_priv(netdev);
>>       struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);
>> +    struct tg3 *tp = dev_get_drvdata(dev);
>
>
> Shouldn't this be
> struct tg3 *tp = netdev_priv(dev_get_drvdata(dev));
>

'struct tg3 *tp' is attached to the hwmon device in
hwmon_device_register_with_groups(), so it can be retrieved
with dev_get_drvdata() from there. Keep in mind that 'dev'
is no longer the pci device but the hwmon device.

Guenter



_______________________________________________
lm-sensors mailing list
lm-sensors@lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

WARNING: multiple messages have this Message-ID (diff)
From: Guenter Roeck <linux@roeck-us.net>
To: Nithin Nayak Sujir <nsujir@broadcom.com>, netdev@vger.kernel.org
Cc: e1000-devel@lists.sourceforge.net,
	Bruce Allan <bruce.w.allan@intel.com>,
	Jesse Brandeburg <jesse.brandeburg@intel.com>,
	lm-sensors@lm-sensors.org, Michael Chan <mchan@broadcom.com>,
	"David S. Miller" <davem@davemloft.net>
Subject: Re: [PATCH 1/5] tg3: Convert to use hwmon_device_register_with_groups
Date: Mon, 25 Nov 2013 18:47:48 -0800	[thread overview]
Message-ID: <52940BD4.9000605@roeck-us.net> (raw)
In-Reply-To: <5293FEFA.4000700@broadcom.com>

On 11/25/2013 05:52 PM, Nithin Nayak Sujir wrote:
>
>
> On 11/22/2013 10:07 PM, Guenter Roeck wrote:
>> Use new hwmon API to simplify code, provide missing mandatory 'name'
>> sysfs attribute, and attach hwmon attributes to hwmon device instead
>> of pci device.
>>
>> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
>> ---
>>   drivers/net/ethernet/broadcom/tg3.c |   25 ++++++-------------------
>>   1 file changed, 6 insertions(+), 19 deletions(-)
>>
>> diff --git a/drivers/net/ethernet/broadcom/tg3.c b/drivers/net/ethernet/broadcom/tg3.c
>> index a9e0684..369b736 100644
>> --- a/drivers/net/ethernet/broadcom/tg3.c
>> +++ b/drivers/net/ethernet/broadcom/tg3.c
>> @@ -10629,10 +10629,8 @@ static void tg3_sd_scan_scratchpad(struct tg3 *tp, struct tg3_ocir *ocir)
>>   static ssize_t tg3_show_temp(struct device *dev,
>>                    struct device_attribute *devattr, char *buf)
>>   {
>> -    struct pci_dev *pdev = to_pci_dev(dev);
>> -    struct net_device *netdev = pci_get_drvdata(pdev);
>> -    struct tg3 *tp = netdev_priv(netdev);
>>       struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);
>> +    struct tg3 *tp = dev_get_drvdata(dev);
>
>
> Shouldn't this be
> struct tg3 *tp = netdev_priv(dev_get_drvdata(dev));
>

'struct tg3 *tp' is attached to the hwmon device in
hwmon_device_register_with_groups(), so it can be retrieved
with dev_get_drvdata() from there. Keep in mind that 'dev'
is no longer the pci device but the hwmon device.

Guenter



------------------------------------------------------------------------------
Shape the Mobile Experience: Free Subscription
Software experts and developers: Be at the forefront of tech innovation.
Intel(R) Software Adrenaline delivers strategic insight and game-changing 
conversations that shape the rapidly evolving mobile landscape. Sign up now. 
http://pubads.g.doubleclick.net/gampad/clk?id=63431311&iu=/4140/ostg.clktrk
_______________________________________________
E1000-devel mailing list
E1000-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/e1000-devel
To learn more about Intel&#174; Ethernet, visit http://communities.intel.com/community/wired

  reply	other threads:[~2013-11-26  2:47 UTC|newest]

Thread overview: 54+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-23  6:07 [lm-sensors] [PATCH 0/5] net: hwmon fixes Guenter Roeck
2013-11-23  6:07 ` Guenter Roeck
2013-11-23  6:07 ` [lm-sensors] [PATCH 1/5] tg3: Convert to use hwmon_device_register_with_groups Guenter Roeck
2013-11-23  6:07   ` Guenter Roeck
2013-11-23 14:32   ` [lm-sensors] " Jean Delvare
2013-11-23 14:32     ` Jean Delvare
2013-11-26  1:52   ` Nithin Nayak Sujir
2013-11-26  1:52     ` Nithin Nayak Sujir
2013-11-26  2:47     ` Guenter Roeck [this message]
2013-11-26  2:47       ` Guenter Roeck
2013-11-26 17:50       ` [lm-sensors] " Nithin Nayak Sujir
2013-11-26 17:50         ` Nithin Nayak Sujir
2013-11-28 23:22   ` [lm-sensors] " David Miller
2013-11-28 23:22     ` David Miller
2013-11-23  6:07 ` [lm-sensors] [PATCH 2/5] igb: Convert to use devm_hwmon_device_register_with_groups Guenter Roeck
2013-11-23  6:07   ` Guenter Roeck
2013-11-25 23:16   ` [lm-sensors] " Jeff Kirsher
2013-11-25 23:16     ` Jeff Kirsher
2013-11-23  6:07 ` [lm-sensors] [PATCH 3/5] ixgbe: " Guenter Roeck
2013-11-23  6:07   ` Guenter Roeck
2013-11-25 23:17   ` [lm-sensors] " Jeff Kirsher
2013-11-25 23:17     ` Jeff Kirsher
2013-11-23  6:08 ` [lm-sensors] [PATCH 4/5] igb: Start temperature sensor attribute index with 1 Guenter Roeck
2013-11-23  6:08   ` Guenter Roeck
2013-11-23 12:58   ` [lm-sensors] " Jean Delvare
2013-11-23 12:58     ` Jean Delvare
2013-11-25 23:17   ` Jeff Kirsher
2013-11-25 23:17     ` Jeff Kirsher
2013-11-23  6:08 ` [lm-sensors] [PATCH 5/5] ixgbe: " Guenter Roeck
2013-11-23  6:08   ` Guenter Roeck
2013-11-23 13:01   ` [lm-sensors] " Jean Delvare
2013-11-23 13:01     ` Jean Delvare
2013-11-25 18:08     ` Guenter Roeck
2013-11-25 18:08       ` Guenter Roeck
2013-11-25 23:18   ` Jeff Kirsher
2013-11-25 23:18     ` Jeff Kirsher
2013-11-23 16:48 ` [lm-sensors] [PATCH 0/5] net: hwmon fixes Ben Hutchings
2013-11-23 16:48   ` Ben Hutchings
2013-11-23 17:07   ` [lm-sensors] " Guenter Roeck
2013-11-23 17:07     ` Guenter Roeck
2013-11-25 17:15     ` [lm-sensors] " Ben Hutchings
2013-11-25 17:15       ` Ben Hutchings
2013-11-25 17:48       ` [lm-sensors] " Guenter Roeck
2013-11-25 17:48         ` Guenter Roeck
2013-11-26 20:08         ` [lm-sensors] " Ben Hutchings
2013-11-26 20:08           ` Ben Hutchings
2013-11-27  3:28           ` [lm-sensors] " Guenter Roeck
2013-11-27  3:28             ` Guenter Roeck
2013-11-25 18:23       ` [lm-sensors] " Jean Delvare
2013-11-25 18:23         ` Jean Delvare
2013-11-25 18:56         ` Ben Hutchings
2013-11-25 18:56           ` Ben Hutchings
2013-11-25 19:34           ` Jean Delvare
2013-11-25 19:34             ` Jean Delvare

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=52940BD4.9000605@roeck-us.net \
    --to=linux@roeck-us.net \
    --cc=bruce.w.allan@intel.com \
    --cc=davem@davemloft.net \
    --cc=e1000-devel@lists.sourceforge.net \
    --cc=jesse.brandeburg@intel.com \
    --cc=lm-sensors@lm-sensors.org \
    --cc=mchan@broadcom.com \
    --cc=netdev@vger.kernel.org \
    --cc=nsujir@broadcom.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.