diff options
Diffstat (limited to 'drivers/scsi/st.c')
-rw-r--r-- | drivers/scsi/st.c | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/drivers/scsi/st.c b/drivers/scsi/st.c index b37b9b00c4b4..e0a1e52a04e7 100644 --- a/drivers/scsi/st.c +++ b/drivers/scsi/st.c | |||
@@ -4452,11 +4452,41 @@ static ssize_t version_show(struct device_driver *ddd, char *buf) | |||
4452 | } | 4452 | } |
4453 | static DRIVER_ATTR_RO(version); | 4453 | static DRIVER_ATTR_RO(version); |
4454 | 4454 | ||
4455 | #if DEBUG | ||
4456 | static ssize_t debug_flag_store(struct device_driver *ddp, | ||
4457 | const char *buf, size_t count) | ||
4458 | { | ||
4459 | /* We only care what the first byte of the data is the rest is unused. | ||
4460 | * if it's a '1' we turn on debug and if it's a '0' we disable it. All | ||
4461 | * other values have -EINVAL returned if they are passed in. | ||
4462 | */ | ||
4463 | if (count > 0) { | ||
4464 | if (buf[0] == '0') { | ||
4465 | debugging = NO_DEBUG; | ||
4466 | return count; | ||
4467 | } else if (buf[0] == '1') { | ||
4468 | debugging = 1; | ||
4469 | return count; | ||
4470 | } | ||
4471 | } | ||
4472 | return -EINVAL; | ||
4473 | } | ||
4474 | |||
4475 | static ssize_t debug_flag_show(struct device_driver *ddp, char *buf) | ||
4476 | { | ||
4477 | return scnprintf(buf, PAGE_SIZE, "%d\n", debugging); | ||
4478 | } | ||
4479 | static DRIVER_ATTR_RW(debug_flag); | ||
4480 | #endif | ||
4481 | |||
4455 | static struct attribute *st_drv_attrs[] = { | 4482 | static struct attribute *st_drv_attrs[] = { |
4456 | &driver_attr_try_direct_io.attr, | 4483 | &driver_attr_try_direct_io.attr, |
4457 | &driver_attr_fixed_buffer_size.attr, | 4484 | &driver_attr_fixed_buffer_size.attr, |
4458 | &driver_attr_max_sg_segs.attr, | 4485 | &driver_attr_max_sg_segs.attr, |
4459 | &driver_attr_version.attr, | 4486 | &driver_attr_version.attr, |
4487 | #if DEBUG | ||
4488 | &driver_attr_debug_flag.attr, | ||
4489 | #endif | ||
4460 | NULL, | 4490 | NULL, |
4461 | }; | 4491 | }; |
4462 | ATTRIBUTE_GROUPS(st_drv); | 4492 | ATTRIBUTE_GROUPS(st_drv); |