| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * Filename: core.c |
|---|
| 3 | | -* |
|---|
| 4 | 4 | * |
|---|
| 5 | 5 | * Authors: Joshua Morris <josh.h.morris@us.ibm.com> |
|---|
| 6 | 6 | * Philip Kelleher <pjk1939@linux.vnet.ibm.com> |
|---|
| 7 | 7 | * |
|---|
| 8 | 8 | * (C) Copyright 2013 IBM Corporation |
|---|
| 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 as |
|---|
| 12 | | -* published by the Free Software Foundation; either version 2 of the |
|---|
| 13 | | -* License, or (at your option) any later version. |
|---|
| 14 | | -* |
|---|
| 15 | | -* This program is distributed in the hope that it will be useful, but |
|---|
| 16 | | -* WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 17 | | -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|---|
| 18 | | -* General Public License for more details. |
|---|
| 19 | | -* |
|---|
| 20 | | -* You should have received a copy of the GNU General Public License |
|---|
| 21 | | -* along with this program; if not, write to the Free Software Foundation, |
|---|
| 22 | | -* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|---|
| 23 | 9 | */ |
|---|
| 24 | 10 | |
|---|
| 25 | 11 | #include <linux/kernel.h> |
|---|
| .. | .. |
|---|
| 441 | 427 | * Fall through so the DMA devices can be attached and |
|---|
| 442 | 428 | * the user can attempt to pull off their data. |
|---|
| 443 | 429 | */ |
|---|
| 430 | + fallthrough; |
|---|
| 444 | 431 | case CARD_STATE_GOOD: |
|---|
| 445 | 432 | st = rsxx_get_card_size8(card, &card->size8); |
|---|
| 446 | 433 | if (st) |
|---|
| .. | .. |
|---|
| 454 | 441 | case CARD_STATE_FAULT: |
|---|
| 455 | 442 | dev_crit(CARD_TO_DEV(card), |
|---|
| 456 | 443 | "Hardware Fault reported!\n"); |
|---|
| 457 | | - /* Fall through. */ |
|---|
| 444 | + fallthrough; |
|---|
| 458 | 445 | |
|---|
| 459 | 446 | /* Everything else, detach DMA interface if it's attached. */ |
|---|
| 460 | 447 | case CARD_STATE_SHUTDOWN: |
|---|
| .. | .. |
|---|
| 577 | 564 | |
|---|
| 578 | 565 | for (i = 0; i < card->n_targets; i++) { |
|---|
| 579 | 566 | if (card->ctrl[i].status.buf) |
|---|
| 580 | | - pci_free_consistent(card->dev, STATUS_BUFFER_SIZE8, |
|---|
| 581 | | - card->ctrl[i].status.buf, |
|---|
| 582 | | - card->ctrl[i].status.dma_addr); |
|---|
| 567 | + dma_free_coherent(&card->dev->dev, |
|---|
| 568 | + STATUS_BUFFER_SIZE8, |
|---|
| 569 | + card->ctrl[i].status.buf, |
|---|
| 570 | + card->ctrl[i].status.dma_addr); |
|---|
| 583 | 571 | if (card->ctrl[i].cmd.buf) |
|---|
| 584 | | - pci_free_consistent(card->dev, COMMAND_BUFFER_SIZE8, |
|---|
| 585 | | - card->ctrl[i].cmd.buf, |
|---|
| 586 | | - card->ctrl[i].cmd.dma_addr); |
|---|
| 572 | + dma_free_coherent(&card->dev->dev, |
|---|
| 573 | + COMMAND_BUFFER_SIZE8, |
|---|
| 574 | + card->ctrl[i].cmd.buf, |
|---|
| 575 | + card->ctrl[i].cmd.dma_addr); |
|---|
| 587 | 576 | } |
|---|
| 588 | 577 | |
|---|
| 589 | 578 | return 0; |
|---|
| .. | .. |
|---|
| 640 | 629 | } |
|---|
| 641 | 630 | |
|---|
| 642 | 631 | static pci_ers_result_t rsxx_error_detected(struct pci_dev *dev, |
|---|
| 643 | | - enum pci_channel_state error) |
|---|
| 632 | + pci_channel_state_t error) |
|---|
| 644 | 633 | { |
|---|
| 645 | 634 | int st; |
|---|
| 646 | 635 | |
|---|
| .. | .. |
|---|
| 726 | 715 | failed_hw_buffers_init: |
|---|
| 727 | 716 | for (i = 0; i < card->n_targets; i++) { |
|---|
| 728 | 717 | if (card->ctrl[i].status.buf) |
|---|
| 729 | | - pci_free_consistent(card->dev, |
|---|
| 730 | | - STATUS_BUFFER_SIZE8, |
|---|
| 731 | | - card->ctrl[i].status.buf, |
|---|
| 732 | | - card->ctrl[i].status.dma_addr); |
|---|
| 718 | + dma_free_coherent(&card->dev->dev, |
|---|
| 719 | + STATUS_BUFFER_SIZE8, |
|---|
| 720 | + card->ctrl[i].status.buf, |
|---|
| 721 | + card->ctrl[i].status.dma_addr); |
|---|
| 733 | 722 | if (card->ctrl[i].cmd.buf) |
|---|
| 734 | | - pci_free_consistent(card->dev, |
|---|
| 735 | | - COMMAND_BUFFER_SIZE8, |
|---|
| 736 | | - card->ctrl[i].cmd.buf, |
|---|
| 737 | | - card->ctrl[i].cmd.dma_addr); |
|---|
| 723 | + dma_free_coherent(&card->dev->dev, |
|---|
| 724 | + COMMAND_BUFFER_SIZE8, |
|---|
| 725 | + card->ctrl[i].cmd.buf, |
|---|
| 726 | + card->ctrl[i].cmd.dma_addr); |
|---|
| 738 | 727 | } |
|---|
| 739 | 728 | failed_hw_setup: |
|---|
| 740 | 729 | rsxx_eeh_failure(dev); |
|---|
| .. | .. |
|---|
| 782 | 771 | goto failed_enable; |
|---|
| 783 | 772 | |
|---|
| 784 | 773 | pci_set_master(dev); |
|---|
| 785 | | - pci_set_dma_max_seg_size(dev, RSXX_HW_BLK_SIZE); |
|---|
| 786 | 774 | |
|---|
| 787 | | - st = pci_set_dma_mask(dev, DMA_BIT_MASK(64)); |
|---|
| 775 | + st = dma_set_mask(&dev->dev, DMA_BIT_MASK(64)); |
|---|
| 788 | 776 | if (st) { |
|---|
| 789 | 777 | dev_err(CARD_TO_DEV(card), |
|---|
| 790 | 778 | "No usable DMA configuration,aborting\n"); |
|---|