From 297b60346df8beafee954a0fd7c2d64f33f3b9bc Mon Sep 17 00:00:00 2001
From: hc <hc@nodka.com>
Date: Sat, 11 May 2024 01:44:05 +0000
Subject: [PATCH] rtl8211F_led_control

---
 kernel/arch/powerpc/platforms/pseries/iommu.c |   31 +++++++++++--------------------
 1 files changed, 11 insertions(+), 20 deletions(-)

diff --git a/kernel/arch/powerpc/platforms/pseries/iommu.c b/kernel/arch/powerpc/platforms/pseries/iommu.c
index f05555d..245f1f8 100644
--- a/kernel/arch/powerpc/platforms/pseries/iommu.c
+++ b/kernel/arch/powerpc/platforms/pseries/iommu.c
@@ -24,7 +24,6 @@
 #include <linux/of.h>
 #include <linux/iommu.h>
 #include <linux/rculist.h>
-#include <linux/local_lock.h>
 #include <asm/io.h>
 #include <asm/prom.h>
 #include <asm/rtas.h>
@@ -191,13 +190,7 @@
 	return ret;
 }
 
-struct tce_page {
-	__be64 * page;
-	local_lock_t lock;
-};
-static DEFINE_PER_CPU(struct tce_page, tce_page) = {
-	.lock = INIT_LOCAL_LOCK(lock),
-};
+static DEFINE_PER_CPU(__be64 *, tce_page);
 
 static int tce_buildmulti_pSeriesLP(struct iommu_table *tbl, long tcenum,
 				     long npages, unsigned long uaddr,
@@ -219,10 +212,9 @@
 		                           direction, attrs);
 	}
 
-	/* to protect tcep and the page behind it */
-	local_lock_irqsave(&tce_page.lock, flags);
+	local_irq_save(flags);	/* to protect tcep and the page behind it */
 
-	tcep = __this_cpu_read(tce_page.page);
+	tcep = __this_cpu_read(tce_page);
 
 	/* This is safe to do since interrupts are off when we're called
 	 * from iommu_alloc{,_sg}()
@@ -231,12 +223,12 @@
 		tcep = (__be64 *)__get_free_page(GFP_ATOMIC);
 		/* If allocation fails, fall back to the loop implementation */
 		if (!tcep) {
-			local_unlock_irqrestore(&tce_page.lock, flags);
+			local_irq_restore(flags);
 			return tce_build_pSeriesLP(tbl->it_index, tcenum,
 					tbl->it_page_shift,
 					npages, uaddr, direction, attrs);
 		}
-		__this_cpu_write(tce_page.page, tcep);
+		__this_cpu_write(tce_page, tcep);
 	}
 
 	rpn = __pa(uaddr) >> TCE_SHIFT;
@@ -266,7 +258,7 @@
 		tcenum += limit;
 	} while (npages > 0 && !rc);
 
-	local_unlock_irqrestore(&tce_page.lock, flags);
+	local_irq_restore(flags);
 
 	if (unlikely(rc == H_NOT_ENOUGH_RESOURCES)) {
 		ret = (int)rc;
@@ -437,17 +429,16 @@
 				DMA_BIDIRECTIONAL, 0);
 	}
 
-	/* to protect tcep and the page behind it */
-	local_lock_irq(&tce_page.lock);
-	tcep = __this_cpu_read(tce_page.page);
+	local_irq_disable();	/* to protect tcep and the page behind it */
+	tcep = __this_cpu_read(tce_page);
 
 	if (!tcep) {
 		tcep = (__be64 *)__get_free_page(GFP_ATOMIC);
 		if (!tcep) {
-			local_unlock_irq(&tce_page.lock);
+			local_irq_enable();
 			return -ENOMEM;
 		}
-		__this_cpu_write(tce_page.page, tcep);
+		__this_cpu_write(tce_page, tcep);
 	}
 
 	proto_tce = TCE_PCI_READ | TCE_PCI_WRITE;
@@ -490,7 +481,7 @@
 
 	/* error cleanup: caller will clear whole range */
 
-	local_unlock_irq(&tce_page.lock);
+	local_irq_enable();
 	return rc;
 }
 

--
Gitblit v1.6.2