Re: [PATCH] cxgb3 - convert to user struct device instead of class_device

2007-02-08 Thread Jeff Garzik

Roland Dreier wrote:

 > I pushed a fix in the -mm tree as soon as the driver got committed there.
 > I saw the patch committed in Jeff's upstream branch yesterday.
 > It looks like it did not make it to Linus'tree though.

OK, I missed that.  In any case cxgb3 in Linus's tree doesn't build
right now.  What's the plan to fix this, Jeff?  Will you merge a fix
through your tree?  I can resend the patch if you want, or send it
directly to Andrew if that's preferred.


The fix has already been sent upstream.

Jeff



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


Re: [PATCH] cxgb3 - convert to user struct device instead of class_device

2007-02-08 Thread Roland Dreier
 > I pushed a fix in the -mm tree as soon as the driver got committed there.
 > I saw the patch committed in Jeff's upstream branch yesterday.
 > It looks like it did not make it to Linus'tree though.

OK, I missed that.  In any case cxgb3 in Linus's tree doesn't build
right now.  What's the plan to fix this, Jeff?  Will you merge a fix
through your tree?  I can resend the patch if you want, or send it
directly to Andrew if that's preferred.

 - R.
-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] cxgb3 - convert to user struct device instead of class_device

2007-02-08 Thread Divy Le Ray

Roland Dreier wrote:

 > But I think Jeff already has a patch in the queue that makes this very
 > change :)

Really?  I'm not sure I looked everywhere in Jeff's maze of git
branches but I didn't see anything obvious in netdev-2.6.git when I
looked before sending this.

 - R.
  

I pushed a fix in the -mm tree as soon as the driver got committed there.
I saw the patch committed in Jeff's upstream branch yesterday.
It looks like it did not make it to Linus'tree though.

Cheers,
Divy
-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] cxgb3 - convert to user struct device instead of class_device

2007-02-08 Thread Kumar Gala


On Feb 8, 2007, at 4:02 PM, Roland Dreier wrote:


Andrew told me to drop it, so I dropped it :)


That's odd -- do you know why?  drivers/net/cxgb3 won't build at all
in Linus's tree.  I would have thought we want to fix it ASAP.


I've posted a similar patch for drivers/net/gianfar_sysfs.c that is  
needed for it to build in linus's tree.


- k
-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] cxgb3 - convert to user struct device instead of class_device

2007-02-08 Thread Roland Dreier
 > Andrew told me to drop it, so I dropped it :)

That's odd -- do you know why?  drivers/net/cxgb3 won't build at all
in Linus's tree.  I would have thought we want to fix it ASAP.

 - R.
-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] cxgb3 - convert to user struct device instead of class_device

2007-02-08 Thread Jeff Garzik

Roland Dreier wrote:

 > But I think Jeff already has a patch in the queue that makes this very
 > change :)

Really?  I'm not sure I looked everywhere in Jeff's maze of git
branches but I didn't see anything obvious in netdev-2.6.git when I
looked before sending this.


Andrew told me to drop it, so I dropped it :)

Jeff



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


Re: [PATCH] cxgb3 - convert to user struct device instead of class_device

2007-02-08 Thread Roland Dreier
 > But I think Jeff already has a patch in the queue that makes this very
 > change :)

Really?  I'm not sure I looked everywhere in Jeff's maze of git
branches but I didn't see anything obvious in netdev-2.6.git when I
looked before sending this.

 - R.
-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] cxgb3 - convert to user struct device instead of class_device

2007-02-08 Thread Greg KH
On Thu, Feb 08, 2007 at 12:41:28PM -0800, Roland Dreier wrote:
> Commit 43cb76d9 ("Network: convert network devices to use struct
> device instead of class_device") breaks the just-merged cxgb3 driver,
> since the code that was merged predates the change and was not in the
> tree when Greg made the change.
> 
> This patch fixes cxgb3 to build with the change.  It also removes the
> private to_net_dev() macro and changes the use of bare netdev->priv in
> favor of netdev_priv(netdev) in the sysfs attribute functions.
> 
> I tested this on my system which has cxgb3 hardware, and it looks like
> all the sysfs files are created correctly and contain sane-looking
> values, although I don't actually know how to test that every
> attribute is working as it should.

If it compiles with no warnings, it should be safe.

> Signed-off-by: Roland Dreier <[EMAIL PROTECTED]>

Signed-off-by: Greg Kroah-Hartman <[EMAIL PROTECTED]>

But I think Jeff already has a patch in the queue that makes this very
change :)

thanks,

greg k-h
-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] cxgb3 - convert to user struct device instead of class_device

