| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * Intel Wireless WiMAX Connection 2400m |
|---|
| 3 | 4 | * Linux driver model glue for USB device, reset & fw upload |
|---|
| 4 | 5 | * |
|---|
| 5 | | - * |
|---|
| 6 | 6 | * Copyright (C) 2007-2008 Intel Corporation <linux-wimax@intel.com> |
|---|
| 7 | 7 | * Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com> |
|---|
| 8 | 8 | * Yanir Lubetkin <yanirx.lubetkin@intel.com> |
|---|
| 9 | | - * |
|---|
| 10 | | - * This program is free software; you can redistribute it and/or |
|---|
| 11 | | - * modify it under the terms of the GNU General Public License version |
|---|
| 12 | | - * 2 as published by the Free Software Foundation. |
|---|
| 13 | | - * |
|---|
| 14 | | - * This program is distributed in the hope that it will be useful, |
|---|
| 15 | | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 16 | | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|---|
| 17 | | - * GNU General Public License for more details. |
|---|
| 18 | | - * |
|---|
| 19 | | - * You should have received a copy of the GNU General Public License |
|---|
| 20 | | - * along with this program; if not, write to the Free Software |
|---|
| 21 | | - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA |
|---|
| 22 | | - * 02110-1301, USA. |
|---|
| 23 | | - * |
|---|
| 24 | 9 | * |
|---|
| 25 | 10 | * See i2400m-usb.h for a general description of this driver. |
|---|
| 26 | 11 | * |
|---|
| .. | .. |
|---|
| 210 | 195 | msleep(10); /* give the device some time */ |
|---|
| 211 | 196 | goto retry; |
|---|
| 212 | 197 | } |
|---|
| 198 | + fallthrough; |
|---|
| 213 | 199 | case -EINVAL: /* while removing driver */ |
|---|
| 214 | 200 | case -ENODEV: /* dev disconnect ... */ |
|---|
| 215 | 201 | case -ENOENT: /* just ignore it */ |
|---|
| .. | .. |
|---|
| 380 | 366 | }; |
|---|
| 381 | 367 | size_t D_LEVEL_SIZE = ARRAY_SIZE(D_LEVEL); |
|---|
| 382 | 368 | |
|---|
| 383 | | - |
|---|
| 384 | | -#define __debugfs_register(prefix, name, parent) \ |
|---|
| 385 | | -do { \ |
|---|
| 386 | | - result = d_level_register_debugfs(prefix, name, parent); \ |
|---|
| 387 | | - if (result < 0) \ |
|---|
| 388 | | - goto error; \ |
|---|
| 389 | | -} while (0) |
|---|
| 390 | | - |
|---|
| 391 | | - |
|---|
| 392 | 369 | static |
|---|
| 393 | | -int i2400mu_debugfs_add(struct i2400mu *i2400mu) |
|---|
| 370 | +void i2400mu_debugfs_add(struct i2400mu *i2400mu) |
|---|
| 394 | 371 | { |
|---|
| 395 | | - int result; |
|---|
| 396 | | - struct device *dev = &i2400mu->usb_iface->dev; |
|---|
| 397 | 372 | struct dentry *dentry = i2400mu->i2400m.wimax_dev.debugfs_dentry; |
|---|
| 398 | | - struct dentry *fd; |
|---|
| 399 | 373 | |
|---|
| 400 | 374 | dentry = debugfs_create_dir("i2400m-usb", dentry); |
|---|
| 401 | | - result = PTR_ERR(dentry); |
|---|
| 402 | | - if (IS_ERR(dentry)) { |
|---|
| 403 | | - if (result == -ENODEV) |
|---|
| 404 | | - result = 0; /* No debugfs support */ |
|---|
| 405 | | - goto error; |
|---|
| 406 | | - } |
|---|
| 407 | 375 | i2400mu->debugfs_dentry = dentry; |
|---|
| 408 | | - __debugfs_register("dl_", usb, dentry); |
|---|
| 409 | | - __debugfs_register("dl_", fw, dentry); |
|---|
| 410 | | - __debugfs_register("dl_", notif, dentry); |
|---|
| 411 | | - __debugfs_register("dl_", rx, dentry); |
|---|
| 412 | | - __debugfs_register("dl_", tx, dentry); |
|---|
| 376 | + |
|---|
| 377 | + d_level_register_debugfs("dl_", usb, dentry); |
|---|
| 378 | + d_level_register_debugfs("dl_", fw, dentry); |
|---|
| 379 | + d_level_register_debugfs("dl_", notif, dentry); |
|---|
| 380 | + d_level_register_debugfs("dl_", rx, dentry); |
|---|
| 381 | + d_level_register_debugfs("dl_", tx, dentry); |
|---|
| 413 | 382 | |
|---|
| 414 | 383 | /* Don't touch these if you don't know what you are doing */ |
|---|
| 415 | | - fd = debugfs_create_u8("rx_size_auto_shrink", 0600, dentry, |
|---|
| 416 | | - &i2400mu->rx_size_auto_shrink); |
|---|
| 417 | | - result = PTR_ERR(fd); |
|---|
| 418 | | - if (IS_ERR(fd) && result != -ENODEV) { |
|---|
| 419 | | - dev_err(dev, "Can't create debugfs entry " |
|---|
| 420 | | - "rx_size_auto_shrink: %d\n", result); |
|---|
| 421 | | - goto error; |
|---|
| 422 | | - } |
|---|
| 384 | + debugfs_create_u8("rx_size_auto_shrink", 0600, dentry, |
|---|
| 385 | + &i2400mu->rx_size_auto_shrink); |
|---|
| 423 | 386 | |
|---|
| 424 | | - fd = debugfs_create_size_t("rx_size", 0600, dentry, |
|---|
| 425 | | - &i2400mu->rx_size); |
|---|
| 426 | | - result = PTR_ERR(fd); |
|---|
| 427 | | - if (IS_ERR(fd) && result != -ENODEV) { |
|---|
| 428 | | - dev_err(dev, "Can't create debugfs entry " |
|---|
| 429 | | - "rx_size: %d\n", result); |
|---|
| 430 | | - goto error; |
|---|
| 431 | | - } |
|---|
| 432 | | - |
|---|
| 433 | | - return 0; |
|---|
| 434 | | - |
|---|
| 435 | | -error: |
|---|
| 436 | | - debugfs_remove_recursive(i2400mu->debugfs_dentry); |
|---|
| 437 | | - return result; |
|---|
| 387 | + debugfs_create_size_t("rx_size", 0600, dentry, &i2400mu->rx_size); |
|---|
| 438 | 388 | } |
|---|
| 439 | 389 | |
|---|
| 440 | 390 | |
|---|
| .. | .. |
|---|
| 548 | 498 | dev_err(dev, "cannot setup device: %d\n", result); |
|---|
| 549 | 499 | goto error_setup; |
|---|
| 550 | 500 | } |
|---|
| 551 | | - result = i2400mu_debugfs_add(i2400mu); |
|---|
| 552 | | - if (result < 0) { |
|---|
| 553 | | - dev_err(dev, "Can't register i2400mu's debugfs: %d\n", result); |
|---|
| 554 | | - goto error_debugfs_add; |
|---|
| 555 | | - } |
|---|
| 501 | + i2400mu_debugfs_add(i2400mu); |
|---|
| 556 | 502 | return 0; |
|---|
| 557 | 503 | |
|---|
| 558 | | -error_debugfs_add: |
|---|
| 559 | | - i2400m_release(i2400m); |
|---|
| 560 | 504 | error_setup: |
|---|
| 561 | 505 | usb_set_intfdata(iface, NULL); |
|---|
| 562 | 506 | usb_put_dev(i2400mu->usb_dev); |
|---|
| .. | .. |
|---|
| 567 | 511 | |
|---|
| 568 | 512 | |
|---|
| 569 | 513 | /* |
|---|
| 570 | | - * Disconect a i2400m from the system. |
|---|
| 514 | + * Disconnect a i2400m from the system. |
|---|
| 571 | 515 | * |
|---|
| 572 | 516 | * i2400m_stop() has been called before, so al the rx and tx contexts |
|---|
| 573 | 517 | * have been taken down already. Make sure the queue is stopped, |
|---|