Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

mfd: remove DS1WM clock handling

This driver requests a clock that usually is supplied by the MFD in which
the DS1WM is contained. Currently, it is impossible for a MFD to register
their clocks with the generic clock API due to different implementations
across architectures.
For now, this patch removes the clock handling from DS1WM altogether,
trusting that the MFD enable/disable functions will switch the clock if
needed. The clock rate is obtained from a new parameter in driver_data.

Signed-off-by: Philipp Zabel <philipp.zabel@gmail.com>
Signed-off-by: Samuel Ortiz <sameo@openedhand.com>

authored by

Philipp Zabel and committed by
Samuel Ortiz
7d33ccbe b72019db

+8 -20
+7 -20
drivers/w1/masters/ds1wm.c
··· 16 16 #include <linux/irq.h> 17 17 #include <linux/pm.h> 18 18 #include <linux/platform_device.h> 19 - #include <linux/clk.h> 20 19 #include <linux/err.h> 21 20 #include <linux/delay.h> 22 21 #include <linux/mfd/core.h> ··· 92 93 struct mfd_cell *cell; 93 94 int irq; 94 95 int active_high; 95 - struct clk *clk; 96 96 int slave_present; 97 97 void *reset_complete; 98 98 void *read_complete; ··· 214 216 215 217 static void ds1wm_up(struct ds1wm_data *ds1wm_data) 216 218 { 217 - int gclk, divisor; 219 + int divisor; 220 + struct ds1wm_driver_data *plat = ds1wm_data->cell->driver_data; 218 221 219 222 if (ds1wm_data->cell->enable) 220 223 ds1wm_data->cell->enable(ds1wm_data->pdev); 221 224 222 - gclk = clk_get_rate(ds1wm_data->clk); 223 - clk_enable(ds1wm_data->clk); 224 - divisor = ds1wm_find_divisor(gclk); 225 + divisor = ds1wm_find_divisor(plat->clock_rate); 225 226 if (divisor == 0) { 226 227 dev_err(&ds1wm_data->pdev->dev, 227 - "no suitable divisor for %dHz clock\n", gclk); 228 + "no suitable divisor for %dHz clock\n", 229 + plat->clock_rate); 228 230 return; 229 231 } 230 232 ds1wm_write_register(ds1wm_data, DS1WM_CLKDIV, divisor); ··· 245 247 246 248 if (ds1wm_data->cell->disable) 247 249 ds1wm_data->cell->disable(ds1wm_data->pdev); 248 - 249 - clk_disable(ds1wm_data->clk); 250 250 } 251 251 252 252 /* --------------------------------------------------------------------- */ ··· 381 385 if (ret) 382 386 goto err1; 383 387 384 - ds1wm_data->clk = clk_get(&pdev->dev, "ds1wm"); 385 - if (IS_ERR(ds1wm_data->clk)) { 386 - ret = PTR_ERR(ds1wm_data->clk); 387 - goto err2; 388 - } 389 - 390 388 ds1wm_up(ds1wm_data); 391 389 392 390 ds1wm_master.data = (void *)ds1wm_data; 393 391 394 392 ret = w1_add_master_device(&ds1wm_master); 395 393 if (ret) 396 - goto err3; 394 + goto err2; 397 395 398 396 return 0; 399 397 400 - err3: 401 - ds1wm_down(ds1wm_data); 402 - clk_put(ds1wm_data->clk); 403 398 err2: 399 + ds1wm_down(ds1wm_data); 404 400 free_irq(ds1wm_data->irq, ds1wm_data); 405 401 err1: 406 402 iounmap(ds1wm_data->map); ··· 431 443 432 444 w1_remove_master_device(&ds1wm_master); 433 445 ds1wm_down(ds1wm_data); 434 - clk_put(ds1wm_data->clk); 435 446 free_irq(ds1wm_data->irq, ds1wm_data); 436 447 iounmap(ds1wm_data->map); 437 448 kfree(ds1wm_data);
+1
include/linux/mfd/ds1wm.h
··· 2 2 3 3 struct ds1wm_driver_data { 4 4 int active_high; 5 + int clock_rate; 5 6 };