hc
2024-02-20 102a0743326a03cd1a1202ceda21e175b7d3575c
kernel/drivers/bus/hisi_lpc.c
....@@ -74,7 +74,7 @@
7474 /* About 10us. This is specific for single IO operations, such as inb */
7575 #define LPC_PEROP_WAITCNT 100
7676
77
-static int wait_lpc_idle(unsigned char *mbase, unsigned int waitcnt)
77
+static int wait_lpc_idle(void __iomem *mbase, unsigned int waitcnt)
7878 {
7979 u32 status;
8080
....@@ -209,7 +209,7 @@
209209 struct hisi_lpc_dev *lpcdev = hostdata;
210210 struct lpc_cycle_para iopara;
211211 unsigned long addr;
212
- u32 rd_data = 0;
212
+ __le32 rd_data = 0;
213213 int ret;
214214
215215 if (!lpcdev || !dwidth || dwidth > LPC_MAX_DWIDTH)
....@@ -244,13 +244,12 @@
244244 struct lpc_cycle_para iopara;
245245 const unsigned char *buf;
246246 unsigned long addr;
247
+ __le32 _val = cpu_to_le32(val);
247248
248249 if (!lpcdev || !dwidth || dwidth > LPC_MAX_DWIDTH)
249250 return;
250251
251
- val = cpu_to_le32(val);
252
-
253
- buf = (const unsigned char *)&val;
252
+ buf = (const unsigned char *)&_val;
254253 addr = hisi_lpc_pio_to_addr(lpcdev, pio);
255254
256255 iopara.opflags = FG_INCRADDR_LPC;
....@@ -504,13 +503,13 @@
504503 {
505504 struct acpi_device *adev = ACPI_COMPANION(hostdev);
506505 struct acpi_device *child;
506
+ struct platform_device *pdev;
507507 int ret;
508508
509509 /* Only consider the children of the host */
510510 list_for_each_entry(child, &adev->children, node) {
511511 const char *hid = acpi_device_hid(child);
512512 const struct hisi_lpc_acpi_cell *cell;
513
- struct platform_device *pdev;
514513 const struct resource *res;
515514 bool found = false;
516515 int num_res;
....@@ -556,10 +555,9 @@
556555
557556 if (!found) {
558557 dev_warn(hostdev,
559
- "could not find cell for child device (%s)\n",
558
+ "could not find cell for child device (%s), discarding\n",
560559 hid);
561
- ret = -ENODEV;
562
- goto fail;
560
+ continue;
563561 }
564562
565563 pdev = platform_device_alloc(cell->name, PLATFORM_DEVID_AUTO);
....@@ -573,22 +571,24 @@
573571
574572 ret = platform_device_add_resources(pdev, res, num_res);
575573 if (ret)
576
- goto fail;
574
+ goto fail_put_device;
577575
578576 ret = platform_device_add_data(pdev, cell->pdata,
579577 cell->pdata_size);
580578 if (ret)
581
- goto fail;
579
+ goto fail_put_device;
582580
583581 ret = platform_device_add(pdev);
584582 if (ret)
585
- goto fail;
583
+ goto fail_put_device;
586584
587585 acpi_device_set_enumerated(child);
588586 }
589587
590588 return 0;
591589
590
+fail_put_device:
591
+ platform_device_put(pdev);
592592 fail:
593593 hisi_lpc_acpi_remove(hostdev);
594594 return ret;