diff options
Diffstat (limited to 'drivers/scsi/arcmsr/arcmsr_attr.c')
-rw-r--r-- | drivers/scsi/arcmsr/arcmsr_attr.c | 163 |
1 files changed, 96 insertions, 67 deletions
diff --git a/drivers/scsi/arcmsr/arcmsr_attr.c b/drivers/scsi/arcmsr/arcmsr_attr.c index 7d7b0a554276..69f8346aa288 100644 --- a/drivers/scsi/arcmsr/arcmsr_attr.c +++ b/drivers/scsi/arcmsr/arcmsr_attr.c | |||
@@ -57,15 +57,15 @@ | |||
57 | #include <scsi/scsi_transport.h> | 57 | #include <scsi/scsi_transport.h> |
58 | #include "arcmsr.h" | 58 | #include "arcmsr.h" |
59 | 59 | ||
60 | struct class_device_attribute *arcmsr_host_attrs[]; | 60 | struct device_attribute *arcmsr_host_attrs[]; |
61 | 61 | ||
62 | static ssize_t arcmsr_sysfs_iop_message_read(struct kobject *kobj, | 62 | static ssize_t arcmsr_sysfs_iop_message_read(struct kobject *kobj, |
63 | struct bin_attribute *bin, | 63 | struct bin_attribute *bin, |
64 | char *buf, loff_t off, | 64 | char *buf, loff_t off, |
65 | size_t count) | 65 | size_t count) |
66 | { | 66 | { |
67 | struct class_device *cdev = container_of(kobj,struct class_device,kobj); | 67 | struct device *dev = container_of(kobj,struct device,kobj); |
68 | struct Scsi_Host *host = class_to_shost(cdev); | 68 | struct Scsi_Host *host = class_to_shost(dev); |
69 | struct AdapterControlBlock *acb = (struct AdapterControlBlock *) host->hostdata; | 69 | struct AdapterControlBlock *acb = (struct AdapterControlBlock *) host->hostdata; |
70 | uint8_t *pQbuffer,*ptmpQbuffer; | 70 | uint8_t *pQbuffer,*ptmpQbuffer; |
71 | int32_t allxfer_len = 0; | 71 | int32_t allxfer_len = 0; |
@@ -110,8 +110,8 @@ static ssize_t arcmsr_sysfs_iop_message_write(struct kobject *kobj, | |||
110 | char *buf, loff_t off, | 110 | char *buf, loff_t off, |
111 | size_t count) | 111 | size_t count) |
112 | { | 112 | { |
113 | struct class_device *cdev = container_of(kobj,struct class_device,kobj); | 113 | struct device *dev = container_of(kobj,struct device,kobj); |
114 | struct Scsi_Host *host = class_to_shost(cdev); | 114 | struct Scsi_Host *host = class_to_shost(dev); |
115 | struct AdapterControlBlock *acb = (struct AdapterControlBlock *) host->hostdata; | 115 | struct AdapterControlBlock *acb = (struct AdapterControlBlock *) host->hostdata; |
116 | int32_t my_empty_len, user_len, wqbuf_firstindex, wqbuf_lastindex; | 116 | int32_t my_empty_len, user_len, wqbuf_firstindex, wqbuf_lastindex; |
117 | uint8_t *pQbuffer, *ptmpuserbuffer; | 117 | uint8_t *pQbuffer, *ptmpuserbuffer; |
@@ -158,8 +158,8 @@ static ssize_t arcmsr_sysfs_iop_message_clear(struct kobject *kobj, | |||
158 | char *buf, loff_t off, | 158 | char *buf, loff_t off, |
159 | size_t count) | 159 | size_t count) |
160 | { | 160 | { |
161 | struct class_device *cdev = container_of(kobj,struct class_device,kobj); | 161 | struct device *dev = container_of(kobj,struct device,kobj); |
162 | struct Scsi_Host *host = class_to_shost(cdev); | 162 | struct Scsi_Host *host = class_to_shost(dev); |
163 | struct AdapterControlBlock *acb = (struct AdapterControlBlock *) host->hostdata; | 163 | struct AdapterControlBlock *acb = (struct AdapterControlBlock *) host->hostdata; |
164 | uint8_t *pQbuffer; | 164 | uint8_t *pQbuffer; |
165 | 165 | ||
@@ -220,87 +220,104 @@ int arcmsr_alloc_sysfs_attr(struct AdapterControlBlock *acb) | |||
220 | struct Scsi_Host *host = acb->host; | 220 | struct Scsi_Host *host = acb->host; |
221 | int error; | 221 | int error; |
222 | 222 | ||
223 | error = sysfs_create_bin_file(&host->shost_classdev.kobj, &arcmsr_sysfs_message_read_attr); | 223 | error = sysfs_create_bin_file(&host->shost_dev.kobj, &arcmsr_sysfs_message_read_attr); |
224 | if (error) { | 224 | if (error) { |
225 | printk(KERN_ERR "arcmsr: alloc sysfs mu_read failed\n"); | 225 | printk(KERN_ERR "arcmsr: alloc sysfs mu_read failed\n"); |
226 | goto error_bin_file_message_read; | 226 | goto error_bin_file_message_read; |
227 | } | 227 | } |
228 | error = sysfs_create_bin_file(&host->shost_classdev.kobj, &arcmsr_sysfs_message_write_attr); | 228 | error = sysfs_create_bin_file(&host->shost_dev.kobj, &arcmsr_sysfs_message_write_attr); |
229 | if (error) { | 229 | if (error) { |
230 | printk(KERN_ERR "arcmsr: alloc sysfs mu_write failed\n"); | 230 | printk(KERN_ERR "arcmsr: alloc sysfs mu_write failed\n"); |
231 | goto error_bin_file_message_write; | 231 | goto error_bin_file_message_write; |
232 | } | 232 | } |
233 | error = sysfs_create_bin_file(&host->shost_classdev.kobj, &arcmsr_sysfs_message_clear_attr); | 233 | error = sysfs_create_bin_file(&host->shost_dev.kobj, &arcmsr_sysfs_message_clear_attr); |
234 | if (error) { | 234 | if (error) { |
235 | printk(KERN_ERR "arcmsr: alloc sysfs mu_clear failed\n"); | 235 | printk(KERN_ERR "arcmsr: alloc sysfs mu_clear failed\n"); |
236 | goto error_bin_file_message_clear; | 236 | goto error_bin_file_message_clear; |
237 | } | 237 | } |
238 | return 0; | 238 | return 0; |
239 | error_bin_file_message_clear: | 239 | error_bin_file_message_clear: |
240 | sysfs_remove_bin_file(&host->shost_classdev.kobj, &arcmsr_sysfs_message_write_attr); | 240 | sysfs_remove_bin_file(&host->shost_dev.kobj, &arcmsr_sysfs_message_write_attr); |
241 | error_bin_file_message_write: | 241 | error_bin_file_message_write: |
242 | sysfs_remove_bin_file(&host->shost_classdev.kobj, &arcmsr_sysfs_message_read_attr); | 242 | sysfs_remove_bin_file(&host->shost_dev.kobj, &arcmsr_sysfs_message_read_attr); |
243 | error_bin_file_message_read: | 243 | error_bin_file_message_read: |
244 | return error; | 244 | return error; |
245 | } | 245 | } |
246 | 246 | ||
247 | void | 247 | void arcmsr_free_sysfs_attr(struct AdapterControlBlock *acb) |
248 | arcmsr_free_sysfs_attr(struct AdapterControlBlock *acb) { | 248 | { |
249 | struct Scsi_Host *host = acb->host; | 249 | struct Scsi_Host *host = acb->host; |
250 | 250 | ||
251 | sysfs_remove_bin_file(&host->shost_classdev.kobj, &arcmsr_sysfs_message_clear_attr); | 251 | sysfs_remove_bin_file(&host->shost_dev.kobj, &arcmsr_sysfs_message_clear_attr); |
252 | sysfs_remove_bin_file(&host->shost_classdev.kobj, &arcmsr_sysfs_message_write_attr); | 252 | sysfs_remove_bin_file(&host->shost_dev.kobj, &arcmsr_sysfs_message_write_attr); |
253 | sysfs_remove_bin_file(&host->shost_classdev.kobj, &arcmsr_sysfs_message_read_attr); | 253 | sysfs_remove_bin_file(&host->shost_dev.kobj, &arcmsr_sysfs_message_read_attr); |
254 | } | 254 | } |
255 | 255 | ||
256 | 256 | ||
257 | static ssize_t | 257 | static ssize_t |
258 | arcmsr_attr_host_driver_version(struct class_device *cdev, char *buf) { | 258 | arcmsr_attr_host_driver_version(struct device *dev, |
259 | struct device_attribute *attr, char *buf) | ||
260 | { | ||
259 | return snprintf(buf, PAGE_SIZE, | 261 | return snprintf(buf, PAGE_SIZE, |
260 | "%s\n", | 262 | "%s\n", |
261 | ARCMSR_DRIVER_VERSION); | 263 | ARCMSR_DRIVER_VERSION); |
262 | } | 264 | } |
263 | 265 | ||
264 | static ssize_t | 266 | static ssize_t |
265 | arcmsr_attr_host_driver_posted_cmd(struct class_device *cdev, char *buf) { | 267 | arcmsr_attr_host_driver_posted_cmd(struct device *dev, |
266 | struct Scsi_Host *host = class_to_shost(cdev); | 268 | struct device_attribute *attr, char *buf) |
267 | struct AdapterControlBlock *acb = (struct AdapterControlBlock *) host->hostdata; | 269 | { |
270 | struct Scsi_Host *host = class_to_shost(dev); | ||
271 | struct AdapterControlBlock *acb = | ||
272 | (struct AdapterControlBlock *) host->hostdata; | ||
268 | return snprintf(buf, PAGE_SIZE, | 273 | return snprintf(buf, PAGE_SIZE, |
269 | "%4d\n", | 274 | "%4d\n", |
270 | atomic_read(&acb->ccboutstandingcount)); | 275 | atomic_read(&acb->ccboutstandingcount)); |
271 | } | 276 | } |
272 | 277 | ||
273 | static ssize_t | 278 | static ssize_t |
274 | arcmsr_attr_host_driver_reset(struct class_device *cdev, char *buf) { | 279 | arcmsr_attr_host_driver_reset(struct device *dev, |
275 | struct Scsi_Host *host = class_to_shost(cdev); | 280 | struct device_attribute *attr, char *buf) |
276 | struct AdapterControlBlock *acb = (struct AdapterControlBlock *) host->hostdata; | 281 | { |
282 | struct Scsi_Host *host = class_to_shost(dev); | ||
283 | struct AdapterControlBlock *acb = | ||
284 | (struct AdapterControlBlock *) host->hostdata; | ||
277 | return snprintf(buf, PAGE_SIZE, | 285 | return snprintf(buf, PAGE_SIZE, |
278 | "%4d\n", | 286 | "%4d\n", |
279 | acb->num_resets); | 287 | acb->num_resets); |
280 | } | 288 | } |
281 | 289 | ||
282 | static ssize_t | 290 | static ssize_t |
283 | arcmsr_attr_host_driver_abort(struct class_device *cdev, char *buf) { | 291 | arcmsr_attr_host_driver_abort(struct device *dev, |
284 | struct Scsi_Host *host = class_to_shost(cdev); | 292 | struct device_attribute *attr, char *buf) |
285 | struct AdapterControlBlock *acb = (struct AdapterControlBlock *) host->hostdata; | 293 | { |
294 | struct Scsi_Host *host = class_to_shost(dev); | ||
295 | struct AdapterControlBlock *acb = | ||
296 | (struct AdapterControlBlock *) host->hostdata; | ||
286 | return snprintf(buf, PAGE_SIZE, | 297 | return snprintf(buf, PAGE_SIZE, |
287 | "%4d\n", | 298 | "%4d\n", |
288 | acb->num_aborts); | 299 | acb->num_aborts); |
289 | } | 300 | } |
290 | 301 | ||
291 | static ssize_t | 302 | static ssize_t |
292 | arcmsr_attr_host_fw_model(struct class_device *cdev, char *buf) { | 303 | arcmsr_attr_host_fw_model(struct device *dev, struct device_attribute *attr, |
293 | struct Scsi_Host *host = class_to_shost(cdev); | 304 | char *buf) |
294 | struct AdapterControlBlock *acb = (struct AdapterControlBlock *) host->hostdata; | 305 | { |
306 | struct Scsi_Host *host = class_to_shost(dev); | ||
307 | struct AdapterControlBlock *acb = | ||
308 | (struct AdapterControlBlock *) host->hostdata; | ||
295 | return snprintf(buf, PAGE_SIZE, | 309 | return snprintf(buf, PAGE_SIZE, |
296 | "%s\n", | 310 | "%s\n", |
297 | acb->firm_model); | 311 | acb->firm_model); |
298 | } | 312 | } |
299 | 313 | ||
300 | static ssize_t | 314 | static ssize_t |
301 | arcmsr_attr_host_fw_version(struct class_device *cdev, char *buf) { | 315 | arcmsr_attr_host_fw_version(struct device *dev, |
302 | struct Scsi_Host *host = class_to_shost(cdev); | 316 | struct device_attribute *attr, char *buf) |
303 | struct AdapterControlBlock *acb = (struct AdapterControlBlock *) host->hostdata; | 317 | { |
318 | struct Scsi_Host *host = class_to_shost(dev); | ||
319 | struct AdapterControlBlock *acb = | ||
320 | (struct AdapterControlBlock *) host->hostdata; | ||
304 | 321 | ||
305 | return snprintf(buf, PAGE_SIZE, | 322 | return snprintf(buf, PAGE_SIZE, |
306 | "%s\n", | 323 | "%s\n", |
@@ -308,9 +325,12 @@ arcmsr_attr_host_fw_version(struct class_device *cdev, char *buf) { | |||
308 | } | 325 | } |
309 | 326 | ||
310 | static ssize_t | 327 | static ssize_t |
311 | arcmsr_attr_host_fw_request_len(struct class_device *cdev, char *buf) { | 328 | arcmsr_attr_host_fw_request_len(struct device *dev, |
312 | struct Scsi_Host *host = class_to_shost(cdev); | 329 | struct device_attribute *attr, char *buf) |
313 | struct AdapterControlBlock *acb = (struct AdapterControlBlock *) host->hostdata; | 330 | { |
331 | struct Scsi_Host *host = class_to_shost(dev); | ||
332 | struct AdapterControlBlock *acb = | ||
333 | (struct AdapterControlBlock *) host->hostdata; | ||
314 | 334 | ||
315 | return snprintf(buf, PAGE_SIZE, | 335 | return snprintf(buf, PAGE_SIZE, |
316 | "%4d\n", | 336 | "%4d\n", |
@@ -318,9 +338,12 @@ arcmsr_attr_host_fw_request_len(struct class_device *cdev, char *buf) { | |||
318 | } | 338 | } |
319 | 339 | ||
320 | static ssize_t | 340 | static ssize_t |
321 | arcmsr_attr_host_fw_numbers_queue(struct class_device *cdev, char *buf) { | 341 | arcmsr_attr_host_fw_numbers_queue(struct device *dev, |
322 | struct Scsi_Host *host = class_to_shost(cdev); | 342 | struct device_attribute *attr, char *buf) |
323 | struct AdapterControlBlock *acb = (struct AdapterControlBlock *) host->hostdata; | 343 | { |
344 | struct Scsi_Host *host = class_to_shost(dev); | ||
345 | struct AdapterControlBlock *acb = | ||
346 | (struct AdapterControlBlock *) host->hostdata; | ||
324 | 347 | ||
325 | return snprintf(buf, PAGE_SIZE, | 348 | return snprintf(buf, PAGE_SIZE, |
326 | "%4d\n", | 349 | "%4d\n", |
@@ -328,9 +351,12 @@ arcmsr_attr_host_fw_numbers_queue(struct class_device *cdev, char *buf) { | |||
328 | } | 351 | } |
329 | 352 | ||
330 | static ssize_t | 353 | static ssize_t |
331 | arcmsr_attr_host_fw_sdram_size(struct class_device *cdev, char *buf) { | 354 | arcmsr_attr_host_fw_sdram_size(struct device *dev, |
332 | struct Scsi_Host *host = class_to_shost(cdev); | 355 | struct device_attribute *attr, char *buf) |
333 | struct AdapterControlBlock *acb = (struct AdapterControlBlock *) host->hostdata; | 356 | { |
357 | struct Scsi_Host *host = class_to_shost(dev); | ||
358 | struct AdapterControlBlock *acb = | ||
359 | (struct AdapterControlBlock *) host->hostdata; | ||
334 | 360 | ||
335 | return snprintf(buf, PAGE_SIZE, | 361 | return snprintf(buf, PAGE_SIZE, |
336 | "%4d\n", | 362 | "%4d\n", |
@@ -338,36 +364,39 @@ arcmsr_attr_host_fw_sdram_size(struct class_device *cdev, char *buf) { | |||
338 | } | 364 | } |
339 | 365 | ||
340 | static ssize_t | 366 | static ssize_t |
341 | arcmsr_attr_host_fw_hd_channels(struct class_device *cdev, char *buf) { | 367 | arcmsr_attr_host_fw_hd_channels(struct device *dev, |
342 | struct Scsi_Host *host = class_to_shost(cdev); | 368 | struct device_attribute *attr, char *buf) |
343 | struct AdapterControlBlock *acb = (struct AdapterControlBlock *) host->hostdata; | 369 | { |
370 | struct Scsi_Host *host = class_to_shost(dev); | ||
371 | struct AdapterControlBlock *acb = | ||
372 | (struct AdapterControlBlock *) host->hostdata; | ||
344 | 373 | ||
345 | return snprintf(buf, PAGE_SIZE, | 374 | return snprintf(buf, PAGE_SIZE, |
346 | "%4d\n", | 375 | "%4d\n", |
347 | acb->firm_hd_channels); | 376 | acb->firm_hd_channels); |
348 | } | 377 | } |
349 | 378 | ||
350 | static CLASS_DEVICE_ATTR(host_driver_version, S_IRUGO, arcmsr_attr_host_driver_version, NULL); | 379 | static DEVICE_ATTR(host_driver_version, S_IRUGO, arcmsr_attr_host_driver_version, NULL); |
351 | static CLASS_DEVICE_ATTR(host_driver_posted_cmd, S_IRUGO, arcmsr_attr_host_driver_posted_cmd, NULL); | 380 | static DEVICE_ATTR(host_driver_posted_cmd, S_IRUGO, arcmsr_attr_host_driver_posted_cmd, NULL); |
352 | static CLASS_DEVICE_ATTR(host_driver_reset, S_IRUGO, arcmsr_attr_host_driver_reset, NULL); | 381 | static DEVICE_ATTR(host_driver_reset, S_IRUGO, arcmsr_attr_host_driver_reset, NULL); |
353 | static CLASS_DEVICE_ATTR(host_driver_abort, S_IRUGO, arcmsr_attr_host_driver_abort, NULL); | 382 | static DEVICE_ATTR(host_driver_abort, S_IRUGO, arcmsr_attr_host_driver_abort, NULL); |
354 | static CLASS_DEVICE_ATTR(host_fw_model, S_IRUGO, arcmsr_attr_host_fw_model, NULL); | 383 | static DEVICE_ATTR(host_fw_model, S_IRUGO, arcmsr_attr_host_fw_model, NULL); |
355 | static CLASS_DEVICE_ATTR(host_fw_version, S_IRUGO, arcmsr_attr_host_fw_version, NULL); | 384 | static DEVICE_ATTR(host_fw_version, S_IRUGO, arcmsr_attr_host_fw_version, NULL); |
356 | static CLASS_DEVICE_ATTR(host_fw_request_len, S_IRUGO, arcmsr_attr_host_fw_request_len, NULL); | 385 | static DEVICE_ATTR(host_fw_request_len, S_IRUGO, arcmsr_attr_host_fw_request_len, NULL); |
357 | static CLASS_DEVICE_ATTR(host_fw_numbers_queue, S_IRUGO, arcmsr_attr_host_fw_numbers_queue, NULL); | 386 | static DEVICE_ATTR(host_fw_numbers_queue, S_IRUGO, arcmsr_attr_host_fw_numbers_queue, NULL); |
358 | static CLASS_DEVICE_ATTR(host_fw_sdram_size, S_IRUGO, arcmsr_attr_host_fw_sdram_size, NULL); | 387 | static DEVICE_ATTR(host_fw_sdram_size, S_IRUGO, arcmsr_attr_host_fw_sdram_size, NULL); |
359 | static CLASS_DEVICE_ATTR(host_fw_hd_channels, S_IRUGO, arcmsr_attr_host_fw_hd_channels, NULL); | 388 | static DEVICE_ATTR(host_fw_hd_channels, S_IRUGO, arcmsr_attr_host_fw_hd_channels, NULL); |
360 | 389 | ||
361 | struct class_device_attribute *arcmsr_host_attrs[] = { | 390 | struct device_attribute *arcmsr_host_attrs[] = { |
362 | &class_device_attr_host_driver_version, | 391 | &dev_attr_host_driver_version, |
363 | &class_device_attr_host_driver_posted_cmd, | 392 | &dev_attr_host_driver_posted_cmd, |
364 | &class_device_attr_host_driver_reset, | 393 | &dev_attr_host_driver_reset, |
365 | &class_device_attr_host_driver_abort, | 394 | &dev_attr_host_driver_abort, |
366 | &class_device_attr_host_fw_model, | 395 | &dev_attr_host_fw_model, |
367 | &class_device_attr_host_fw_version, | 396 | &dev_attr_host_fw_version, |
368 | &class_device_attr_host_fw_request_len, | 397 | &dev_attr_host_fw_request_len, |
369 | &class_device_attr_host_fw_numbers_queue, | 398 | &dev_attr_host_fw_numbers_queue, |
370 | &class_device_attr_host_fw_sdram_size, | 399 | &dev_attr_host_fw_sdram_size, |
371 | &class_device_attr_host_fw_hd_channels, | 400 | &dev_attr_host_fw_hd_channels, |
372 | NULL, | 401 | NULL, |
373 | }; | 402 | }; |