Skip to contentSkip to conversation

pwm: Remove unused radix tree

PATCH In review Thierry Reding 2 participants 3 messages Apr 13, 2023 – Apr 14, 2023 PWM

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 pwm: Remove unused radix tree

The radix tree's only use was to map PWM channels to the global number space. With that number space gone, the radix tree is now unused, so it can simply be removed.

---
 drivers/pwm/core.c | 13 +------------
 1 file changed, 1 insertion(+), 12 deletions(-)
drivers/pwm/core.c +1 -12
index 9ce85c6157e4..3dacceaef4a9 100644
@@ -28,12 +28,11 @@
 static DEFINE_MUTEX(pwm_lookup_lock);
 static LIST_HEAD(pwm_lookup_list);
 
-/* protects access to pwm_chips, allocated_pwms, and pwm_tree */
+/* protects access to pwm_chips and allocated_pwms */
 static DEFINE_MUTEX(pwm_lock);
 
 static LIST_HEAD(pwm_chips);
 static DECLARE_BITMAP(allocated_pwms, MAX_PWMS);
-static RADIX_TREE(pwm_tree, GFP_KERNEL);
 
 /* Called with pwm_lock held */
 static int alloc_pwms(unsigned int count)
@@ -54,14 +53,6 @@ static int alloc_pwms(unsigned int count)
 /* Called with pwm_lock held */
 static void free_pwms(struct pwm_chip *chip)
 {
-	unsigned int i;
-
-	for (i = 0; i < chip->npwm; i++) {
-		struct pwm_device *pwm = &chip->pwms[i];
-
-		radix_tree_delete(&pwm_tree, pwm->pwm);
-	}
-
 	bitmap_clear(allocated_pwms, chip->base, chip->npwm);
 
 	kfree(chip->pwms);
@@ -302,8 +293,6 @@ int pwmchip_add(struct pwm_chip *chip)
 		pwm->chip = chip;
 		pwm->pwm = chip->base + i;
 		pwm->hwpwm = i;
-
-		radix_tree_insert(&pwm_tree, pwm->pwm, pwm);
 	}
 
 	list_add(&chip->list, &pwm_chips);
Signature · 1 line
2.40.0
Acked-by on v1 1/1
#1 lore raw
Quoted 5 lines · Thierry Reding

The radix tree's only use was to map PWM channels to the global number space. With that number space gone, the radix tree is now unused, so it can simply be removed.

Assuming you put that on top of my patch removing pwm_request() and pwm_free() (+ the fixes you mentioned in reply to it):

Best regards
Uwe

Signature · 2 lines
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | https://www.pengutronix.de/ |
#2 lore raw
Quoted 11 lines · Uwe Kleine-König
Quoted 5 lines · Thierry Reding

The radix tree's only use was to map PWM channels to the global number space. With that number space gone, the radix tree is now unused, so it can simply be removed.

Assuming you put that on top of my patch removing pwm_request() and pwm_free() (+ the fixes you mentioned in reply to it):

Yeah, that's exactly what I did. Thanks for the quick review. I've applied this now.

Thierry