On Tuesday 18 September 2007 09:16, Michael S. Tsirkin wrote:
> > +static ssize_t show_hca(struct class_device *cdev, char *buf)
> > +{
> > +   struct mlx4_ib_dev *dev = container_of(cdev, struct mlx4_ib_dev, 
> > ib_dev.class_dev);
> > +   switch (dev->dev->pdev->device) {
> > +   case 0x6340:
> > +           return sprintf(buf, "MT25408\n");
> > +   case 0x634a:
> > +           return sprintf(buf, "MT25418\n");
> > +   case 0x6354:
> > +           return sprintf(buf, "MT25428\n");
> > +   case 0x6732:
> > +           return sprintf(buf, "MT26418\n");
> > +   case 0x673c:
> > +           return sprintf(buf, "MT26428\n");
> > +   default:
> > +           return sprintf(buf, "unknown\n");
> > +   }
> > +}
> 
> How about just
> 
> static ssize_t show_hca(struct class_device *cdev, char *buf)
> {
>       struct mlx4_ib_dev *dev = container_of(cdev, struct mlx4_ib_dev, 
> ib_dev.class_dev);
>       return sprintf(buf, "MT%d\n", dev->dev->pdev->device);
> }
> 
Looks OK.  Don't need the "default" case, since the kernel will only invoke the 
mlx4 driver
for the device-id's it registers for.
(see static struct pci_device_id mlx4_pci_table[] in file 
drivers/net/mlx4/main.c)

- Jack
_______________________________________________
general mailing list
[email protected]
http://lists.openfabrics.org/cgi-bin/mailman/listinfo/general

To unsubscribe, please visit http://openib.org/mailman/listinfo/openib-general

Reply via email to