hc
2024-02-20 102a0743326a03cd1a1202ceda21e175b7d3575c
kernel/drivers/message/fusion/mptbase.c
....@@ -335,11 +335,11 @@
335335 MPT_ADAPTER *ioc = (MPT_ADAPTER *)arg;
336336 struct pci_dev *pdev;
337337
338
- if ((ioc == NULL))
338
+ if (!ioc)
339339 return -1;
340340
341341 pdev = ioc->pcidev;
342
- if ((pdev == NULL))
342
+ if (!pdev)
343343 return -1;
344344
345345 pci_stop_and_remove_bus_device_locked(pdev);
....@@ -642,7 +642,7 @@
642642 freereq = 0;
643643 if (event != MPI_EVENT_EVENT_CHANGE)
644644 break;
645
- /* else: fall through */
645
+ fallthrough;
646646 case MPI_FUNCTION_CONFIG:
647647 case MPI_FUNCTION_SAS_IO_UNIT_CONTROL:
648648 ioc->mptbase_cmds.status |= MPT_MGMT_STATUS_COMMAND_GOOD;
....@@ -1324,13 +1324,13 @@
13241324 return 0; /* fw doesn't need any host buffers */
13251325
13261326 /* spin till we get enough memory */
1327
- while(host_page_buffer_sz > 0) {
1328
-
1329
- if((ioc->HostPageBuffer = pci_alloc_consistent(
1330
- ioc->pcidev,
1331
- host_page_buffer_sz,
1332
- &ioc->HostPageBuffer_dma)) != NULL) {
1333
-
1327
+ while (host_page_buffer_sz > 0) {
1328
+ ioc->HostPageBuffer =
1329
+ dma_alloc_coherent(&ioc->pcidev->dev,
1330
+ host_page_buffer_sz,
1331
+ &ioc->HostPageBuffer_dma,
1332
+ GFP_KERNEL);
1333
+ if (ioc->HostPageBuffer) {
13341334 dinitprintk(ioc, printk(MYIOC_s_DEBUG_FMT
13351335 "host_page_buffer @ %p, dma @ %x, sz=%d bytes\n",
13361336 ioc->name, ioc->HostPageBuffer,
....@@ -1887,7 +1887,7 @@
18871887 case MPI_MANUFACTPAGE_DEVICEID_FC939X:
18881888 case MPI_MANUFACTPAGE_DEVICEID_FC949X:
18891889 ioc->errata_flag_1064 = 1;
1890
- /* fall through */
1890
+ fallthrough;
18911891 case MPI_MANUFACTPAGE_DEVICEID_FC909:
18921892 case MPI_MANUFACTPAGE_DEVICEID_FC929:
18931893 case MPI_MANUFACTPAGE_DEVICEID_FC919:
....@@ -1932,7 +1932,7 @@
19321932 pcixcmd &= 0x8F;
19331933 pci_write_config_byte(pdev, 0x6a, pcixcmd);
19341934 }
1935
- /* fall through */
1935
+ fallthrough;
19361936
19371937 case MPI_MANUFACTPAGE_DEVID_1030_53C1035:
19381938 ioc->bus_type = SPI;
....@@ -2741,8 +2741,8 @@
27412741 sz = ioc->alloc_sz;
27422742 dexitprintk(ioc, printk(MYIOC_s_INFO_FMT "free @ %p, sz=%d bytes\n",
27432743 ioc->name, ioc->alloc, ioc->alloc_sz));
2744
- pci_free_consistent(ioc->pcidev, sz,
2745
- ioc->alloc, ioc->alloc_dma);
2744
+ dma_free_coherent(&ioc->pcidev->dev, sz, ioc->alloc,
2745
+ ioc->alloc_dma);
27462746 ioc->reply_frames = NULL;
27472747 ioc->req_frames = NULL;
27482748 ioc->alloc = NULL;
....@@ -2751,8 +2751,8 @@
27512751
27522752 if (ioc->sense_buf_pool != NULL) {
27532753 sz = (ioc->req_depth * MPT_SENSE_BUFFER_ALLOC);
2754
- pci_free_consistent(ioc->pcidev, sz,
2755
- ioc->sense_buf_pool, ioc->sense_buf_pool_dma);
2754
+ dma_free_coherent(&ioc->pcidev->dev, sz, ioc->sense_buf_pool,
2755
+ ioc->sense_buf_pool_dma);
27562756 ioc->sense_buf_pool = NULL;
27572757 ioc->alloc_total -= sz;
27582758 }
....@@ -2802,7 +2802,7 @@
28022802 "HostPageBuffer free @ %p, sz=%d bytes\n",
28032803 ioc->name, ioc->HostPageBuffer,
28042804 ioc->HostPageBuffer_sz));
2805
- pci_free_consistent(ioc->pcidev, ioc->HostPageBuffer_sz,
2805
+ dma_free_coherent(&ioc->pcidev->dev, ioc->HostPageBuffer_sz,
28062806 ioc->HostPageBuffer, ioc->HostPageBuffer_dma);
28072807 ioc->HostPageBuffer = NULL;
28082808 ioc->HostPageBuffer_sz = 0;
....@@ -4497,7 +4497,8 @@
44974497 ioc->name, sz, sz, num_chain));
44984498
44994499 total_size += sz;
4500
- mem = pci_alloc_consistent(ioc->pcidev, total_size, &alloc_dma);
4500
+ mem = dma_alloc_coherent(&ioc->pcidev->dev, total_size,
4501
+ &alloc_dma, GFP_KERNEL);
45014502 if (mem == NULL) {
45024503 printk(MYIOC_s_ERR_FMT "Unable to allocate Reply, Request, Chain Buffers!\n",
45034504 ioc->name);
....@@ -4574,8 +4575,8 @@
45744575 spin_unlock_irqrestore(&ioc->FreeQlock, flags);
45754576
45764577 sz = (ioc->req_depth * MPT_SENSE_BUFFER_ALLOC);
4577
- ioc->sense_buf_pool =
4578
- pci_alloc_consistent(ioc->pcidev, sz, &ioc->sense_buf_pool_dma);
4578
+ ioc->sense_buf_pool = dma_alloc_coherent(&ioc->pcidev->dev, sz,
4579
+ &ioc->sense_buf_pool_dma, GFP_KERNEL);
45794580 if (ioc->sense_buf_pool == NULL) {
45804581 printk(MYIOC_s_ERR_FMT "Unable to allocate Sense Buffers!\n",
45814582 ioc->name);
....@@ -4613,18 +4614,16 @@
46134614
46144615 if (ioc->alloc != NULL) {
46154616 sz = ioc->alloc_sz;
4616
- pci_free_consistent(ioc->pcidev,
4617
- sz,
4618
- ioc->alloc, ioc->alloc_dma);
4617
+ dma_free_coherent(&ioc->pcidev->dev, sz, ioc->alloc,
4618
+ ioc->alloc_dma);
46194619 ioc->reply_frames = NULL;
46204620 ioc->req_frames = NULL;
46214621 ioc->alloc_total -= sz;
46224622 }
46234623 if (ioc->sense_buf_pool != NULL) {
46244624 sz = (ioc->req_depth * MPT_SENSE_BUFFER_ALLOC);
4625
- pci_free_consistent(ioc->pcidev,
4626
- sz,
4627
- ioc->sense_buf_pool, ioc->sense_buf_pool_dma);
4625
+ dma_free_coherent(&ioc->pcidev->dev, sz, ioc->sense_buf_pool,
4626
+ ioc->sense_buf_pool_dma);
46284627 ioc->sense_buf_pool = NULL;
46294628 }
46304629
....@@ -5052,9 +5051,11 @@
50525051 * @ioc: Pointer to MPT_ADAPTER structure
50535052 * @persist_opcode: see below
50545053 *
5055
- * MPI_SAS_OP_CLEAR_NOT_PRESENT - Free all persist TargetID mappings for
5056
- * devices not currently present.
5057
- * MPI_SAS_OP_CLEAR_ALL_PERSISTENT - Clear al persist TargetID mappings
5054
+ * =============================== ======================================
5055
+ * MPI_SAS_OP_CLEAR_NOT_PRESENT Free all persist TargetID mappings for
5056
+ * devices not currently present.
5057
+ * MPI_SAS_OP_CLEAR_ALL_PERSISTENT Clear al persist TargetID mappings
5058
+ * =============================== ======================================
50585059 *
50595060 * NOTE: Don't use not this function during interrupt time.
50605061 *
....@@ -6001,13 +6002,12 @@
60016002 if (mpt_config(ioc, &cfg) != 0)
60026003 goto out;
60036004
6004
- mem = kmalloc(iocpage2sz, GFP_KERNEL);
6005
+ mem = kmemdup(pIoc2, iocpage2sz, GFP_KERNEL);
60056006 if (!mem) {
60066007 rc = -ENOMEM;
60076008 goto out;
60086009 }
60096010
6010
- memcpy(mem, (u8 *)pIoc2, iocpage2sz);
60116011 ioc->raid_data.pIocPg2 = (IOCPage2_t *) mem;
60126012
60136013 mpt_read_ioc_pg_3(ioc);
....@@ -7570,11 +7570,11 @@
75707570 u8 phy_num = (u8)(evData0);
75717571 u8 port_num = (u8)(evData0 >> 8);
75727572 u8 port_width = (u8)(evData0 >> 16);
7573
- u8 primative = (u8)(evData0 >> 24);
7573
+ u8 primitive = (u8)(evData0 >> 24);
75747574 snprintf(evStr, EVENT_DESCR_STR_SZ,
7575
- "SAS Broadcase Primative: phy=%d port=%d "
7576
- "width=%d primative=0x%02x",
7577
- phy_num, port_num, port_width, primative);
7575
+ "SAS Broadcast Primitive: phy=%d port=%d "
7576
+ "width=%d primitive=0x%02x",
7577
+ phy_num, port_num, port_width, primitive);
75787578 break;
75797579 }
75807580