2007-02-08 Thread Roland Dreier
Commit 43cb76d9 ("Network: convert network devices to use struct
device instead of class_device") breaks the just-merged cxgb3 driver,
since the code that was merged predates the change and was not in the
tree when Greg made the change.

This patch fixes cxgb3 to build with the change.  It also removes the
private to_net_dev() macro and changes the use of bare netdev->priv in
favor of netdev_priv(netdev) in the sysfs attribute functions.

I tested this on my system which has cxgb3 hardware, and it looks like
all the sysfs files are created correctly and contain sane-looking
values, although I don't actually know how to test that every
attribute is working as it should.

Signed-off-by: Roland Dreier <[EMAIL PROTECTED]>

---

diff --git a/drivers/net/cxgb3/cxgb3_main.c b/drivers/net/cxgb3/cxgb3_main.c
index dfa035a..8d2fd21 100644
--- a/drivers/net/cxgb3/cxgb3_main.c
+++ b/drivers/net/cxgb3/cxgb3_main.c
@@ -74,8 +74,6 @@ enum {
 
 #define EEPROM_MAGIC 0x38E2F10C
 
-#define to_net_dev(class) container_of(class, struct net_device, class_dev)
-
 #define CH_DEVICE(devid, ssid, idx) \
{ PCI_VENDOR_ID_CHELSIO, devid, PCI_ANY_ID, ssid, 0, 0, idx }
 
@@ -434,11 +432,11 @@ static int setup_sge_qsets(struct adapter *adap)
return 0;
 }
 
-static ssize_t attr_show(struct class_device *cd, char *buf,
+static ssize_t attr_show(struct device *d, char *buf,
 ssize_t(*format) (struct adapter *, char *))
 {
ssize_t len;
-   struct adapter *adap = to_net_dev(cd)->priv;
+   struct adapter *adap = netdev_priv(to_net_dev(d));
 
/* Synchronize with ioctls that may shut down the device */
rtnl_lock();
@@ -447,14 +445,14 @@ static ssize_t attr_show(struct class_device *cd, char 
*buf,
return len;
 }
 
-static ssize_t attr_store(struct class_device *cd, const char *buf, size_t len,
+static ssize_t attr_store(struct device *d, const char *buf, size_t len,
  ssize_t(*set) (struct adapter *, unsigned int),
  unsigned int min_val, unsigned int max_val)
 {
char *endp;
ssize_t ret;
unsigned int val;
-   struct adapter *adap = to_net_dev(cd)->priv;
+   struct adapter *adap = netdev_priv(to_net_dev(d));
 
if (!capable(CAP_NET_ADMIN))
return -EPERM;
@@ -476,9 +474,10 @@ static ssize_t format_##name(struct adapter *adap, char 
*buf) \
 { \
return sprintf(buf, "%u\n", val_expr); \
 } \
-static ssize_t show_##name(struct class_device *cd, char *buf) \
+static ssize_t show_##name(struct device *d, struct device_attribute *attr, \
+  char *buf)   \
 { \
-   return attr_show(cd, buf, format_##name); \
+   return attr_show(d, buf, format_##name); \
 }
 
 static ssize_t set_nfilters(struct adapter *adap, unsigned int val)
@@ -493,10 +492,10 @@ static ssize_t set_nfilters(struct adapter *adap, 
unsigned int val)
return 0;
 }
 
-static ssize_t store_nfilters(struct class_device *cd, const char *buf,
- size_t len)
+static ssize_t store_nfilters(struct device *d, struct device_attribute *attr,
+ const char *buf, size_t len)
 {
-   return attr_store(cd, buf, len, set_nfilters, 0, ~0);
+   return attr_store(d, buf, len, set_nfilters, 0, ~0);
 }
 
 static ssize_t set_nservers(struct adapter *adap, unsigned int val)
@@ -509,38 +508,38 @@ static ssize_t set_nservers(struct adapter *adap, 
unsigned int val)
return 0;
 }
 
-static ssize_t store_nservers(struct class_device *cd, const char *buf,
- size_t len)
+static ssize_t store_nservers(struct device *d, struct device_attribute *attr,
+ const char *buf, size_t len)
 {
-   return attr_store(cd, buf, len, set_nservers, 0, ~0);
+   return attr_store(d, buf, len, set_nservers, 0, ~0);
 }
 
 #define CXGB3_ATTR_R(name, val_expr) \
 CXGB3_SHOW(name, val_expr) \
-static CLASS_DEVICE_ATTR(name, S_IRUGO, show_##name, NULL)
+static DEVICE_ATTR(name, S_IRUGO, show_##name, NULL)
 
 #define CXGB3_ATTR_RW(name, val_expr, store_method) \
 CXGB3_SHOW(name, val_expr) \
-static CLASS_DEVICE_ATTR(name, S_IRUGO | S_IWUSR, show_##name, store_method)
+static DEVICE_ATTR(name, S_IRUGO | S_IWUSR, show_##name, store_method)
 
 CXGB3_ATTR_R(cam_size, t3_mc5_size(&adap->mc5));
 CXGB3_ATTR_RW(nfilters, adap->params.mc5.nfilters, store_nfilters);
 CXGB3_ATTR_RW(nservers, adap->params.mc5.nservers, store_nservers);
 
 static struct attribute *cxgb3_attrs[] = {
-   &class_device_attr_cam_size.attr,
-   &class_device_attr_nfilters.attr,
-   &class_device_attr_nservers.attr,
+   &dev_attr_cam_size.attr,
+   &dev_attr_nfilters.attr,
+   &dev_attr_nservers.attr,
NULL
 };
 
 static struct attribute_group cxgb3_attr_group = {.attrs = cxgb3_attrs };
 
-static ssize_t tm_attr_show(struct class_device *cd, char *buf, int sche