mbox series

[0/8] clk: sunxi-ng: Lifetime fixes and module support

Message ID 20210901050526.45673-1-samuel@sholland.org (mailing list archive)
Headers show
Series clk: sunxi-ng: Lifetime fixes and module support | expand

Message

Samuel Holland Sept. 1, 2021, 5:05 a.m. UTC
This series makes the CCU drivers a bit better behaved, by allowing them
to be cleanly loaded/unloaded and bound/unbound without leaking memory
or crashing.

- Patches 1 fixes some object lifetime and reference counting issues
  with the drivers.
- Patch 2 disarms a sysfs footgun.
- Patch 3 takes advantage of the structure added in patch 1 to improve
  performance a bit by splitting up the lock.
- Patches 4-8 allow the drivers and CCU core to be built as modules.
  As part of this, patch 7 converts most of the early OF providers to
  platform drivers.

Samuel Holland (8):
  clk: sunxi-ng: Unregister clocks/resets when unbinding
  clk: sunxi-ng: Prevent unbinding CCUs via sysfs
  clk: sunxi-ng: Use a separate lock for each CCU instance
  clk: sunxi-ng: Rename files to match Kconfig and drivers
  clk: sunxi-ng: Export symbols used by CCU drivers
  clk: sunxi-ng: Allow drivers to be built as modules
  clk: sunxi-ng: Convert early providers to platform drivers
  clk: sunxi-ng: Allow the CCU core to be built as a module

 drivers/clk/Makefile                          |   2 +-
 drivers/clk/sunxi-ng/Kconfig                  |  39 +++----
 drivers/clk/sunxi-ng/Makefile                 |  75 ++++++-------
 drivers/clk/sunxi-ng/ccu_common.c             | 101 +++++++++++++++---
 drivers/clk/sunxi-ng/ccu_common.h             |   6 +-
 drivers/clk/sunxi-ng/ccu_div.c                |   1 +
 drivers/clk/sunxi-ng/ccu_gate.c               |   1 +
 drivers/clk/sunxi-ng/ccu_mp.c                 |   2 +
 drivers/clk/sunxi-ng/ccu_mult.c               |   1 +
 drivers/clk/sunxi-ng/ccu_mux.c                |   2 +
 drivers/clk/sunxi-ng/ccu_nk.c                 |   1 +
 drivers/clk/sunxi-ng/ccu_nkm.c                |   1 +
 drivers/clk/sunxi-ng/ccu_nkmp.c               |   1 +
 drivers/clk/sunxi-ng/ccu_nm.c                 |   1 +
 drivers/clk/sunxi-ng/ccu_phase.c              |   1 +
 drivers/clk/sunxi-ng/ccu_reset.c              |   1 +
 .../{ccu-sun4i-a10.c => sun4i-a10-ccu.c}      |  59 ++++++----
 .../{ccu-sun4i-a10.h => sun4i-a10-ccu.h}      |   0
 .../{ccu-sun50i-a100.c => sun50i-a100-ccu.c}  |   8 +-
 .../{ccu-sun50i-a100.h => sun50i-a100-ccu.h}  |   0
 ...cu-sun50i-a100-r.c => sun50i-a100-r-ccu.c} |   8 +-
 ...cu-sun50i-a100-r.h => sun50i-a100-r-ccu.h} |   0
 .../{ccu-sun50i-a64.c => sun50i-a64-ccu.c}    |  11 +-
 .../{ccu-sun50i-a64.h => sun50i-a64-ccu.h}    |   0
 .../{ccu-sun50i-h6.c => sun50i-h6-ccu.c}      |  11 +-
 .../{ccu-sun50i-h6.h => sun50i-h6-ccu.h}      |   0
 .../{ccu-sun50i-h6-r.c => sun50i-h6-r-ccu.c}  |  57 ++++++----
 .../{ccu-sun50i-h6-r.h => sun50i-h6-r-ccu.h}  |   0
 .../{ccu-sun50i-h616.c => sun50i-h616-ccu.c}  |  36 ++++---
 .../{ccu-sun50i-h616.h => sun50i-h616-ccu.h}  |   0
 .../clk/sunxi-ng/{ccu-sun5i.c => sun5i-ccu.c} |   4 +-
 .../clk/sunxi-ng/{ccu-sun5i.h => sun5i-ccu.h} |   0
 .../{ccu-sun6i-a31.c => sun6i-a31-ccu.c}      |  41 +++++--
 .../{ccu-sun6i-a31.h => sun6i-a31-ccu.h}      |   0
 ...cu-sun8i-a23-a33.h => sun8i-a23-a33-ccu.h} |   0
 .../{ccu-sun8i-a23.c => sun8i-a23-ccu.c}      |  36 +++++--
 .../{ccu-sun8i-a33.c => sun8i-a33-ccu.c}      |  41 +++++--
 .../{ccu-sun8i-a83t.c => sun8i-a83t-ccu.c}    |  11 +-
 .../{ccu-sun8i-a83t.h => sun8i-a83t-ccu.h}    |   0
 .../{ccu-sun8i-de2.c => sun8i-de2-ccu.c}      |  12 ++-
 .../{ccu-sun8i-de2.h => sun8i-de2-ccu.h}      |   0
 .../{ccu-sun8i-h3.c => sun8i-h3-ccu.c}        |  63 +++++++----
 .../{ccu-sun8i-h3.h => sun8i-h3-ccu.h}        |   0
 .../sunxi-ng/{ccu-sun8i-r.c => sun8i-r-ccu.c} |  66 +++++++-----
 .../sunxi-ng/{ccu-sun8i-r.h => sun8i-r-ccu.h} |   0
 .../{ccu-sun8i-r40.c => sun8i-r40-ccu.c}      |  10 +-
 .../{ccu-sun8i-r40.h => sun8i-r40-ccu.h}      |   0
 .../{ccu-sun8i-v3s.c => sun8i-v3s-ccu.c}      |  58 ++++++----
 .../{ccu-sun8i-v3s.h => sun8i-v3s-ccu.h}      |   0
 .../{ccu-sun9i-a80.c => sun9i-a80-ccu.c}      |  11 +-
 .../{ccu-sun9i-a80.h => sun9i-a80-ccu.h}      |   0
 ...{ccu-sun9i-a80-de.c => sun9i-a80-de-ccu.c} |  12 ++-
 ...{ccu-sun9i-a80-de.h => sun9i-a80-de-ccu.h} |   0
 ...cu-sun9i-a80-usb.c => sun9i-a80-usb-ccu.c} |  11 +-
 ...cu-sun9i-a80-usb.h => sun9i-a80-usb-ccu.h} |   0
 ...cu-suniv-f1c100s.c => suniv-f1c100s-ccu.c} |  39 +++++--
 ...cu-suniv-f1c100s.h => suniv-f1c100s-ccu.h} |   0
 drivers/mmc/host/Kconfig                      |   1 +
 include/linux/clk/sunxi-ng.h                  |  15 ---
 59 files changed, 551 insertions(+), 306 deletions(-)
 rename drivers/clk/sunxi-ng/{ccu-sun4i-a10.c => sun4i-a10-ccu.c} (98%)
 rename drivers/clk/sunxi-ng/{ccu-sun4i-a10.h => sun4i-a10-ccu.h} (100%)
 rename drivers/clk/sunxi-ng/{ccu-sun50i-a100.c => sun50i-a100-ccu.c} (99%)
 rename drivers/clk/sunxi-ng/{ccu-sun50i-a100.h => sun50i-a100-ccu.h} (100%)
 rename drivers/clk/sunxi-ng/{ccu-sun50i-a100-r.c => sun50i-a100-r-ccu.c} (97%)
 rename drivers/clk/sunxi-ng/{ccu-sun50i-a100-r.h => sun50i-a100-r-ccu.h} (100%)
 rename drivers/clk/sunxi-ng/{ccu-sun50i-a64.c => sun50i-a64-ccu.c} (99%)
 rename drivers/clk/sunxi-ng/{ccu-sun50i-a64.h => sun50i-a64-ccu.h} (100%)
 rename drivers/clk/sunxi-ng/{ccu-sun50i-h6.c => sun50i-h6-ccu.c} (99%)
 rename drivers/clk/sunxi-ng/{ccu-sun50i-h6.h => sun50i-h6-ccu.h} (100%)
 rename drivers/clk/sunxi-ng/{ccu-sun50i-h6-r.c => sun50i-h6-r-ccu.c} (87%)
 rename drivers/clk/sunxi-ng/{ccu-sun50i-h6-r.h => sun50i-h6-r-ccu.h} (100%)
 rename drivers/clk/sunxi-ng/{ccu-sun50i-h616.c => sun50i-h616-ccu.c} (98%)
 rename drivers/clk/sunxi-ng/{ccu-sun50i-h616.h => sun50i-h616-ccu.h} (100%)
 rename drivers/clk/sunxi-ng/{ccu-sun5i.c => sun5i-ccu.c} (99%)
 rename drivers/clk/sunxi-ng/{ccu-sun5i.h => sun5i-ccu.h} (100%)
 rename drivers/clk/sunxi-ng/{ccu-sun6i-a31.c => sun6i-a31-ccu.c} (98%)
 rename drivers/clk/sunxi-ng/{ccu-sun6i-a31.h => sun6i-a31-ccu.h} (100%)
 rename drivers/clk/sunxi-ng/{ccu-sun8i-a23-a33.h => sun8i-a23-a33-ccu.h} (100%)
 rename drivers/clk/sunxi-ng/{ccu-sun8i-a23.c => sun8i-a23-ccu.c} (97%)
 rename drivers/clk/sunxi-ng/{ccu-sun8i-a33.c => sun8i-a33-ccu.c} (97%)
 rename drivers/clk/sunxi-ng/{ccu-sun8i-a83t.c => sun8i-a83t-ccu.c} (99%)
 rename drivers/clk/sunxi-ng/{ccu-sun8i-a83t.h => sun8i-a83t-ccu.h} (100%)
 rename drivers/clk/sunxi-ng/{ccu-sun8i-de2.c => sun8i-de2-ccu.c} (98%)
 rename drivers/clk/sunxi-ng/{ccu-sun8i-de2.h => sun8i-de2-ccu.h} (100%)
 rename drivers/clk/sunxi-ng/{ccu-sun8i-h3.c => sun8i-h3-ccu.c} (97%)
 rename drivers/clk/sunxi-ng/{ccu-sun8i-h3.h => sun8i-h3-ccu.h} (100%)
 rename drivers/clk/sunxi-ng/{ccu-sun8i-r.c => sun8i-r-ccu.c} (87%)
 rename drivers/clk/sunxi-ng/{ccu-sun8i-r.h => sun8i-r-ccu.h} (100%)
 rename drivers/clk/sunxi-ng/{ccu-sun8i-r40.c => sun8i-r40-ccu.c} (99%)
 rename drivers/clk/sunxi-ng/{ccu-sun8i-r40.h => sun8i-r40-ccu.h} (100%)
 rename drivers/clk/sunxi-ng/{ccu-sun8i-v3s.c => sun8i-v3s-ccu.c} (96%)
 rename drivers/clk/sunxi-ng/{ccu-sun8i-v3s.h => sun8i-v3s-ccu.h} (100%)
 rename drivers/clk/sunxi-ng/{ccu-sun9i-a80.c => sun9i-a80-ccu.c} (99%)
 rename drivers/clk/sunxi-ng/{ccu-sun9i-a80.h => sun9i-a80-ccu.h} (100%)
 rename drivers/clk/sunxi-ng/{ccu-sun9i-a80-de.c => sun9i-a80-de-ccu.c} (97%)
 rename drivers/clk/sunxi-ng/{ccu-sun9i-a80-de.h => sun9i-a80-de-ccu.h} (100%)
 rename drivers/clk/sunxi-ng/{ccu-sun9i-a80-usb.c => sun9i-a80-usb-ccu.c} (95%)
 rename drivers/clk/sunxi-ng/{ccu-sun9i-a80-usb.h => sun9i-a80-usb-ccu.h} (100%)
 rename drivers/clk/sunxi-ng/{ccu-suniv-f1c100s.c => suniv-f1c100s-ccu.c} (96%)
 rename drivers/clk/sunxi-ng/{ccu-suniv-f1c100s.h => suniv-f1c100s-ccu.h} (100%)