OMAPDSS: VENC: fix NULL pointer dereference in DSS2 VENC sysfs debug attr on OMAP4
[zen-stable.git] / drivers / s390 / net / qeth_core_sys.c
blob0a8e86c1b0ea4d316f8feca5ea95ff57c56d830f
1 /*
2 * drivers/s390/net/qeth_core_sys.c
4 * Copyright IBM Corp. 2007
5 * Author(s): Utz Bacher <utz.bacher@de.ibm.com>,
6 * Frank Pavlic <fpavlic@de.ibm.com>,
7 * Thomas Spatzier <tspat@de.ibm.com>,
8 * Frank Blaschka <frank.blaschka@de.ibm.com>
9 */
11 #define KMSG_COMPONENT "qeth"
12 #define pr_fmt(fmt) KMSG_COMPONENT ": " fmt
14 #include <linux/list.h>
15 #include <linux/rwsem.h>
16 #include <asm/ebcdic.h>
18 #include "qeth_core.h"
20 static ssize_t qeth_dev_state_show(struct device *dev,
21 struct device_attribute *attr, char *buf)
23 struct qeth_card *card = dev_get_drvdata(dev);
24 if (!card)
25 return -EINVAL;
27 switch (card->state) {
28 case CARD_STATE_DOWN:
29 return sprintf(buf, "DOWN\n");
30 case CARD_STATE_HARDSETUP:
31 return sprintf(buf, "HARDSETUP\n");
32 case CARD_STATE_SOFTSETUP:
33 return sprintf(buf, "SOFTSETUP\n");
34 case CARD_STATE_UP:
35 if (card->lan_online)
36 return sprintf(buf, "UP (LAN ONLINE)\n");
37 else
38 return sprintf(buf, "UP (LAN OFFLINE)\n");
39 case CARD_STATE_RECOVER:
40 return sprintf(buf, "RECOVER\n");
41 default:
42 return sprintf(buf, "UNKNOWN\n");
46 static DEVICE_ATTR(state, 0444, qeth_dev_state_show, NULL);
48 static ssize_t qeth_dev_chpid_show(struct device *dev,
49 struct device_attribute *attr, char *buf)
51 struct qeth_card *card = dev_get_drvdata(dev);
52 if (!card)
53 return -EINVAL;
55 return sprintf(buf, "%02X\n", card->info.chpid);
58 static DEVICE_ATTR(chpid, 0444, qeth_dev_chpid_show, NULL);
60 static ssize_t qeth_dev_if_name_show(struct device *dev,
61 struct device_attribute *attr, char *buf)
63 struct qeth_card *card = dev_get_drvdata(dev);
64 if (!card)
65 return -EINVAL;
66 return sprintf(buf, "%s\n", QETH_CARD_IFNAME(card));
69 static DEVICE_ATTR(if_name, 0444, qeth_dev_if_name_show, NULL);
71 static ssize_t qeth_dev_card_type_show(struct device *dev,
72 struct device_attribute *attr, char *buf)
74 struct qeth_card *card = dev_get_drvdata(dev);
75 if (!card)
76 return -EINVAL;
78 return sprintf(buf, "%s\n", qeth_get_cardname_short(card));
81 static DEVICE_ATTR(card_type, 0444, qeth_dev_card_type_show, NULL);
83 static inline const char *qeth_get_bufsize_str(struct qeth_card *card)
85 if (card->qdio.in_buf_size == 16384)
86 return "16k";
87 else if (card->qdio.in_buf_size == 24576)
88 return "24k";
89 else if (card->qdio.in_buf_size == 32768)
90 return "32k";
91 else if (card->qdio.in_buf_size == 40960)
92 return "40k";
93 else
94 return "64k";
97 static ssize_t qeth_dev_inbuf_size_show(struct device *dev,
98 struct device_attribute *attr, char *buf)
100 struct qeth_card *card = dev_get_drvdata(dev);
101 if (!card)
102 return -EINVAL;
104 return sprintf(buf, "%s\n", qeth_get_bufsize_str(card));
107 static DEVICE_ATTR(inbuf_size, 0444, qeth_dev_inbuf_size_show, NULL);
109 static ssize_t qeth_dev_portno_show(struct device *dev,
110 struct device_attribute *attr, char *buf)
112 struct qeth_card *card = dev_get_drvdata(dev);
113 if (!card)
114 return -EINVAL;
116 return sprintf(buf, "%i\n", card->info.portno);
119 static ssize_t qeth_dev_portno_store(struct device *dev,
120 struct device_attribute *attr, const char *buf, size_t count)
122 struct qeth_card *card = dev_get_drvdata(dev);
123 char *tmp;
124 unsigned int portno, limit;
125 int rc = 0;
127 if (!card)
128 return -EINVAL;
130 mutex_lock(&card->conf_mutex);
131 if ((card->state != CARD_STATE_DOWN) &&
132 (card->state != CARD_STATE_RECOVER)) {
133 rc = -EPERM;
134 goto out;
137 portno = simple_strtoul(buf, &tmp, 16);
138 if (portno > QETH_MAX_PORTNO) {
139 rc = -EINVAL;
140 goto out;
142 limit = (card->ssqd.pcnt ? card->ssqd.pcnt - 1 : card->ssqd.pcnt);
143 if (portno > limit) {
144 rc = -EINVAL;
145 goto out;
147 card->info.portno = portno;
148 out:
149 mutex_unlock(&card->conf_mutex);
150 return rc ? rc : count;
153 static DEVICE_ATTR(portno, 0644, qeth_dev_portno_show, qeth_dev_portno_store);
155 static ssize_t qeth_dev_portname_show(struct device *dev,
156 struct device_attribute *attr, char *buf)
158 struct qeth_card *card = dev_get_drvdata(dev);
159 char portname[9] = {0, };
161 if (!card)
162 return -EINVAL;
164 if (card->info.portname_required) {
165 memcpy(portname, card->info.portname + 1, 8);
166 EBCASC(portname, 8);
167 return sprintf(buf, "%s\n", portname);
168 } else
169 return sprintf(buf, "no portname required\n");
172 static ssize_t qeth_dev_portname_store(struct device *dev,
173 struct device_attribute *attr, const char *buf, size_t count)
175 struct qeth_card *card = dev_get_drvdata(dev);
176 char *tmp;
177 int i, rc = 0;
179 if (!card)
180 return -EINVAL;
182 mutex_lock(&card->conf_mutex);
183 if ((card->state != CARD_STATE_DOWN) &&
184 (card->state != CARD_STATE_RECOVER)) {
185 rc = -EPERM;
186 goto out;
189 tmp = strsep((char **) &buf, "\n");
190 if ((strlen(tmp) > 8) || (strlen(tmp) == 0)) {
191 rc = -EINVAL;
192 goto out;
195 card->info.portname[0] = strlen(tmp);
196 /* for beauty reasons */
197 for (i = 1; i < 9; i++)
198 card->info.portname[i] = ' ';
199 strcpy(card->info.portname + 1, tmp);
200 ASCEBC(card->info.portname + 1, 8);
201 out:
202 mutex_unlock(&card->conf_mutex);
203 return rc ? rc : count;
206 static DEVICE_ATTR(portname, 0644, qeth_dev_portname_show,
207 qeth_dev_portname_store);
209 static ssize_t qeth_dev_prioqing_show(struct device *dev,
210 struct device_attribute *attr, char *buf)
212 struct qeth_card *card = dev_get_drvdata(dev);
214 if (!card)
215 return -EINVAL;
217 switch (card->qdio.do_prio_queueing) {
218 case QETH_PRIO_Q_ING_PREC:
219 return sprintf(buf, "%s\n", "by precedence");
220 case QETH_PRIO_Q_ING_TOS:
221 return sprintf(buf, "%s\n", "by type of service");
222 default:
223 return sprintf(buf, "always queue %i\n",
224 card->qdio.default_out_queue);
228 static ssize_t qeth_dev_prioqing_store(struct device *dev,
229 struct device_attribute *attr, const char *buf, size_t count)
231 struct qeth_card *card = dev_get_drvdata(dev);
232 char *tmp;
233 int rc = 0;
235 if (!card)
236 return -EINVAL;
238 mutex_lock(&card->conf_mutex);
239 if ((card->state != CARD_STATE_DOWN) &&
240 (card->state != CARD_STATE_RECOVER)) {
241 rc = -EPERM;
242 goto out;
245 /* check if 1920 devices are supported ,
246 * if though we have to permit priority queueing
248 if (card->qdio.no_out_queues == 1) {
249 card->qdio.do_prio_queueing = QETH_PRIOQ_DEFAULT;
250 rc = -EPERM;
251 goto out;
254 tmp = strsep((char **) &buf, "\n");
255 if (!strcmp(tmp, "prio_queueing_prec"))
256 card->qdio.do_prio_queueing = QETH_PRIO_Q_ING_PREC;
257 else if (!strcmp(tmp, "prio_queueing_tos"))
258 card->qdio.do_prio_queueing = QETH_PRIO_Q_ING_TOS;
259 else if (!strcmp(tmp, "no_prio_queueing:0")) {
260 card->qdio.do_prio_queueing = QETH_NO_PRIO_QUEUEING;
261 card->qdio.default_out_queue = 0;
262 } else if (!strcmp(tmp, "no_prio_queueing:1")) {
263 card->qdio.do_prio_queueing = QETH_NO_PRIO_QUEUEING;
264 card->qdio.default_out_queue = 1;
265 } else if (!strcmp(tmp, "no_prio_queueing:2")) {
266 card->qdio.do_prio_queueing = QETH_NO_PRIO_QUEUEING;
267 card->qdio.default_out_queue = 2;
268 } else if (!strcmp(tmp, "no_prio_queueing:3")) {
269 card->qdio.do_prio_queueing = QETH_NO_PRIO_QUEUEING;
270 card->qdio.default_out_queue = 3;
271 } else if (!strcmp(tmp, "no_prio_queueing")) {
272 card->qdio.do_prio_queueing = QETH_NO_PRIO_QUEUEING;
273 card->qdio.default_out_queue = QETH_DEFAULT_QUEUE;
274 } else
275 rc = -EINVAL;
276 out:
277 mutex_unlock(&card->conf_mutex);
278 return rc ? rc : count;
281 static DEVICE_ATTR(priority_queueing, 0644, qeth_dev_prioqing_show,
282 qeth_dev_prioqing_store);
284 static ssize_t qeth_dev_bufcnt_show(struct device *dev,
285 struct device_attribute *attr, char *buf)
287 struct qeth_card *card = dev_get_drvdata(dev);
289 if (!card)
290 return -EINVAL;
292 return sprintf(buf, "%i\n", card->qdio.in_buf_pool.buf_count);
295 static ssize_t qeth_dev_bufcnt_store(struct device *dev,
296 struct device_attribute *attr, const char *buf, size_t count)
298 struct qeth_card *card = dev_get_drvdata(dev);
299 char *tmp;
300 int cnt, old_cnt;
301 int rc = 0;
303 if (!card)
304 return -EINVAL;
306 mutex_lock(&card->conf_mutex);
307 if ((card->state != CARD_STATE_DOWN) &&
308 (card->state != CARD_STATE_RECOVER)) {
309 rc = -EPERM;
310 goto out;
313 old_cnt = card->qdio.in_buf_pool.buf_count;
314 cnt = simple_strtoul(buf, &tmp, 10);
315 cnt = (cnt < QETH_IN_BUF_COUNT_MIN) ? QETH_IN_BUF_COUNT_MIN :
316 ((cnt > QETH_IN_BUF_COUNT_MAX) ? QETH_IN_BUF_COUNT_MAX : cnt);
317 if (old_cnt != cnt) {
318 rc = qeth_realloc_buffer_pool(card, cnt);
320 out:
321 mutex_unlock(&card->conf_mutex);
322 return rc ? rc : count;
325 static DEVICE_ATTR(buffer_count, 0644, qeth_dev_bufcnt_show,
326 qeth_dev_bufcnt_store);
328 static ssize_t qeth_dev_recover_store(struct device *dev,
329 struct device_attribute *attr, const char *buf, size_t count)
331 struct qeth_card *card = dev_get_drvdata(dev);
332 char *tmp;
333 int i;
335 if (!card)
336 return -EINVAL;
338 if (card->state != CARD_STATE_UP)
339 return -EPERM;
341 i = simple_strtoul(buf, &tmp, 16);
342 if (i == 1)
343 qeth_schedule_recovery(card);
345 return count;
348 static DEVICE_ATTR(recover, 0200, NULL, qeth_dev_recover_store);
350 static ssize_t qeth_dev_performance_stats_show(struct device *dev,
351 struct device_attribute *attr, char *buf)
353 struct qeth_card *card = dev_get_drvdata(dev);
355 if (!card)
356 return -EINVAL;
358 return sprintf(buf, "%i\n", card->options.performance_stats ? 1:0);
361 static ssize_t qeth_dev_performance_stats_store(struct device *dev,
362 struct device_attribute *attr, const char *buf, size_t count)
364 struct qeth_card *card = dev_get_drvdata(dev);
365 char *tmp;
366 int i, rc = 0;
368 if (!card)
369 return -EINVAL;
371 mutex_lock(&card->conf_mutex);
372 i = simple_strtoul(buf, &tmp, 16);
373 if ((i == 0) || (i == 1)) {
374 if (i == card->options.performance_stats)
375 goto out;
376 card->options.performance_stats = i;
377 if (i == 0)
378 memset(&card->perf_stats, 0,
379 sizeof(struct qeth_perf_stats));
380 card->perf_stats.initial_rx_packets = card->stats.rx_packets;
381 card->perf_stats.initial_tx_packets = card->stats.tx_packets;
382 } else
383 rc = -EINVAL;
384 out:
385 mutex_unlock(&card->conf_mutex);
386 return rc ? rc : count;
389 static DEVICE_ATTR(performance_stats, 0644, qeth_dev_performance_stats_show,
390 qeth_dev_performance_stats_store);
392 static ssize_t qeth_dev_layer2_show(struct device *dev,
393 struct device_attribute *attr, char *buf)
395 struct qeth_card *card = dev_get_drvdata(dev);
397 if (!card)
398 return -EINVAL;
400 return sprintf(buf, "%i\n", card->options.layer2);
403 static ssize_t qeth_dev_layer2_store(struct device *dev,
404 struct device_attribute *attr, const char *buf, size_t count)
406 struct qeth_card *card = dev_get_drvdata(dev);
407 char *tmp;
408 int i, rc = 0;
409 enum qeth_discipline_id newdis;
411 if (!card)
412 return -EINVAL;
414 mutex_lock(&card->discipline_mutex);
415 if (card->state != CARD_STATE_DOWN) {
416 rc = -EPERM;
417 goto out;
420 i = simple_strtoul(buf, &tmp, 16);
421 switch (i) {
422 case 0:
423 newdis = QETH_DISCIPLINE_LAYER3;
424 break;
425 case 1:
426 newdis = QETH_DISCIPLINE_LAYER2;
427 break;
428 default:
429 rc = -EINVAL;
430 goto out;
433 if (card->options.layer2 == newdis)
434 goto out;
435 else {
436 card->info.mac_bits = 0;
437 if (card->discipline.ccwgdriver) {
438 card->discipline.ccwgdriver->remove(card->gdev);
439 qeth_core_free_discipline(card);
443 rc = qeth_core_load_discipline(card, newdis);
444 if (rc)
445 goto out;
447 rc = card->discipline.ccwgdriver->probe(card->gdev);
448 out:
449 mutex_unlock(&card->discipline_mutex);
450 return rc ? rc : count;
453 static DEVICE_ATTR(layer2, 0644, qeth_dev_layer2_show,
454 qeth_dev_layer2_store);
456 #define ATTR_QETH_ISOLATION_NONE ("none")
457 #define ATTR_QETH_ISOLATION_FWD ("forward")
458 #define ATTR_QETH_ISOLATION_DROP ("drop")
460 static ssize_t qeth_dev_isolation_show(struct device *dev,
461 struct device_attribute *attr, char *buf)
463 struct qeth_card *card = dev_get_drvdata(dev);
465 if (!card)
466 return -EINVAL;
468 switch (card->options.isolation) {
469 case ISOLATION_MODE_NONE:
470 return snprintf(buf, 6, "%s\n", ATTR_QETH_ISOLATION_NONE);
471 case ISOLATION_MODE_FWD:
472 return snprintf(buf, 9, "%s\n", ATTR_QETH_ISOLATION_FWD);
473 case ISOLATION_MODE_DROP:
474 return snprintf(buf, 6, "%s\n", ATTR_QETH_ISOLATION_DROP);
475 default:
476 return snprintf(buf, 5, "%s\n", "N/A");
480 static ssize_t qeth_dev_isolation_store(struct device *dev,
481 struct device_attribute *attr, const char *buf, size_t count)
483 struct qeth_card *card = dev_get_drvdata(dev);
484 enum qeth_ipa_isolation_modes isolation;
485 int rc = 0;
486 char *tmp, *curtoken;
487 curtoken = (char *) buf;
489 if (!card)
490 return -EINVAL;
492 mutex_lock(&card->conf_mutex);
493 /* check for unknown, too, in case we do not yet know who we are */
494 if (card->info.type != QETH_CARD_TYPE_OSD &&
495 card->info.type != QETH_CARD_TYPE_OSX &&
496 card->info.type != QETH_CARD_TYPE_UNKNOWN) {
497 rc = -EOPNOTSUPP;
498 dev_err(&card->gdev->dev, "Adapter does not "
499 "support QDIO data connection isolation\n");
500 goto out;
503 /* parse input into isolation mode */
504 tmp = strsep(&curtoken, "\n");
505 if (!strcmp(tmp, ATTR_QETH_ISOLATION_NONE)) {
506 isolation = ISOLATION_MODE_NONE;
507 } else if (!strcmp(tmp, ATTR_QETH_ISOLATION_FWD)) {
508 isolation = ISOLATION_MODE_FWD;
509 } else if (!strcmp(tmp, ATTR_QETH_ISOLATION_DROP)) {
510 isolation = ISOLATION_MODE_DROP;
511 } else {
512 rc = -EINVAL;
513 goto out;
515 rc = count;
517 /* defer IP assist if device is offline (until discipline->set_online)*/
518 card->options.isolation = isolation;
519 if (card->state == CARD_STATE_SOFTSETUP ||
520 card->state == CARD_STATE_UP) {
521 int ipa_rc = qeth_set_access_ctrl_online(card);
522 if (ipa_rc != 0)
523 rc = ipa_rc;
525 out:
526 mutex_unlock(&card->conf_mutex);
527 return rc;
530 static DEVICE_ATTR(isolation, 0644, qeth_dev_isolation_show,
531 qeth_dev_isolation_store);
533 static ssize_t qeth_hw_trap_show(struct device *dev,
534 struct device_attribute *attr, char *buf)
536 struct qeth_card *card = dev_get_drvdata(dev);
538 if (!card)
539 return -EINVAL;
540 if (card->info.hwtrap)
541 return snprintf(buf, 5, "arm\n");
542 else
543 return snprintf(buf, 8, "disarm\n");
546 static ssize_t qeth_hw_trap_store(struct device *dev,
547 struct device_attribute *attr, const char *buf, size_t count)
549 struct qeth_card *card = dev_get_drvdata(dev);
550 int rc = 0;
551 char *tmp, *curtoken;
552 int state = 0;
553 curtoken = (char *)buf;
555 if (!card)
556 return -EINVAL;
558 mutex_lock(&card->conf_mutex);
559 if (card->state == CARD_STATE_SOFTSETUP || card->state == CARD_STATE_UP)
560 state = 1;
561 tmp = strsep(&curtoken, "\n");
563 if (!strcmp(tmp, "arm") && !card->info.hwtrap) {
564 if (state) {
565 if (qeth_is_diagass_supported(card,
566 QETH_DIAGS_CMD_TRAP)) {
567 rc = qeth_hw_trap(card, QETH_DIAGS_TRAP_ARM);
568 if (!rc)
569 card->info.hwtrap = 1;
570 } else
571 rc = -EINVAL;
572 } else
573 card->info.hwtrap = 1;
574 } else if (!strcmp(tmp, "disarm") && card->info.hwtrap) {
575 if (state) {
576 rc = qeth_hw_trap(card, QETH_DIAGS_TRAP_DISARM);
577 if (!rc)
578 card->info.hwtrap = 0;
579 } else
580 card->info.hwtrap = 0;
581 } else if (!strcmp(tmp, "trap") && state && card->info.hwtrap)
582 rc = qeth_hw_trap(card, QETH_DIAGS_TRAP_CAPTURE);
583 else
584 rc = -EINVAL;
586 mutex_unlock(&card->conf_mutex);
587 return rc ? rc : count;
590 static DEVICE_ATTR(hw_trap, 0644, qeth_hw_trap_show,
591 qeth_hw_trap_store);
593 static ssize_t qeth_dev_blkt_show(char *buf, struct qeth_card *card, int value)
596 if (!card)
597 return -EINVAL;
599 return sprintf(buf, "%i\n", value);
602 static ssize_t qeth_dev_blkt_store(struct qeth_card *card,
603 const char *buf, size_t count, int *value, int max_value)
605 char *tmp;
606 int i, rc = 0;
608 if (!card)
609 return -EINVAL;
611 mutex_lock(&card->conf_mutex);
612 if ((card->state != CARD_STATE_DOWN) &&
613 (card->state != CARD_STATE_RECOVER)) {
614 rc = -EPERM;
615 goto out;
617 i = simple_strtoul(buf, &tmp, 10);
618 if (i <= max_value)
619 *value = i;
620 else
621 rc = -EINVAL;
622 out:
623 mutex_unlock(&card->conf_mutex);
624 return rc ? rc : count;
627 static ssize_t qeth_dev_blkt_total_show(struct device *dev,
628 struct device_attribute *attr, char *buf)
630 struct qeth_card *card = dev_get_drvdata(dev);
632 return qeth_dev_blkt_show(buf, card, card->info.blkt.time_total);
635 static ssize_t qeth_dev_blkt_total_store(struct device *dev,
636 struct device_attribute *attr, const char *buf, size_t count)
638 struct qeth_card *card = dev_get_drvdata(dev);
640 return qeth_dev_blkt_store(card, buf, count,
641 &card->info.blkt.time_total, 5000);
646 static DEVICE_ATTR(total, 0644, qeth_dev_blkt_total_show,
647 qeth_dev_blkt_total_store);
649 static ssize_t qeth_dev_blkt_inter_show(struct device *dev,
650 struct device_attribute *attr, char *buf)
652 struct qeth_card *card = dev_get_drvdata(dev);
654 return qeth_dev_blkt_show(buf, card, card->info.blkt.inter_packet);
657 static ssize_t qeth_dev_blkt_inter_store(struct device *dev,
658 struct device_attribute *attr, const char *buf, size_t count)
660 struct qeth_card *card = dev_get_drvdata(dev);
662 return qeth_dev_blkt_store(card, buf, count,
663 &card->info.blkt.inter_packet, 1000);
666 static DEVICE_ATTR(inter, 0644, qeth_dev_blkt_inter_show,
667 qeth_dev_blkt_inter_store);
669 static ssize_t qeth_dev_blkt_inter_jumbo_show(struct device *dev,
670 struct device_attribute *attr, char *buf)
672 struct qeth_card *card = dev_get_drvdata(dev);
674 return qeth_dev_blkt_show(buf, card,
675 card->info.blkt.inter_packet_jumbo);
678 static ssize_t qeth_dev_blkt_inter_jumbo_store(struct device *dev,
679 struct device_attribute *attr, const char *buf, size_t count)
681 struct qeth_card *card = dev_get_drvdata(dev);
683 return qeth_dev_blkt_store(card, buf, count,
684 &card->info.blkt.inter_packet_jumbo, 1000);
687 static DEVICE_ATTR(inter_jumbo, 0644, qeth_dev_blkt_inter_jumbo_show,
688 qeth_dev_blkt_inter_jumbo_store);
690 static struct attribute *qeth_blkt_device_attrs[] = {
691 &dev_attr_total.attr,
692 &dev_attr_inter.attr,
693 &dev_attr_inter_jumbo.attr,
694 NULL,
697 static struct attribute_group qeth_device_blkt_group = {
698 .name = "blkt",
699 .attrs = qeth_blkt_device_attrs,
702 static struct attribute *qeth_device_attrs[] = {
703 &dev_attr_state.attr,
704 &dev_attr_chpid.attr,
705 &dev_attr_if_name.attr,
706 &dev_attr_card_type.attr,
707 &dev_attr_inbuf_size.attr,
708 &dev_attr_portno.attr,
709 &dev_attr_portname.attr,
710 &dev_attr_priority_queueing.attr,
711 &dev_attr_buffer_count.attr,
712 &dev_attr_recover.attr,
713 &dev_attr_performance_stats.attr,
714 &dev_attr_layer2.attr,
715 &dev_attr_isolation.attr,
716 &dev_attr_hw_trap.attr,
717 NULL,
720 static struct attribute_group qeth_device_attr_group = {
721 .attrs = qeth_device_attrs,
724 static struct attribute *qeth_osn_device_attrs[] = {
725 &dev_attr_state.attr,
726 &dev_attr_chpid.attr,
727 &dev_attr_if_name.attr,
728 &dev_attr_card_type.attr,
729 &dev_attr_buffer_count.attr,
730 &dev_attr_recover.attr,
731 NULL,
734 static struct attribute_group qeth_osn_device_attr_group = {
735 .attrs = qeth_osn_device_attrs,
738 int qeth_core_create_device_attributes(struct device *dev)
740 int ret;
741 ret = sysfs_create_group(&dev->kobj, &qeth_device_attr_group);
742 if (ret)
743 return ret;
744 ret = sysfs_create_group(&dev->kobj, &qeth_device_blkt_group);
745 if (ret)
746 sysfs_remove_group(&dev->kobj, &qeth_device_attr_group);
748 return 0;
751 void qeth_core_remove_device_attributes(struct device *dev)
753 sysfs_remove_group(&dev->kobj, &qeth_device_attr_group);
754 sysfs_remove_group(&dev->kobj, &qeth_device_blkt_group);
757 int qeth_core_create_osn_attributes(struct device *dev)
759 return sysfs_create_group(&dev->kobj, &qeth_osn_device_attr_group);
762 void qeth_core_remove_osn_attributes(struct device *dev)
764 sysfs_remove_group(&dev->kobj, &qeth_osn_device_attr_group);
765 return;