aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/arcmsr
diff options
context:
space:
mode:
authorTony Jones <tonyj@suse.de>2008-02-21 18:13:36 -0500
committerGreg Kroah-Hartman <gregkh@suse.de>2008-04-19 22:10:33 -0400
commitee959b00c335d7780136c5abda37809191fe52c3 (patch)
tree7775f3b274fd8caf5e7e5154fea89e96f2babd94 /drivers/scsi/arcmsr
parent56d110e852b0b1c85ad6c9bfe1cb4473ceb16402 (diff)
SCSI: convert struct class_device to struct device
It's big, but there doesn't seem to be a way to split it up smaller... Signed-off-by: Tony Jones <tonyj@suse.de> Signed-off-by: Kay Sievers <kay.sievers@vrfy.org> Cc: Roland Dreier <rolandd@cisco.com> Cc: Sean Hefty <sean.hefty@intel.com> Cc: Hal Rosenstock <hal.rosenstock@gmail.com> Cc: James Bottomley <James.Bottomley@HansenPartnership.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/scsi/arcmsr')
-rw-r--r--drivers/scsi/arcmsr/arcmsr.h4
-rw-r--r--drivers/scsi/arcmsr/arcmsr_attr.c163
2 files changed, 98 insertions, 69 deletions
diff --git a/drivers/scsi/arcmsr/arcmsr.h b/drivers/scsi/arcmsr/arcmsr.h
index 3288be2e49f8..ab646e580d64 100644
--- a/drivers/scsi/arcmsr/arcmsr.h
+++ b/drivers/scsi/arcmsr/arcmsr.h
@@ -44,7 +44,7 @@
44*/ 44*/
45#include <linux/interrupt.h> 45#include <linux/interrupt.h>
46 46
47struct class_device_attribute; 47struct device_attribute;
48/*The limit of outstanding scsi command that firmware can handle*/ 48/*The limit of outstanding scsi command that firmware can handle*/
49#define ARCMSR_MAX_OUTSTANDING_CMD 256 49#define ARCMSR_MAX_OUTSTANDING_CMD 256
50#define ARCMSR_MAX_FREECCB_NUM 320 50#define ARCMSR_MAX_FREECCB_NUM 320
@@ -556,6 +556,6 @@ struct SENSE_DATA
556extern void arcmsr_post_ioctldata2iop(struct AdapterControlBlock *); 556extern void arcmsr_post_ioctldata2iop(struct AdapterControlBlock *);
557extern void arcmsr_iop_message_read(struct AdapterControlBlock *); 557extern void arcmsr_iop_message_read(struct AdapterControlBlock *);
558extern struct QBUFFER __iomem *arcmsr_get_iop_rqbuffer(struct AdapterControlBlock *); 558extern struct QBUFFER __iomem *arcmsr_get_iop_rqbuffer(struct AdapterControlBlock *);
559extern struct class_device_attribute *arcmsr_host_attrs[]; 559extern struct device_attribute *arcmsr_host_attrs[];
560extern int arcmsr_alloc_sysfs_attr(struct AdapterControlBlock *); 560extern int arcmsr_alloc_sysfs_attr(struct AdapterControlBlock *);
561void arcmsr_free_sysfs_attr(struct AdapterControlBlock *acb); 561void arcmsr_free_sysfs_attr(struct AdapterControlBlock *acb);
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
60struct class_device_attribute *arcmsr_host_attrs[]; 60struct device_attribute *arcmsr_host_attrs[];
61 61
62static ssize_t arcmsr_sysfs_iop_message_read(struct kobject *kobj, 62static 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;
239error_bin_file_message_clear: 239error_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);
241error_bin_file_message_write: 241error_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);
243error_bin_file_message_read: 243error_bin_file_message_read:
244 return error; 244 return error;
245} 245}
246 246
247void 247void arcmsr_free_sysfs_attr(struct AdapterControlBlock *acb)
248arcmsr_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
257static ssize_t 257static ssize_t
258arcmsr_attr_host_driver_version(struct class_device *cdev, char *buf) { 258arcmsr_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
264static ssize_t 266static ssize_t
265arcmsr_attr_host_driver_posted_cmd(struct class_device *cdev, char *buf) { 267arcmsr_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
273static ssize_t 278static ssize_t
274arcmsr_attr_host_driver_reset(struct class_device *cdev, char *buf) { 279arcmsr_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
282static ssize_t 290static ssize_t
283arcmsr_attr_host_driver_abort(struct class_device *cdev, char *buf) { 291arcmsr_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
291static ssize_t 302static ssize_t
292arcmsr_attr_host_fw_model(struct class_device *cdev, char *buf) { 303arcmsr_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
300static ssize_t 314static ssize_t
301arcmsr_attr_host_fw_version(struct class_device *cdev, char *buf) { 315arcmsr_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
310static ssize_t 327static ssize_t
311arcmsr_attr_host_fw_request_len(struct class_device *cdev, char *buf) { 328arcmsr_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
320static ssize_t 340static ssize_t
321arcmsr_attr_host_fw_numbers_queue(struct class_device *cdev, char *buf) { 341arcmsr_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
330static ssize_t 353static ssize_t
331arcmsr_attr_host_fw_sdram_size(struct class_device *cdev, char *buf) { 354arcmsr_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
340static ssize_t 366static ssize_t
341arcmsr_attr_host_fw_hd_channels(struct class_device *cdev, char *buf) { 367arcmsr_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
350static CLASS_DEVICE_ATTR(host_driver_version, S_IRUGO, arcmsr_attr_host_driver_version, NULL); 379static DEVICE_ATTR(host_driver_version, S_IRUGO, arcmsr_attr_host_driver_version, NULL);
351static CLASS_DEVICE_ATTR(host_driver_posted_cmd, S_IRUGO, arcmsr_attr_host_driver_posted_cmd, NULL); 380static DEVICE_ATTR(host_driver_posted_cmd, S_IRUGO, arcmsr_attr_host_driver_posted_cmd, NULL);
352static CLASS_DEVICE_ATTR(host_driver_reset, S_IRUGO, arcmsr_attr_host_driver_reset, NULL); 381static DEVICE_ATTR(host_driver_reset, S_IRUGO, arcmsr_attr_host_driver_reset, NULL);
353static CLASS_DEVICE_ATTR(host_driver_abort, S_IRUGO, arcmsr_attr_host_driver_abort, NULL); 382static DEVICE_ATTR(host_driver_abort, S_IRUGO, arcmsr_attr_host_driver_abort, NULL);
354static CLASS_DEVICE_ATTR(host_fw_model, S_IRUGO, arcmsr_attr_host_fw_model, NULL); 383static DEVICE_ATTR(host_fw_model, S_IRUGO, arcmsr_attr_host_fw_model, NULL);
355static CLASS_DEVICE_ATTR(host_fw_version, S_IRUGO, arcmsr_attr_host_fw_version, NULL); 384static DEVICE_ATTR(host_fw_version, S_IRUGO, arcmsr_attr_host_fw_version, NULL);
356static CLASS_DEVICE_ATTR(host_fw_request_len, S_IRUGO, arcmsr_attr_host_fw_request_len, NULL); 385static DEVICE_ATTR(host_fw_request_len, S_IRUGO, arcmsr_attr_host_fw_request_len, NULL);
357static CLASS_DEVICE_ATTR(host_fw_numbers_queue, S_IRUGO, arcmsr_attr_host_fw_numbers_queue, NULL); 386static DEVICE_ATTR(host_fw_numbers_queue, S_IRUGO, arcmsr_attr_host_fw_numbers_queue, NULL);
358static CLASS_DEVICE_ATTR(host_fw_sdram_size, S_IRUGO, arcmsr_attr_host_fw_sdram_size, NULL); 387static DEVICE_ATTR(host_fw_sdram_size, S_IRUGO, arcmsr_attr_host_fw_sdram_size, NULL);
359static CLASS_DEVICE_ATTR(host_fw_hd_channels, S_IRUGO, arcmsr_attr_host_fw_hd_channels, NULL); 388static DEVICE_ATTR(host_fw_hd_channels, S_IRUGO, arcmsr_attr_host_fw_hd_channels, NULL);
360 389
361struct class_device_attribute *arcmsr_host_attrs[] = { 390struct 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};