} \
} while (0)
+static inline int obd_check_dev_active(struct obd_device *obd)
+{
+ int rc;
+
+ rc = obd_check_dev(obd);
+ if (rc)
+ return rc;
+ if (!obd->obd_set_up || obd->obd_stopping) {
+ CERROR("Device %d not setup\n", obd->obd_minor);
+ return -ENODEV;
+ }
+ return rc;
+}
#if defined (CONFIG_PROC_FS)
#define OBD_COUNTER_OFFSET(op) \
struct obd_device *obd = imp->imp_obd;
int rc;
- OBD_CHECK_DEV_ACTIVE(obd);
+ rc = obd_check_dev_active(obd);
+ if (rc)
+ return rc;
OBD_CHECK_DT_OP(obd, add_conn, -EOPNOTSUPP);
OBD_COUNTER_INCREMENT(obd, add_conn);
struct obd_device *obd = imp->imp_obd;
int rc;
- OBD_CHECK_DEV_ACTIVE(obd);
+ rc = obd_check_dev_active(obd);
+ if (rc)
+ return rc;
OBD_CHECK_DT_OP(obd, del_conn, -EOPNOTSUPP);
OBD_COUNTER_INCREMENT(obd, del_conn);
__u64 ocf = data ? data->ocd_connect_flags : 0; /* for post-condition
* check */
- OBD_CHECK_DEV_ACTIVE(obd);
+ rc = obd_check_dev_active(obd);
+ if (rc)
+ return rc;
OBD_CHECK_DT_OP(obd, connect, -EOPNOTSUPP);
OBD_COUNTER_INCREMENT(obd, connect);
__u64 ocf = d ? d->ocd_connect_flags : 0; /* for post-condition
* check */
- OBD_CHECK_DEV_ACTIVE(obd);
+ rc = obd_check_dev_active(obd);
+ if (rc)
+ return rc;
OBD_CHECK_DT_OP(obd, reconnect, 0);
OBD_COUNTER_INCREMENT(obd, reconnect);