hc
2023-12-11 d2ccde1c8e90d38cee87a1b0309ad2827f3fd30d
kernel/drivers/crypto/qat/qat_c62x/adf_drv.c
....@@ -1,49 +1,5 @@
1
-/*
2
- This file is provided under a dual BSD/GPLv2 license. When using or
3
- redistributing this file, you may do so under either license.
4
-
5
- GPL LICENSE SUMMARY
6
- Copyright(c) 2014 Intel Corporation.
7
- This program is free software; you can redistribute it and/or modify
8
- it under the terms of version 2 of the GNU General Public License as
9
- published by the Free Software Foundation.
10
-
11
- This program is distributed in the hope that it will be useful, but
12
- WITHOUT ANY WARRANTY; without even the implied warranty of
13
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14
- General Public License for more details.
15
-
16
- Contact Information:
17
- qat-linux@intel.com
18
-
19
- BSD LICENSE
20
- Copyright(c) 2014 Intel Corporation.
21
- Redistribution and use in source and binary forms, with or without
22
- modification, are permitted provided that the following conditions
23
- are met:
24
-
25
- * Redistributions of source code must retain the above copyright
26
- notice, this list of conditions and the following disclaimer.
27
- * Redistributions in binary form must reproduce the above copyright
28
- notice, this list of conditions and the following disclaimer in
29
- the documentation and/or other materials provided with the
30
- distribution.
31
- * Neither the name of Intel Corporation nor the names of its
32
- contributors may be used to endorse or promote products derived
33
- from this software without specific prior written permission.
34
-
35
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
36
- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
37
- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
38
- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
39
- OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
40
- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
41
- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
42
- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
43
- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
44
- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
45
- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
46
-*/
1
+// SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0-only)
2
+/* Copyright(c) 2014 - 2020 Intel Corporation */
473 #include <linux/kernel.h>
484 #include <linux/module.h>
495 #include <linux/pci.h>
....@@ -62,12 +18,9 @@
6218 #include <adf_cfg.h>
6319 #include "adf_c62x_hw_data.h"
6420
65
-#define ADF_SYSTEM_DEVICE(device_id) \
66
- {PCI_DEVICE(PCI_VENDOR_ID_INTEL, device_id)}
67
-
6821 static const struct pci_device_id adf_pci_tbl[] = {
69
- ADF_SYSTEM_DEVICE(ADF_C62X_PCI_DEVICE_ID),
70
- {0,}
22
+ { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_QAT_C62X), },
23
+ { }
7124 };
7225 MODULE_DEVICE_TABLE(pci, adf_pci_tbl);
7326
....@@ -102,7 +55,7 @@
10255
10356 if (accel_dev->hw_device) {
10457 switch (accel_pci_dev->pci_dev->device) {
105
- case ADF_C62X_PCI_DEVICE_ID:
58
+ case PCI_DEVICE_ID_INTEL_QAT_C62X:
10659 adf_clean_hw_data_c62x(accel_dev->hw_device);
10760 break;
10861 default:
....@@ -127,7 +80,7 @@
12780 int ret;
12881
12982 switch (ent->device) {
130
- case ADF_C62X_PCI_DEVICE_ID:
83
+ case PCI_DEVICE_ID_INTEL_QAT_C62X:
13184 break;
13285 default:
13386 dev_err(&pdev->dev, "Invalid device 0x%x.\n", ent->device);
....@@ -187,17 +140,10 @@
187140 }
188141
189142 /* Create dev top level debugfs entry */
190
- snprintf(name, sizeof(name), "%s%s_%02x:%02d.%d",
191
- ADF_DEVICE_NAME_PREFIX, hw_data->dev_class->name,
192
- pdev->bus->number, PCI_SLOT(pdev->devfn),
193
- PCI_FUNC(pdev->devfn));
143
+ snprintf(name, sizeof(name), "%s%s_%s", ADF_DEVICE_NAME_PREFIX,
144
+ hw_data->dev_class->name, pci_name(pdev));
194145
195146 accel_dev->debugfs_dir = debugfs_create_dir(name, NULL);
196
- if (!accel_dev->debugfs_dir) {
197
- dev_err(&pdev->dev, "Could not create debugfs dir %s\n", name);
198
- ret = -EINVAL;
199
- goto out_err;
200
- }
201147
202148 /* Create device configuration table */
203149 ret = adf_cfg_dev_add(accel_dev);
....@@ -252,7 +198,7 @@
252198 }
253199 pci_set_master(pdev);
254200
255
- if (adf_enable_aer(accel_dev, &adf_driver)) {
201
+ if (adf_enable_aer(accel_dev)) {
256202 dev_err(&pdev->dev, "Failed to enable aer\n");
257203 ret = -EFAULT;
258204 goto out_err_free_reg;