diff options
author | Tony Jones <tonyj@suse.de> | 2008-02-21 18:13:36 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2008-04-19 22:10:33 -0400 |
commit | ee959b00c335d7780136c5abda37809191fe52c3 (patch) | |
tree | 7775f3b274fd8caf5e7e5154fea89e96f2babd94 /drivers/scsi/scsi_transport_spi.c | |
parent | 56d110e852b0b1c85ad6c9bfe1cb4473ceb16402 (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/scsi_transport_spi.c')
-rw-r--r-- | drivers/scsi/scsi_transport_spi.c | 185 |
1 files changed, 98 insertions, 87 deletions
diff --git a/drivers/scsi/scsi_transport_spi.c b/drivers/scsi/scsi_transport_spi.c index 1fb60313a516..bc12b5d5d676 100644 --- a/drivers/scsi/scsi_transport_spi.c +++ b/drivers/scsi/scsi_transport_spi.c | |||
@@ -158,7 +158,7 @@ static inline enum spi_signal_type spi_signal_to_value(const char *name) | |||
158 | } | 158 | } |
159 | 159 | ||
160 | static int spi_host_setup(struct transport_container *tc, struct device *dev, | 160 | static int spi_host_setup(struct transport_container *tc, struct device *dev, |
161 | struct class_device *cdev) | 161 | struct device *cdev) |
162 | { | 162 | { |
163 | struct Scsi_Host *shost = dev_to_shost(dev); | 163 | struct Scsi_Host *shost = dev_to_shost(dev); |
164 | 164 | ||
@@ -169,7 +169,7 @@ static int spi_host_setup(struct transport_container *tc, struct device *dev, | |||
169 | 169 | ||
170 | static int spi_host_configure(struct transport_container *tc, | 170 | static int spi_host_configure(struct transport_container *tc, |
171 | struct device *dev, | 171 | struct device *dev, |
172 | struct class_device *cdev); | 172 | struct device *cdev); |
173 | 173 | ||
174 | static DECLARE_TRANSPORT_CLASS(spi_host_class, | 174 | static DECLARE_TRANSPORT_CLASS(spi_host_class, |
175 | "spi_host", | 175 | "spi_host", |
@@ -195,11 +195,11 @@ static int spi_host_match(struct attribute_container *cont, | |||
195 | 195 | ||
196 | static int spi_target_configure(struct transport_container *tc, | 196 | static int spi_target_configure(struct transport_container *tc, |
197 | struct device *dev, | 197 | struct device *dev, |
198 | struct class_device *cdev); | 198 | struct device *cdev); |
199 | 199 | ||
200 | static int spi_device_configure(struct transport_container *tc, | 200 | static int spi_device_configure(struct transport_container *tc, |
201 | struct device *dev, | 201 | struct device *dev, |
202 | struct class_device *cdev) | 202 | struct device *cdev) |
203 | { | 203 | { |
204 | struct scsi_device *sdev = to_scsi_device(dev); | 204 | struct scsi_device *sdev = to_scsi_device(dev); |
205 | struct scsi_target *starget = sdev->sdev_target; | 205 | struct scsi_target *starget = sdev->sdev_target; |
@@ -219,7 +219,7 @@ static int spi_device_configure(struct transport_container *tc, | |||
219 | 219 | ||
220 | static int spi_setup_transport_attrs(struct transport_container *tc, | 220 | static int spi_setup_transport_attrs(struct transport_container *tc, |
221 | struct device *dev, | 221 | struct device *dev, |
222 | struct class_device *cdev) | 222 | struct device *cdev) |
223 | { | 223 | { |
224 | struct scsi_target *starget = to_scsi_target(dev); | 224 | struct scsi_target *starget = to_scsi_target(dev); |
225 | 225 | ||
@@ -248,9 +248,10 @@ static int spi_setup_transport_attrs(struct transport_container *tc, | |||
248 | #define spi_transport_show_simple(field, format_string) \ | 248 | #define spi_transport_show_simple(field, format_string) \ |
249 | \ | 249 | \ |
250 | static ssize_t \ | 250 | static ssize_t \ |
251 | show_spi_transport_##field(struct class_device *cdev, char *buf) \ | 251 | show_spi_transport_##field(struct device *dev, \ |
252 | struct device_attribute *attr, char *buf) \ | ||
252 | { \ | 253 | { \ |
253 | struct scsi_target *starget = transport_class_to_starget(cdev); \ | 254 | struct scsi_target *starget = transport_class_to_starget(dev); \ |
254 | struct spi_transport_attrs *tp; \ | 255 | struct spi_transport_attrs *tp; \ |
255 | \ | 256 | \ |
256 | tp = (struct spi_transport_attrs *)&starget->starget_data; \ | 257 | tp = (struct spi_transport_attrs *)&starget->starget_data; \ |
@@ -260,11 +261,12 @@ show_spi_transport_##field(struct class_device *cdev, char *buf) \ | |||
260 | #define spi_transport_store_simple(field, format_string) \ | 261 | #define spi_transport_store_simple(field, format_string) \ |
261 | \ | 262 | \ |
262 | static ssize_t \ | 263 | static ssize_t \ |
263 | store_spi_transport_##field(struct class_device *cdev, const char *buf, \ | 264 | store_spi_transport_##field(struct device *dev, \ |
264 | size_t count) \ | 265 | struct device_attribute *attr, \ |
266 | const char *buf, size_t count) \ | ||
265 | { \ | 267 | { \ |
266 | int val; \ | 268 | int val; \ |
267 | struct scsi_target *starget = transport_class_to_starget(cdev); \ | 269 | struct scsi_target *starget = transport_class_to_starget(dev); \ |
268 | struct spi_transport_attrs *tp; \ | 270 | struct spi_transport_attrs *tp; \ |
269 | \ | 271 | \ |
270 | tp = (struct spi_transport_attrs *)&starget->starget_data; \ | 272 | tp = (struct spi_transport_attrs *)&starget->starget_data; \ |
@@ -276,9 +278,10 @@ store_spi_transport_##field(struct class_device *cdev, const char *buf, \ | |||
276 | #define spi_transport_show_function(field, format_string) \ | 278 | #define spi_transport_show_function(field, format_string) \ |
277 | \ | 279 | \ |
278 | static ssize_t \ | 280 | static ssize_t \ |
279 | show_spi_transport_##field(struct class_device *cdev, char *buf) \ | 281 | show_spi_transport_##field(struct device *dev, \ |
282 | struct device_attribute *attr, char *buf) \ | ||
280 | { \ | 283 | { \ |
281 | struct scsi_target *starget = transport_class_to_starget(cdev); \ | 284 | struct scsi_target *starget = transport_class_to_starget(dev); \ |
282 | struct Scsi_Host *shost = dev_to_shost(starget->dev.parent); \ | 285 | struct Scsi_Host *shost = dev_to_shost(starget->dev.parent); \ |
283 | struct spi_transport_attrs *tp; \ | 286 | struct spi_transport_attrs *tp; \ |
284 | struct spi_internal *i = to_spi_internal(shost->transportt); \ | 287 | struct spi_internal *i = to_spi_internal(shost->transportt); \ |
@@ -290,11 +293,12 @@ show_spi_transport_##field(struct class_device *cdev, char *buf) \ | |||
290 | 293 | ||
291 | #define spi_transport_store_function(field, format_string) \ | 294 | #define spi_transport_store_function(field, format_string) \ |
292 | static ssize_t \ | 295 | static ssize_t \ |
293 | store_spi_transport_##field(struct class_device *cdev, const char *buf, \ | 296 | store_spi_transport_##field(struct device *dev, \ |
294 | size_t count) \ | 297 | struct device_attribute *attr, \ |
298 | const char *buf, size_t count) \ | ||
295 | { \ | 299 | { \ |
296 | int val; \ | 300 | int val; \ |
297 | struct scsi_target *starget = transport_class_to_starget(cdev); \ | 301 | struct scsi_target *starget = transport_class_to_starget(dev); \ |
298 | struct Scsi_Host *shost = dev_to_shost(starget->dev.parent); \ | 302 | struct Scsi_Host *shost = dev_to_shost(starget->dev.parent); \ |
299 | struct spi_internal *i = to_spi_internal(shost->transportt); \ | 303 | struct spi_internal *i = to_spi_internal(shost->transportt); \ |
300 | \ | 304 | \ |
@@ -307,11 +311,12 @@ store_spi_transport_##field(struct class_device *cdev, const char *buf, \ | |||
307 | 311 | ||
308 | #define spi_transport_store_max(field, format_string) \ | 312 | #define spi_transport_store_max(field, format_string) \ |
309 | static ssize_t \ | 313 | static ssize_t \ |
310 | store_spi_transport_##field(struct class_device *cdev, const char *buf, \ | 314 | store_spi_transport_##field(struct device *dev, \ |
311 | size_t count) \ | 315 | struct device_attribute *attr, \ |
316 | const char *buf, size_t count) \ | ||
312 | { \ | 317 | { \ |
313 | int val; \ | 318 | int val; \ |
314 | struct scsi_target *starget = transport_class_to_starget(cdev); \ | 319 | struct scsi_target *starget = transport_class_to_starget(dev); \ |
315 | struct Scsi_Host *shost = dev_to_shost(starget->dev.parent); \ | 320 | struct Scsi_Host *shost = dev_to_shost(starget->dev.parent); \ |
316 | struct spi_internal *i = to_spi_internal(shost->transportt); \ | 321 | struct spi_internal *i = to_spi_internal(shost->transportt); \ |
317 | struct spi_transport_attrs *tp \ | 322 | struct spi_transport_attrs *tp \ |
@@ -329,24 +334,24 @@ store_spi_transport_##field(struct class_device *cdev, const char *buf, \ | |||
329 | #define spi_transport_rd_attr(field, format_string) \ | 334 | #define spi_transport_rd_attr(field, format_string) \ |
330 | spi_transport_show_function(field, format_string) \ | 335 | spi_transport_show_function(field, format_string) \ |
331 | spi_transport_store_function(field, format_string) \ | 336 | spi_transport_store_function(field, format_string) \ |
332 | static CLASS_DEVICE_ATTR(field, S_IRUGO, \ | 337 | static DEVICE_ATTR(field, S_IRUGO, \ |
333 | show_spi_transport_##field, \ | 338 | show_spi_transport_##field, \ |
334 | store_spi_transport_##field); | 339 | store_spi_transport_##field); |
335 | 340 | ||
336 | #define spi_transport_simple_attr(field, format_string) \ | 341 | #define spi_transport_simple_attr(field, format_string) \ |
337 | spi_transport_show_simple(field, format_string) \ | 342 | spi_transport_show_simple(field, format_string) \ |
338 | spi_transport_store_simple(field, format_string) \ | 343 | spi_transport_store_simple(field, format_string) \ |
339 | static CLASS_DEVICE_ATTR(field, S_IRUGO, \ | 344 | static DEVICE_ATTR(field, S_IRUGO, \ |
340 | show_spi_transport_##field, \ | 345 | show_spi_transport_##field, \ |
341 | store_spi_transport_##field); | 346 | store_spi_transport_##field); |
342 | 347 | ||
343 | #define spi_transport_max_attr(field, format_string) \ | 348 | #define spi_transport_max_attr(field, format_string) \ |
344 | spi_transport_show_function(field, format_string) \ | 349 | spi_transport_show_function(field, format_string) \ |
345 | spi_transport_store_max(field, format_string) \ | 350 | spi_transport_store_max(field, format_string) \ |
346 | spi_transport_simple_attr(max_##field, format_string) \ | 351 | spi_transport_simple_attr(max_##field, format_string) \ |
347 | static CLASS_DEVICE_ATTR(field, S_IRUGO, \ | 352 | static DEVICE_ATTR(field, S_IRUGO, \ |
348 | show_spi_transport_##field, \ | 353 | show_spi_transport_##field, \ |
349 | store_spi_transport_##field); | 354 | store_spi_transport_##field); |
350 | 355 | ||
351 | /* The Parallel SCSI Tranport Attributes: */ | 356 | /* The Parallel SCSI Tranport Attributes: */ |
352 | spi_transport_max_attr(offset, "%d\n"); | 357 | spi_transport_max_attr(offset, "%d\n"); |
@@ -370,14 +375,15 @@ static int child_iter(struct device *dev, void *data) | |||
370 | } | 375 | } |
371 | 376 | ||
372 | static ssize_t | 377 | static ssize_t |
373 | store_spi_revalidate(struct class_device *cdev, const char *buf, size_t count) | 378 | store_spi_revalidate(struct device *dev, struct device_attribute *attr, |
379 | const char *buf, size_t count) | ||
374 | { | 380 | { |
375 | struct scsi_target *starget = transport_class_to_starget(cdev); | 381 | struct scsi_target *starget = transport_class_to_starget(dev); |
376 | 382 | ||
377 | device_for_each_child(&starget->dev, NULL, child_iter); | 383 | device_for_each_child(&starget->dev, NULL, child_iter); |
378 | return count; | 384 | return count; |
379 | } | 385 | } |
380 | static CLASS_DEVICE_ATTR(revalidate, S_IWUSR, NULL, store_spi_revalidate); | 386 | static DEVICE_ATTR(revalidate, S_IWUSR, NULL, store_spi_revalidate); |
381 | 387 | ||
382 | /* Translate the period into ns according to the current spec | 388 | /* Translate the period into ns according to the current spec |
383 | * for SDTR/PPR messages */ | 389 | * for SDTR/PPR messages */ |
@@ -412,7 +418,7 @@ show_spi_transport_period_helper(char *buf, int period) | |||
412 | } | 418 | } |
413 | 419 | ||
414 | static ssize_t | 420 | static ssize_t |
415 | store_spi_transport_period_helper(struct class_device *cdev, const char *buf, | 421 | store_spi_transport_period_helper(struct device *dev, const char *buf, |
416 | size_t count, int *periodp) | 422 | size_t count, int *periodp) |
417 | { | 423 | { |
418 | int j, picosec, period = -1; | 424 | int j, picosec, period = -1; |
@@ -449,9 +455,10 @@ store_spi_transport_period_helper(struct class_device *cdev, const char *buf, | |||
449 | } | 455 | } |
450 | 456 | ||
451 | static ssize_t | 457 | static ssize_t |
452 | show_spi_transport_period(struct class_device *cdev, char *buf) | 458 | show_spi_transport_period(struct device *dev, |
459 | struct device_attribute *attr, char *buf) | ||
453 | { | 460 | { |
454 | struct scsi_target *starget = transport_class_to_starget(cdev); | 461 | struct scsi_target *starget = transport_class_to_starget(dev); |
455 | struct Scsi_Host *shost = dev_to_shost(starget->dev.parent); | 462 | struct Scsi_Host *shost = dev_to_shost(starget->dev.parent); |
456 | struct spi_internal *i = to_spi_internal(shost->transportt); | 463 | struct spi_internal *i = to_spi_internal(shost->transportt); |
457 | struct spi_transport_attrs *tp = | 464 | struct spi_transport_attrs *tp = |
@@ -464,8 +471,8 @@ show_spi_transport_period(struct class_device *cdev, char *buf) | |||
464 | } | 471 | } |
465 | 472 | ||
466 | static ssize_t | 473 | static ssize_t |
467 | store_spi_transport_period(struct class_device *cdev, const char *buf, | 474 | store_spi_transport_period(struct device *cdev, struct device_attribute *attr, |
468 | size_t count) | 475 | const char *buf, size_t count) |
469 | { | 476 | { |
470 | struct scsi_target *starget = transport_class_to_starget(cdev); | 477 | struct scsi_target *starget = transport_class_to_starget(cdev); |
471 | struct Scsi_Host *shost = dev_to_shost(starget->dev.parent); | 478 | struct Scsi_Host *shost = dev_to_shost(starget->dev.parent); |
@@ -487,12 +494,13 @@ store_spi_transport_period(struct class_device *cdev, const char *buf, | |||
487 | return retval; | 494 | return retval; |
488 | } | 495 | } |
489 | 496 | ||
490 | static CLASS_DEVICE_ATTR(period, S_IRUGO, | 497 | static DEVICE_ATTR(period, S_IRUGO, |
491 | show_spi_transport_period, | 498 | show_spi_transport_period, |
492 | store_spi_transport_period); | 499 | store_spi_transport_period); |
493 | 500 | ||
494 | static ssize_t | 501 | static ssize_t |
495 | show_spi_transport_min_period(struct class_device *cdev, char *buf) | 502 | show_spi_transport_min_period(struct device *cdev, |
503 | struct device_attribute *attr, char *buf) | ||
496 | { | 504 | { |
497 | struct scsi_target *starget = transport_class_to_starget(cdev); | 505 | struct scsi_target *starget = transport_class_to_starget(cdev); |
498 | struct Scsi_Host *shost = dev_to_shost(starget->dev.parent); | 506 | struct Scsi_Host *shost = dev_to_shost(starget->dev.parent); |
@@ -507,8 +515,9 @@ show_spi_transport_min_period(struct class_device *cdev, char *buf) | |||
507 | } | 515 | } |
508 | 516 | ||
509 | static ssize_t | 517 | static ssize_t |
510 | store_spi_transport_min_period(struct class_device *cdev, const char *buf, | 518 | store_spi_transport_min_period(struct device *cdev, |
511 | size_t count) | 519 | struct device_attribute *attr, |
520 | const char *buf, size_t count) | ||
512 | { | 521 | { |
513 | struct scsi_target *starget = transport_class_to_starget(cdev); | 522 | struct scsi_target *starget = transport_class_to_starget(cdev); |
514 | struct spi_transport_attrs *tp = | 523 | struct spi_transport_attrs *tp = |
@@ -519,12 +528,14 @@ store_spi_transport_min_period(struct class_device *cdev, const char *buf, | |||
519 | } | 528 | } |
520 | 529 | ||
521 | 530 | ||
522 | static CLASS_DEVICE_ATTR(min_period, S_IRUGO, | 531 | static DEVICE_ATTR(min_period, S_IRUGO, |
523 | show_spi_transport_min_period, | 532 | show_spi_transport_min_period, |
524 | store_spi_transport_min_period); | 533 | store_spi_transport_min_period); |
525 | 534 | ||
526 | 535 | ||
527 | static ssize_t show_spi_host_signalling(struct class_device *cdev, char *buf) | 536 | static ssize_t show_spi_host_signalling(struct device *cdev, |
537 | struct device_attribute *attr, | ||
538 | char *buf) | ||
528 | { | 539 | { |
529 | struct Scsi_Host *shost = transport_class_to_shost(cdev); | 540 | struct Scsi_Host *shost = transport_class_to_shost(cdev); |
530 | struct spi_internal *i = to_spi_internal(shost->transportt); | 541 | struct spi_internal *i = to_spi_internal(shost->transportt); |
@@ -534,10 +545,11 @@ static ssize_t show_spi_host_signalling(struct class_device *cdev, char *buf) | |||
534 | 545 | ||
535 | return sprintf(buf, "%s\n", spi_signal_to_string(spi_signalling(shost))); | 546 | return sprintf(buf, "%s\n", spi_signal_to_string(spi_signalling(shost))); |
536 | } | 547 | } |
537 | static ssize_t store_spi_host_signalling(struct class_device *cdev, | 548 | static ssize_t store_spi_host_signalling(struct device *dev, |
549 | struct device_attribute *attr, | ||
538 | const char *buf, size_t count) | 550 | const char *buf, size_t count) |
539 | { | 551 | { |
540 | struct Scsi_Host *shost = transport_class_to_shost(cdev); | 552 | struct Scsi_Host *shost = transport_class_to_shost(dev); |
541 | struct spi_internal *i = to_spi_internal(shost->transportt); | 553 | struct spi_internal *i = to_spi_internal(shost->transportt); |
542 | enum spi_signal_type type = spi_signal_to_value(buf); | 554 | enum spi_signal_type type = spi_signal_to_value(buf); |
543 | 555 | ||
@@ -549,9 +561,9 @@ static ssize_t store_spi_host_signalling(struct class_device *cdev, | |||
549 | 561 | ||
550 | return count; | 562 | return count; |
551 | } | 563 | } |
552 | static CLASS_DEVICE_ATTR(signalling, S_IRUGO, | 564 | static DEVICE_ATTR(signalling, S_IRUGO, |
553 | show_spi_host_signalling, | 565 | show_spi_host_signalling, |
554 | store_spi_host_signalling); | 566 | store_spi_host_signalling); |
555 | 567 | ||
556 | #define DV_SET(x, y) \ | 568 | #define DV_SET(x, y) \ |
557 | if(i->f->set_##x) \ | 569 | if(i->f->set_##x) \ |
@@ -1334,7 +1346,7 @@ static DECLARE_ANON_TRANSPORT_CLASS(spi_device_class, | |||
1334 | spi_device_configure); | 1346 | spi_device_configure); |
1335 | 1347 | ||
1336 | static struct attribute *host_attributes[] = { | 1348 | static struct attribute *host_attributes[] = { |
1337 | &class_device_attr_signalling.attr, | 1349 | &dev_attr_signalling.attr, |
1338 | NULL | 1350 | NULL |
1339 | }; | 1351 | }; |
1340 | 1352 | ||
@@ -1344,12 +1356,12 @@ static struct attribute_group host_attribute_group = { | |||
1344 | 1356 | ||
1345 | static int spi_host_configure(struct transport_container *tc, | 1357 | static int spi_host_configure(struct transport_container *tc, |
1346 | struct device *dev, | 1358 | struct device *dev, |
1347 | struct class_device *cdev) | 1359 | struct device *cdev) |
1348 | { | 1360 | { |
1349 | struct kobject *kobj = &cdev->kobj; | 1361 | struct kobject *kobj = &cdev->kobj; |
1350 | struct Scsi_Host *shost = transport_class_to_shost(cdev); | 1362 | struct Scsi_Host *shost = transport_class_to_shost(cdev); |
1351 | struct spi_internal *si = to_spi_internal(shost->transportt); | 1363 | struct spi_internal *si = to_spi_internal(shost->transportt); |
1352 | struct attribute *attr = &class_device_attr_signalling.attr; | 1364 | struct attribute *attr = &dev_attr_signalling.attr; |
1353 | int rc = 0; | 1365 | int rc = 0; |
1354 | 1366 | ||
1355 | if (si->f->set_signalling) | 1367 | if (si->f->set_signalling) |
@@ -1368,76 +1380,75 @@ static int spi_host_configure(struct transport_container *tc, | |||
1368 | static int target_attribute_is_visible(struct kobject *kobj, | 1380 | static int target_attribute_is_visible(struct kobject *kobj, |
1369 | struct attribute *attr, int i) | 1381 | struct attribute *attr, int i) |
1370 | { | 1382 | { |
1371 | struct class_device *cdev = | 1383 | struct device *cdev = container_of(kobj, struct device, kobj); |
1372 | container_of(kobj, struct class_device, kobj); | ||
1373 | struct scsi_target *starget = transport_class_to_starget(cdev); | 1384 | struct scsi_target *starget = transport_class_to_starget(cdev); |
1374 | struct Scsi_Host *shost = transport_class_to_shost(cdev); | 1385 | struct Scsi_Host *shost = transport_class_to_shost(cdev); |
1375 | struct spi_internal *si = to_spi_internal(shost->transportt); | 1386 | struct spi_internal *si = to_spi_internal(shost->transportt); |
1376 | 1387 | ||
1377 | if (attr == &class_device_attr_period.attr && | 1388 | if (attr == &dev_attr_period.attr && |
1378 | spi_support_sync(starget)) | 1389 | spi_support_sync(starget)) |
1379 | return TARGET_ATTRIBUTE_HELPER(period); | 1390 | return TARGET_ATTRIBUTE_HELPER(period); |
1380 | else if (attr == &class_device_attr_min_period.attr && | 1391 | else if (attr == &dev_attr_min_period.attr && |
1381 | spi_support_sync(starget)) | 1392 | spi_support_sync(starget)) |
1382 | return TARGET_ATTRIBUTE_HELPER(period); | 1393 | return TARGET_ATTRIBUTE_HELPER(period); |
1383 | else if (attr == &class_device_attr_offset.attr && | 1394 | else if (attr == &dev_attr_offset.attr && |
1384 | spi_support_sync(starget)) | 1395 | spi_support_sync(starget)) |
1385 | return TARGET_ATTRIBUTE_HELPER(offset); | 1396 | return TARGET_ATTRIBUTE_HELPER(offset); |
1386 | else if (attr == &class_device_attr_max_offset.attr && | 1397 | else if (attr == &dev_attr_max_offset.attr && |
1387 | spi_support_sync(starget)) | 1398 | spi_support_sync(starget)) |
1388 | return TARGET_ATTRIBUTE_HELPER(offset); | 1399 | return TARGET_ATTRIBUTE_HELPER(offset); |
1389 | else if (attr == &class_device_attr_width.attr && | 1400 | else if (attr == &dev_attr_width.attr && |
1390 | spi_support_wide(starget)) | 1401 | spi_support_wide(starget)) |
1391 | return TARGET_ATTRIBUTE_HELPER(width); | 1402 | return TARGET_ATTRIBUTE_HELPER(width); |
1392 | else if (attr == &class_device_attr_max_width.attr && | 1403 | else if (attr == &dev_attr_max_width.attr && |
1393 | spi_support_wide(starget)) | 1404 | spi_support_wide(starget)) |
1394 | return TARGET_ATTRIBUTE_HELPER(width); | 1405 | return TARGET_ATTRIBUTE_HELPER(width); |
1395 | else if (attr == &class_device_attr_iu.attr && | 1406 | else if (attr == &dev_attr_iu.attr && |
1396 | spi_support_ius(starget)) | 1407 | spi_support_ius(starget)) |
1397 | return TARGET_ATTRIBUTE_HELPER(iu); | 1408 | return TARGET_ATTRIBUTE_HELPER(iu); |
1398 | else if (attr == &class_device_attr_dt.attr && | 1409 | else if (attr == &dev_attr_dt.attr && |
1399 | spi_support_dt(starget)) | 1410 | spi_support_dt(starget)) |
1400 | return TARGET_ATTRIBUTE_HELPER(dt); | 1411 | return TARGET_ATTRIBUTE_HELPER(dt); |
1401 | else if (attr == &class_device_attr_qas.attr && | 1412 | else if (attr == &dev_attr_qas.attr && |
1402 | spi_support_qas(starget)) | 1413 | spi_support_qas(starget)) |
1403 | return TARGET_ATTRIBUTE_HELPER(qas); | 1414 | return TARGET_ATTRIBUTE_HELPER(qas); |
1404 | else if (attr == &class_device_attr_wr_flow.attr && | 1415 | else if (attr == &dev_attr_wr_flow.attr && |
1405 | spi_support_ius(starget)) | 1416 | spi_support_ius(starget)) |
1406 | return TARGET_ATTRIBUTE_HELPER(wr_flow); | 1417 | return TARGET_ATTRIBUTE_HELPER(wr_flow); |
1407 | else if (attr == &class_device_attr_rd_strm.attr && | 1418 | else if (attr == &dev_attr_rd_strm.attr && |
1408 | spi_support_ius(starget)) | 1419 | spi_support_ius(starget)) |
1409 | return TARGET_ATTRIBUTE_HELPER(rd_strm); | 1420 | return TARGET_ATTRIBUTE_HELPER(rd_strm); |
1410 | else if (attr == &class_device_attr_rti.attr && | 1421 | else if (attr == &dev_attr_rti.attr && |
1411 | spi_support_ius(starget)) | 1422 | spi_support_ius(starget)) |
1412 | return TARGET_ATTRIBUTE_HELPER(rti); | 1423 | return TARGET_ATTRIBUTE_HELPER(rti); |
1413 | else if (attr == &class_device_attr_pcomp_en.attr && | 1424 | else if (attr == &dev_attr_pcomp_en.attr && |
1414 | spi_support_ius(starget)) | 1425 | spi_support_ius(starget)) |
1415 | return TARGET_ATTRIBUTE_HELPER(pcomp_en); | 1426 | return TARGET_ATTRIBUTE_HELPER(pcomp_en); |
1416 | else if (attr == &class_device_attr_hold_mcs.attr && | 1427 | else if (attr == &dev_attr_hold_mcs.attr && |
1417 | spi_support_ius(starget)) | 1428 | spi_support_ius(starget)) |
1418 | return TARGET_ATTRIBUTE_HELPER(hold_mcs); | 1429 | return TARGET_ATTRIBUTE_HELPER(hold_mcs); |
1419 | else if (attr == &class_device_attr_revalidate.attr) | 1430 | else if (attr == &dev_attr_revalidate.attr) |
1420 | return 1; | 1431 | return 1; |
1421 | 1432 | ||
1422 | return 0; | 1433 | return 0; |
1423 | } | 1434 | } |
1424 | 1435 | ||
1425 | static struct attribute *target_attributes[] = { | 1436 | static struct attribute *target_attributes[] = { |
1426 | &class_device_attr_period.attr, | 1437 | &dev_attr_period.attr, |
1427 | &class_device_attr_min_period.attr, | 1438 | &dev_attr_min_period.attr, |
1428 | &class_device_attr_offset.attr, | 1439 | &dev_attr_offset.attr, |
1429 | &class_device_attr_max_offset.attr, | 1440 | &dev_attr_max_offset.attr, |
1430 | &class_device_attr_width.attr, | 1441 | &dev_attr_width.attr, |
1431 | &class_device_attr_max_width.attr, | 1442 | &dev_attr_max_width.attr, |
1432 | &class_device_attr_iu.attr, | 1443 | &dev_attr_iu.attr, |
1433 | &class_device_attr_dt.attr, | 1444 | &dev_attr_dt.attr, |
1434 | &class_device_attr_qas.attr, | 1445 | &dev_attr_qas.attr, |
1435 | &class_device_attr_wr_flow.attr, | 1446 | &dev_attr_wr_flow.attr, |
1436 | &class_device_attr_rd_strm.attr, | 1447 | &dev_attr_rd_strm.attr, |
1437 | &class_device_attr_rti.attr, | 1448 | &dev_attr_rti.attr, |
1438 | &class_device_attr_pcomp_en.attr, | 1449 | &dev_attr_pcomp_en.attr, |
1439 | &class_device_attr_hold_mcs.attr, | 1450 | &dev_attr_hold_mcs.attr, |
1440 | &class_device_attr_revalidate.attr, | 1451 | &dev_attr_revalidate.attr, |
1441 | NULL | 1452 | NULL |
1442 | }; | 1453 | }; |
1443 | 1454 | ||
@@ -1448,7 +1459,7 @@ static struct attribute_group target_attribute_group = { | |||
1448 | 1459 | ||
1449 | static int spi_target_configure(struct transport_container *tc, | 1460 | static int spi_target_configure(struct transport_container *tc, |
1450 | struct device *dev, | 1461 | struct device *dev, |
1451 | struct class_device *cdev) | 1462 | struct device *cdev) |
1452 | { | 1463 | { |
1453 | struct kobject *kobj = &cdev->kobj; | 1464 | struct kobject *kobj = &cdev->kobj; |
1454 | int i; | 1465 | int i; |
@@ -1462,7 +1473,7 @@ static int spi_target_configure(struct transport_container *tc, | |||
1462 | * to ignore, sysfs also does a WARN_ON and dumps a trace, | 1473 | * to ignore, sysfs also does a WARN_ON and dumps a trace, |
1463 | * which is bad, so temporarily, skip attributes that are | 1474 | * which is bad, so temporarily, skip attributes that are |
1464 | * already visible (the revalidate one) */ | 1475 | * already visible (the revalidate one) */ |
1465 | if (j && attr != &class_device_attr_revalidate.attr) | 1476 | if (j && attr != &dev_attr_revalidate.attr) |
1466 | rc = sysfs_add_file_to_group(kobj, attr, | 1477 | rc = sysfs_add_file_to_group(kobj, attr, |
1467 | target_attribute_group.name); | 1478 | target_attribute_group.name); |
1468 | /* and make the attribute writeable if we have a set | 1479 | /* and make the attribute writeable if we have a set |