From: Matthew Wilcox Date: Thu, 25 Oct 2018 16:22:46 +0000 (-0400) Subject: pwm: Convert to XArray X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=a00f8ede6a75a827c66144c141ed48718df05635;p=users%2Fwilly%2Fxarray.git pwm: Convert to XArray Straightforward conversion. Signed-off-by: Matthew Wilcox --- diff --git a/drivers/pwm/core.c b/drivers/pwm/core.c index c3ab07ab31a96..810a64a9053d2 100644 --- a/drivers/pwm/core.c +++ b/drivers/pwm/core.c @@ -9,7 +9,7 @@ #include #include #include -#include +#include #include #include #include @@ -27,11 +27,11 @@ static LIST_HEAD(pwm_lookup_list); static DEFINE_MUTEX(pwm_lock); static LIST_HEAD(pwm_chips); static DECLARE_BITMAP(allocated_pwms, MAX_PWMS); -static RADIX_TREE(pwm_tree, GFP_KERNEL); +static DEFINE_XARRAY(pwm_devs); static struct pwm_device *pwm_to_device(unsigned int pwm) { - return radix_tree_lookup(&pwm_tree, pwm); + return xa_load(&pwm_devs, pwm); } static int alloc_pwms(int pwm, unsigned int count) @@ -64,7 +64,7 @@ static void free_pwms(struct pwm_chip *chip) for (i = 0; i < chip->npwm; i++) { struct pwm_device *pwm = &chip->pwms[i]; - radix_tree_delete(&pwm_tree, pwm->pwm); + xa_erase(&pwm_devs, pwm->pwm); } bitmap_clear(allocated_pwms, chip->base, chip->npwm); @@ -286,7 +286,7 @@ int pwmchip_add_with_polarity(struct pwm_chip *chip, if (chip->ops->get_state) chip->ops->get_state(chip, pwm, &pwm->state); - radix_tree_insert(&pwm_tree, pwm->pwm, pwm); + xa_store(&pwm_devs, pwm->pwm, pwm, GFP_KERNEL); } bitmap_set(allocated_pwms, chip->base, chip->npwm);