int ipath_diag_add(struct ipath_devdata *dd) { char name[16]; int ret = 0; if (atomic_inc_return(&diagpkt_count) == 1) { ret = ipath_cdev_init(IPATH_DIAGPKT_MINOR, "ipath_diagpkt", &diagpkt_file_ops, &diagpkt_cdev, &diagpkt_class_dev); if (ret) { ipath_dev_err(dd, "Couldn't create ipath_diagpkt " "device: %d", ret); goto done; } } snprintf(name, sizeof(name), "ipath_diag%d", dd->ipath_unit); ret = ipath_cdev_init(IPATH_DIAG_MINOR_BASE + dd->ipath_unit, name, &diag_file_ops, &dd->diag_cdev, &dd->diag_class_dev); if (ret) ipath_dev_err(dd, "Couldn't create %s device: %d", name, ret); done: return ret; }
int ipath_diag_add(struct ipath_devdata *dd) { char name[16]; snprintf(name, sizeof(name), "ipath_diag%d", dd->ipath_unit); return ipath_cdev_init(IPATH_DIAG_MINOR_BASE + dd->ipath_unit, name, &diag_file_ops, &dd->diag_cdev, &dd->diag_class_dev); }