X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=drivers%2Fs390%2Fcio%2Fcmf.c;h=07ef3f640f4aa73ec17460a93ab020f21a9bfb2e;hb=43bc926fffd92024b46cafaf7350d669ba9ca884;hp=788ae49c57959496471f4e9cdcfa1763fb53ee3d;hpb=9bf4aaab3e101692164d49b7ca357651eb691cb6;p=linux-2.6.git diff --git a/drivers/s390/cio/cmf.c b/drivers/s390/cio/cmf.c index 788ae49c5..07ef3f640 100644 --- a/drivers/s390/cio/cmf.c +++ b/drivers/s390/cio/cmf.c @@ -1,5 +1,5 @@ /* - * linux/drivers/s390/cio/cmf.c ($Revision: 1.15 $) + * linux/drivers/s390/cio/cmf.c * * Linux on zSeries Channel Measurement Facility support * @@ -30,10 +30,13 @@ #include #include #include +#include +#include /* get_clock() */ #include #include #include +#include #include "cio.h" #include "css.h" @@ -175,7 +178,7 @@ set_schib(struct ccw_device *cdev, u32 mme, int mbfc, unsigned long address) /* msch can silently fail, so do it again if necessary */ for (retry = 0; retry < 3; retry++) { /* prepare schib */ - stsch(sch->irq, schib); + stsch(sch->schid, schib); schib->pmcw.mme = mme; schib->pmcw.mbfc = mbfc; /* address can be either a block address or a block index */ @@ -185,7 +188,7 @@ set_schib(struct ccw_device *cdev, u32 mme, int mbfc, unsigned long address) schib->pmcw.mbi = address; /* try to submit it */ - switch(ret = msch_err(sch->irq, schib)) { + switch(ret = msch_err(sch->schid, schib)) { case 0: break; case 1: @@ -199,7 +202,7 @@ set_schib(struct ccw_device *cdev, u32 mme, int mbfc, unsigned long address) ret = -EINVAL; break; } - stsch(sch->irq, schib); /* restore the schib */ + stsch(sch->schid, schib); /* restore the schib */ if (ret) break; @@ -526,29 +529,26 @@ readall_cmb (struct ccw_device *cdev, struct cmbdata *data) time = get_clock() - cdev->private->cmb_start_time; spin_unlock_irqrestore(cdev->ccwlock, flags); - *data = (struct cmbdata) { - /* we only know values before device_busy_time */ - .size = offsetof(struct cmbdata, device_busy_time), - - /* conver to nanoseconds */ - .elapsed_time = (time * 1000) >> 12, - - /* copy data to new structure */ - .ssch_rsch_count = cmb.ssch_rsch_count, - .sample_count = cmb.sample_count, - - /* time fields are converted to nanoseconds while copying */ - .device_connect_time - = time_to_nsec(cmb.device_connect_time), - .function_pending_time - = time_to_nsec(cmb.function_pending_time), - .device_disconnect_time - = time_to_nsec(cmb.device_disconnect_time), - .control_unit_queuing_time - = time_to_nsec(cmb.control_unit_queuing_time), - .device_active_only_time - = time_to_nsec(cmb.device_active_only_time), - }; + memset(data, 0, sizeof(struct cmbdata)); + + /* we only know values before device_busy_time */ + data->size = offsetof(struct cmbdata, device_busy_time); + + /* convert to nanoseconds */ + data->elapsed_time = (time * 1000) >> 12; + + /* copy data to new structure */ + data->ssch_rsch_count = cmb.ssch_rsch_count; + data->sample_count = cmb.sample_count; + + /* time fields are converted to nanoseconds while copying */ + data->device_connect_time = time_to_nsec(cmb.device_connect_time); + data->function_pending_time = time_to_nsec(cmb.function_pending_time); + data->device_disconnect_time = time_to_nsec(cmb.device_disconnect_time); + data->control_unit_queuing_time + = time_to_nsec(cmb.control_unit_queuing_time); + data->device_active_only_time + = time_to_nsec(cmb.device_active_only_time); return 0; } @@ -642,8 +642,7 @@ static void free_cmbe (struct ccw_device *cdev) { spin_lock_irq(cdev->ccwlock); - if (cdev->private->cmb) - kfree(cdev->private->cmb); + kfree(cdev->private->cmb); cdev->private->cmb = NULL; spin_unlock_irq(cdev->ccwlock); @@ -739,33 +738,29 @@ readall_cmbe (struct ccw_device *cdev, struct cmbdata *data) time = get_clock() - cdev->private->cmb_start_time; spin_unlock_irqrestore(cdev->ccwlock, flags); - *data = (struct cmbdata) { - /* we only know values before device_busy_time */ - .size = offsetof(struct cmbdata, device_busy_time), - - /* conver to nanoseconds */ - .elapsed_time = (time * 1000) >> 12, - - /* copy data to new structure */ - .ssch_rsch_count = cmb.ssch_rsch_count, - .sample_count = cmb.sample_count, - - /* time fields are converted to nanoseconds while copying */ - .device_connect_time - = time_to_nsec(cmb.device_connect_time), - .function_pending_time - = time_to_nsec(cmb.function_pending_time), - .device_disconnect_time - = time_to_nsec(cmb.device_disconnect_time), - .control_unit_queuing_time - = time_to_nsec(cmb.control_unit_queuing_time), - .device_active_only_time - = time_to_nsec(cmb.device_active_only_time), - .device_busy_time - = time_to_nsec(cmb.device_busy_time), - .initial_command_response_time - = time_to_nsec(cmb.initial_command_response_time), - }; + memset (data, 0, sizeof(struct cmbdata)); + + /* we only know values before device_busy_time */ + data->size = offsetof(struct cmbdata, device_busy_time); + + /* conver to nanoseconds */ + data->elapsed_time = (time * 1000) >> 12; + + /* copy data to new structure */ + data->ssch_rsch_count = cmb.ssch_rsch_count; + data->sample_count = cmb.sample_count; + + /* time fields are converted to nanoseconds while copying */ + data->device_connect_time = time_to_nsec(cmb.device_connect_time); + data->function_pending_time = time_to_nsec(cmb.function_pending_time); + data->device_disconnect_time = time_to_nsec(cmb.device_disconnect_time); + data->control_unit_queuing_time + = time_to_nsec(cmb.control_unit_queuing_time); + data->device_active_only_time + = time_to_nsec(cmb.device_active_only_time); + data->device_busy_time = time_to_nsec(cmb.device_busy_time); + data->initial_command_response_time + = time_to_nsec(cmb.initial_command_response_time); return 0; } @@ -803,7 +798,7 @@ cmb_show_attr(struct device *dev, char *buf, enum cmb_index idx) } static ssize_t -cmb_show_avg_sample_interval(struct device *dev, char *buf) +cmb_show_avg_sample_interval(struct device *dev, struct device_attribute *attr, char *buf) { struct ccw_device *cdev; long interval; @@ -820,7 +815,7 @@ cmb_show_avg_sample_interval(struct device *dev, char *buf) } static ssize_t -cmb_show_avg_utilization(struct device *dev, char *buf) +cmb_show_avg_utilization(struct device *dev, struct device_attribute *attr, char *buf) { struct cmbdata data; u64 utilization; @@ -849,12 +844,12 @@ cmb_show_avg_utilization(struct device *dev, char *buf) } #define cmf_attr(name) \ -static ssize_t show_ ## name (struct device * dev, char * buf) \ +static ssize_t show_ ## name (struct device * dev, struct device_attribute *attr, char * buf) \ { return cmb_show_attr((dev), buf, cmb_ ## name); } \ static DEVICE_ATTR(name, 0444, show_ ## name, NULL); #define cmf_attr_avg(name) \ -static ssize_t show_avg_ ## name (struct device * dev, char * buf) \ +static ssize_t show_avg_ ## name (struct device * dev, struct device_attribute *attr, char * buf) \ { return cmb_show_attr((dev), buf, cmb_ ## name); } \ static DEVICE_ATTR(avg_ ## name, 0444, show_avg_ ## name, NULL); @@ -909,12 +904,12 @@ static struct attribute_group cmf_attr_group_ext = { .attrs = cmf_attributes_ext, }; -static ssize_t cmb_enable_show(struct device *dev, char *buf) +static ssize_t cmb_enable_show(struct device *dev, struct device_attribute *attr, char *buf) { return sprintf(buf, "%d\n", to_ccwdev(dev)->private->cmb ? 1 : 0); } -static ssize_t cmb_enable_store(struct device *dev, const char *buf, size_t c) +static ssize_t cmb_enable_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t c) { struct ccw_device *cdev; int ret;