forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-02-19 1c055e55a242a33e574e48be530e06770a210dcd
kernel/drivers/tty/serial/icom.c
....@@ -138,24 +138,24 @@
138138
139139 trace(icom_port, "RET_PORT_MEM", 0);
140140 if (icom_port->recv_buf) {
141
- pci_free_consistent(dev, 4096, icom_port->recv_buf,
142
- icom_port->recv_buf_pci);
141
+ dma_free_coherent(&dev->dev, 4096, icom_port->recv_buf,
142
+ icom_port->recv_buf_pci);
143143 icom_port->recv_buf = NULL;
144144 }
145145 if (icom_port->xmit_buf) {
146
- pci_free_consistent(dev, 4096, icom_port->xmit_buf,
147
- icom_port->xmit_buf_pci);
146
+ dma_free_coherent(&dev->dev, 4096, icom_port->xmit_buf,
147
+ icom_port->xmit_buf_pci);
148148 icom_port->xmit_buf = NULL;
149149 }
150150 if (icom_port->statStg) {
151
- pci_free_consistent(dev, 4096, icom_port->statStg,
152
- icom_port->statStg_pci);
151
+ dma_free_coherent(&dev->dev, 4096, icom_port->statStg,
152
+ icom_port->statStg_pci);
153153 icom_port->statStg = NULL;
154154 }
155155
156156 if (icom_port->xmitRestart) {
157
- pci_free_consistent(dev, 4096, icom_port->xmitRestart,
158
- icom_port->xmitRestart_pci);
157
+ dma_free_coherent(&dev->dev, 4096, icom_port->xmitRestart,
158
+ icom_port->xmitRestart_pci);
159159 icom_port->xmitRestart = NULL;
160160 }
161161 }
....@@ -169,7 +169,8 @@
169169 struct pci_dev *dev = icom_port->adapter->pci_dev;
170170
171171 icom_port->xmit_buf =
172
- pci_alloc_consistent(dev, 4096, &icom_port->xmit_buf_pci);
172
+ dma_alloc_coherent(&dev->dev, 4096, &icom_port->xmit_buf_pci,
173
+ GFP_KERNEL);
173174 if (!icom_port->xmit_buf) {
174175 dev_err(&dev->dev, "Can not allocate Transmit buffer\n");
175176 return -ENOMEM;
....@@ -179,7 +180,8 @@
179180 (unsigned long) icom_port->xmit_buf);
180181
181182 icom_port->recv_buf =
182
- pci_alloc_consistent(dev, 4096, &icom_port->recv_buf_pci);
183
+ dma_alloc_coherent(&dev->dev, 4096, &icom_port->recv_buf_pci,
184
+ GFP_KERNEL);
183185 if (!icom_port->recv_buf) {
184186 dev_err(&dev->dev, "Can not allocate Receive buffer\n");
185187 free_port_memory(icom_port);
....@@ -189,7 +191,8 @@
189191 (unsigned long) icom_port->recv_buf);
190192
191193 icom_port->statStg =
192
- pci_alloc_consistent(dev, 4096, &icom_port->statStg_pci);
194
+ dma_alloc_coherent(&dev->dev, 4096, &icom_port->statStg_pci,
195
+ GFP_KERNEL);
193196 if (!icom_port->statStg) {
194197 dev_err(&dev->dev, "Can not allocate Status buffer\n");
195198 free_port_memory(icom_port);
....@@ -199,15 +202,14 @@
199202 (unsigned long) icom_port->statStg);
200203
201204 icom_port->xmitRestart =
202
- pci_alloc_consistent(dev, 4096, &icom_port->xmitRestart_pci);
205
+ dma_alloc_coherent(&dev->dev, 4096, &icom_port->xmitRestart_pci,
206
+ GFP_KERNEL);
203207 if (!icom_port->xmitRestart) {
204208 dev_err(&dev->dev,
205209 "Can not allocate xmit Restart buffer\n");
206210 free_port_memory(icom_port);
207211 return -ENOMEM;
208212 }
209
-
210
- memset(icom_port->statStg, 0, 4096);
211213
212214 /* FODs: Frame Out Descriptor Queue, this is a FIFO queue that
213215 indicates that frames are to be transmitted
....@@ -416,7 +418,7 @@
416418 /*Set up data in icom DRAM to indicate where personality
417419 *code is located and its length.
418420 */
419
- new_page = pci_alloc_consistent(dev, 4096, &temp_pci);
421
+ new_page = dma_alloc_coherent(&dev->dev, 4096, &temp_pci, GFP_KERNEL);
420422
421423 if (!new_page) {
422424 dev_err(&dev->dev, "Can not allocate DMA buffer\n");
....@@ -496,7 +498,7 @@
496498 }
497499
498500 if (new_page != NULL)
499
- pci_free_consistent(dev, 4096, new_page, temp_pci);
501
+ dma_free_coherent(&dev->dev, 4096, new_page, temp_pci);
500502 }
501503
502504 static int startup(struct icom_port *icom_port)
....@@ -1501,7 +1503,7 @@
15011503 retval = pci_read_config_dword(dev, PCI_COMMAND, &command_reg);
15021504 if (retval) {
15031505 dev_err(&dev->dev, "PCI Config read FAILED\n");
1504
- return retval;
1506
+ goto probe_exit0;
15051507 }
15061508
15071509 pci_write_config_dword(dev, PCI_COMMAND,