| .. | .. |
|---|
| 251 | 251 | MV64XXX_I2C_STATE_WAITING_FOR_ADDR_2_ACK; |
|---|
| 252 | 252 | break; |
|---|
| 253 | 253 | } |
|---|
| 254 | | - /* FALLTHRU */ |
|---|
| 254 | + fallthrough; |
|---|
| 255 | 255 | case MV64XXX_I2C_STATUS_MAST_WR_ADDR_2_ACK: /* 0xd0 */ |
|---|
| 256 | 256 | case MV64XXX_I2C_STATUS_MAST_WR_ACK: /* 0x28 */ |
|---|
| 257 | 257 | if ((drv_data->bytes_left == 0) |
|---|
| .. | .. |
|---|
| 282 | 282 | MV64XXX_I2C_STATE_WAITING_FOR_ADDR_2_ACK; |
|---|
| 283 | 283 | break; |
|---|
| 284 | 284 | } |
|---|
| 285 | | - /* FALLTHRU */ |
|---|
| 285 | + fallthrough; |
|---|
| 286 | 286 | case MV64XXX_I2C_STATUS_MAST_RD_ADDR_2_ACK: /* 0xe0 */ |
|---|
| 287 | 287 | if (drv_data->bytes_left == 0) { |
|---|
| 288 | 288 | drv_data->action = MV64XXX_I2C_ACTION_SEND_STOP; |
|---|
| 289 | 289 | drv_data->state = MV64XXX_I2C_STATE_IDLE; |
|---|
| 290 | 290 | break; |
|---|
| 291 | 291 | } |
|---|
| 292 | | - /* FALLTHRU */ |
|---|
| 292 | + fallthrough; |
|---|
| 293 | 293 | case MV64XXX_I2C_STATUS_MAST_RD_DATA_ACK: /* 0x50 */ |
|---|
| 294 | 294 | if (status != MV64XXX_I2C_STATUS_MAST_RD_DATA_ACK) |
|---|
| 295 | 295 | drv_data->action = MV64XXX_I2C_ACTION_CONTINUE; |
|---|
| .. | .. |
|---|
| 417 | 417 | "mv64xxx_i2c_do_action: Invalid action: %d\n", |
|---|
| 418 | 418 | drv_data->action); |
|---|
| 419 | 419 | drv_data->rc = -EIO; |
|---|
| 420 | | - |
|---|
| 421 | | - /* FALLTHRU */ |
|---|
| 420 | + fallthrough; |
|---|
| 422 | 421 | case MV64XXX_I2C_ACTION_SEND_STOP: |
|---|
| 423 | 422 | drv_data->cntl_bits &= ~MV64XXX_I2C_REG_CONTROL_INTEN; |
|---|
| 424 | 423 | writel(drv_data->cntl_bits | MV64XXX_I2C_REG_CONTROL_STOP, |
|---|
| .. | .. |
|---|
| 497 | 496 | mv64xxx_i2c_intr(int irq, void *dev_id) |
|---|
| 498 | 497 | { |
|---|
| 499 | 498 | struct mv64xxx_i2c_data *drv_data = dev_id; |
|---|
| 500 | | - unsigned long flags; |
|---|
| 501 | 499 | u32 status; |
|---|
| 502 | 500 | irqreturn_t rc = IRQ_NONE; |
|---|
| 503 | 501 | |
|---|
| 504 | | - spin_lock_irqsave(&drv_data->lock, flags); |
|---|
| 502 | + spin_lock(&drv_data->lock); |
|---|
| 505 | 503 | |
|---|
| 506 | 504 | if (drv_data->offload_enabled) |
|---|
| 507 | 505 | rc = mv64xxx_i2c_intr_offload(drv_data); |
|---|
| .. | .. |
|---|
| 518 | 516 | |
|---|
| 519 | 517 | rc = IRQ_HANDLED; |
|---|
| 520 | 518 | } |
|---|
| 521 | | - spin_unlock_irqrestore(&drv_data->lock, flags); |
|---|
| 519 | + spin_unlock(&drv_data->lock); |
|---|
| 522 | 520 | |
|---|
| 523 | 521 | return rc; |
|---|
| 524 | 522 | } |
|---|
| .. | .. |
|---|
| 810 | 808 | tclk = clk_get_rate(drv_data->clk); |
|---|
| 811 | 809 | |
|---|
| 812 | 810 | if (of_property_read_u32(np, "clock-frequency", &bus_freq)) |
|---|
| 813 | | - bus_freq = 100000; /* 100kHz by default */ |
|---|
| 811 | + bus_freq = I2C_MAX_STANDARD_MODE_FREQ; /* 100kHz by default */ |
|---|
| 814 | 812 | |
|---|
| 815 | 813 | if (of_device_is_compatible(np, "allwinner,sun4i-a10-i2c") || |
|---|
| 816 | 814 | of_device_is_compatible(np, "allwinner,sun6i-a31-i2c")) |
|---|
| .. | .. |
|---|
| 846 | 844 | if (of_device_is_compatible(np, "marvell,mv78230-i2c")) { |
|---|
| 847 | 845 | drv_data->offload_enabled = true; |
|---|
| 848 | 846 | /* The delay is only needed in standard mode (100kHz) */ |
|---|
| 849 | | - if (bus_freq <= 100000) |
|---|
| 847 | + if (bus_freq <= I2C_MAX_STANDARD_MODE_FREQ) |
|---|
| 850 | 848 | drv_data->errata_delay = true; |
|---|
| 851 | 849 | } |
|---|
| 852 | 850 | |
|---|
| 853 | 851 | if (of_device_is_compatible(np, "marvell,mv78230-a0-i2c")) { |
|---|
| 854 | 852 | drv_data->offload_enabled = false; |
|---|
| 855 | 853 | /* The delay is only needed in standard mode (100kHz) */ |
|---|
| 856 | | - if (bus_freq <= 100000) |
|---|
| 854 | + if (bus_freq <= I2C_MAX_STANDARD_MODE_FREQ) |
|---|
| 857 | 855 | drv_data->errata_delay = true; |
|---|
| 858 | 856 | } |
|---|
| 859 | 857 | |
|---|
| .. | .. |
|---|
| 877 | 875 | { |
|---|
| 878 | 876 | struct mv64xxx_i2c_data *drv_data; |
|---|
| 879 | 877 | struct mv64xxx_i2c_pdata *pdata = dev_get_platdata(&pd->dev); |
|---|
| 880 | | - struct resource *r; |
|---|
| 881 | 878 | int rc; |
|---|
| 882 | 879 | |
|---|
| 883 | 880 | if ((!pdata && !pd->dev.of_node)) |
|---|
| .. | .. |
|---|
| 888 | 885 | if (!drv_data) |
|---|
| 889 | 886 | return -ENOMEM; |
|---|
| 890 | 887 | |
|---|
| 891 | | - r = platform_get_resource(pd, IORESOURCE_MEM, 0); |
|---|
| 892 | | - drv_data->reg_base = devm_ioremap_resource(&pd->dev, r); |
|---|
| 888 | + drv_data->reg_base = devm_platform_ioremap_resource(pd, 0); |
|---|
| 893 | 889 | if (IS_ERR(drv_data->reg_base)) |
|---|
| 894 | 890 | return PTR_ERR(drv_data->reg_base); |
|---|
| 895 | 891 | |
|---|
| .. | .. |
|---|
| 901 | 897 | |
|---|
| 902 | 898 | /* Not all platforms have clocks */ |
|---|
| 903 | 899 | drv_data->clk = devm_clk_get(&pd->dev, NULL); |
|---|
| 904 | | - if (IS_ERR(drv_data->clk) && PTR_ERR(drv_data->clk) == -EPROBE_DEFER) |
|---|
| 900 | + if (PTR_ERR(drv_data->clk) == -EPROBE_DEFER) |
|---|
| 905 | 901 | return -EPROBE_DEFER; |
|---|
| 906 | 902 | if (!IS_ERR(drv_data->clk)) |
|---|
| 907 | 903 | clk_prepare_enable(drv_data->clk); |
|---|
| 908 | 904 | |
|---|
| 909 | 905 | drv_data->reg_clk = devm_clk_get(&pd->dev, "reg"); |
|---|
| 910 | | - if (IS_ERR(drv_data->reg_clk) && |
|---|
| 911 | | - PTR_ERR(drv_data->reg_clk) == -EPROBE_DEFER) |
|---|
| 906 | + if (PTR_ERR(drv_data->reg_clk) == -EPROBE_DEFER) |
|---|
| 912 | 907 | return -EPROBE_DEFER; |
|---|
| 913 | 908 | if (!IS_ERR(drv_data->reg_clk)) |
|---|
| 914 | 909 | clk_prepare_enable(drv_data->reg_clk); |
|---|