| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * Linux WiMAX |
|---|
| 3 | 4 | * Initialization, addition and removal of wimax devices |
|---|
| 4 | 5 | * |
|---|
| 5 | | - * |
|---|
| 6 | 6 | * Copyright (C) 2005-2006 Intel Corporation <linux-wimax@intel.com> |
|---|
| 7 | 7 | * Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com> |
|---|
| 8 | | - * |
|---|
| 9 | | - * This program is free software; you can redistribute it and/or |
|---|
| 10 | | - * modify it under the terms of the GNU General Public License version |
|---|
| 11 | | - * 2 as published by the Free Software Foundation. |
|---|
| 12 | | - * |
|---|
| 13 | | - * This program is distributed in the hope that it will be useful, |
|---|
| 14 | | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 15 | | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|---|
| 16 | | - * GNU General Public License for more details. |
|---|
| 17 | | - * |
|---|
| 18 | | - * You should have received a copy of the GNU General Public License |
|---|
| 19 | | - * along with this program; if not, write to the Free Software |
|---|
| 20 | | - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA |
|---|
| 21 | | - * 02110-1301, USA. |
|---|
| 22 | | - * |
|---|
| 23 | 8 | * |
|---|
| 24 | 9 | * This implements: |
|---|
| 25 | 10 | * |
|---|
| .. | .. |
|---|
| 416 | 401 | }, |
|---|
| 417 | 402 | }; |
|---|
| 418 | 403 | |
|---|
| 419 | | -static const struct genl_ops wimax_gnl_ops[] = { |
|---|
| 404 | +static const struct genl_small_ops wimax_gnl_ops[] = { |
|---|
| 420 | 405 | { |
|---|
| 421 | 406 | .cmd = WIMAX_GNL_OP_MSG_FROM_USER, |
|---|
| 407 | + .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP, |
|---|
| 422 | 408 | .flags = GENL_ADMIN_PERM, |
|---|
| 423 | | - .policy = wimax_gnl_policy, |
|---|
| 424 | 409 | .doit = wimax_gnl_doit_msg_from_user, |
|---|
| 425 | 410 | }, |
|---|
| 426 | 411 | { |
|---|
| 427 | 412 | .cmd = WIMAX_GNL_OP_RESET, |
|---|
| 413 | + .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP, |
|---|
| 428 | 414 | .flags = GENL_ADMIN_PERM, |
|---|
| 429 | | - .policy = wimax_gnl_policy, |
|---|
| 430 | 415 | .doit = wimax_gnl_doit_reset, |
|---|
| 431 | 416 | }, |
|---|
| 432 | 417 | { |
|---|
| 433 | 418 | .cmd = WIMAX_GNL_OP_RFKILL, |
|---|
| 419 | + .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP, |
|---|
| 434 | 420 | .flags = GENL_ADMIN_PERM, |
|---|
| 435 | | - .policy = wimax_gnl_policy, |
|---|
| 436 | 421 | .doit = wimax_gnl_doit_rfkill, |
|---|
| 437 | 422 | }, |
|---|
| 438 | 423 | { |
|---|
| 439 | 424 | .cmd = WIMAX_GNL_OP_STATE_GET, |
|---|
| 425 | + .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP, |
|---|
| 440 | 426 | .flags = GENL_ADMIN_PERM, |
|---|
| 441 | | - .policy = wimax_gnl_policy, |
|---|
| 442 | 427 | .doit = wimax_gnl_doit_state_get, |
|---|
| 443 | 428 | }, |
|---|
| 444 | 429 | }; |
|---|
| .. | .. |
|---|
| 496 | 481 | /* Set up user-space interaction */ |
|---|
| 497 | 482 | mutex_lock(&wimax_dev->mutex); |
|---|
| 498 | 483 | wimax_id_table_add(wimax_dev); |
|---|
| 499 | | - result = wimax_debugfs_add(wimax_dev); |
|---|
| 500 | | - if (result < 0) { |
|---|
| 501 | | - dev_err(dev, "cannot initialize debugfs: %d\n", |
|---|
| 502 | | - result); |
|---|
| 503 | | - goto error_debugfs_add; |
|---|
| 504 | | - } |
|---|
| 484 | + wimax_debugfs_add(wimax_dev); |
|---|
| 505 | 485 | |
|---|
| 506 | 486 | __wimax_state_set(wimax_dev, WIMAX_ST_DOWN); |
|---|
| 507 | 487 | mutex_unlock(&wimax_dev->mutex); |
|---|
| .. | .. |
|---|
| 513 | 493 | d_fnend(3, dev, "(wimax_dev %p net_dev %p) = 0\n", wimax_dev, net_dev); |
|---|
| 514 | 494 | return 0; |
|---|
| 515 | 495 | |
|---|
| 516 | | -error_debugfs_add: |
|---|
| 517 | | - wimax_id_table_rm(wimax_dev); |
|---|
| 518 | | - mutex_unlock(&wimax_dev->mutex); |
|---|
| 519 | | - wimax_rfkill_rm(wimax_dev); |
|---|
| 520 | 496 | error_rfkill_add: |
|---|
| 521 | 497 | d_fnend(3, dev, "(wimax_dev %p net_dev %p) = %d\n", |
|---|
| 522 | 498 | wimax_dev, net_dev, result); |
|---|
| .. | .. |
|---|
| 582 | 558 | .version = WIMAX_GNL_VERSION, |
|---|
| 583 | 559 | .hdrsize = 0, |
|---|
| 584 | 560 | .maxattr = WIMAX_GNL_ATTR_MAX, |
|---|
| 561 | + .policy = wimax_gnl_policy, |
|---|
| 585 | 562 | .module = THIS_MODULE, |
|---|
| 586 | | - .ops = wimax_gnl_ops, |
|---|
| 587 | | - .n_ops = ARRAY_SIZE(wimax_gnl_ops), |
|---|
| 563 | + .small_ops = wimax_gnl_ops, |
|---|
| 564 | + .n_small_ops = ARRAY_SIZE(wimax_gnl_ops), |
|---|
| 588 | 565 | .mcgrps = wimax_gnl_mcgrps, |
|---|
| 589 | 566 | .n_mcgrps = ARRAY_SIZE(wimax_gnl_mcgrps), |
|---|
| 590 | 567 | }; |
|---|