deepin-community / kernel-rolling

Kernel source tree for rolling-stable and mainline releases
Other
2 stars 1 forks source link

【6.9】飞腾 PWM 驱动无法构建 #5

Open MingcongBai opened 1 week ago

MingcongBai commented 1 week ago

构建时遇到如下错误:

drivers/pwm/pwm-phytium.c: In function ‘pwm_phytium_free’:
drivers/pwm/pwm-phytium.c:112:31: error: implicit declaration of function ‘pwm_get_chip_data’; did you mean ‘irq_get_chip_data’? [-Werror=implicit-function-declaration]
  112 |         devm_kfree(chip->dev, pwm_get_chip_data(pwm));
      |                               ^~~~~~~~~~~~~~~~~
      |                               irq_get_chip_data
drivers/pwm/pwm-phytium.c:112:31: error: passing argument 2 of ‘devm_kfree’ makes pointer from integer without a cast [-Werror=int-conversion]
  112 |         devm_kfree(chip->dev, pwm_get_chip_data(pwm));
      |                               ^~~~~~~~~~~~~~~~~~~~~~
      |                               |
      |                               int
In file included from ./include/linux/platform_device.h:13,
                 from drivers/pwm/pwm-phytium.c:16:
./include/linux/device.h:341:49: note: expected ‘const void *’ but argument is of type ‘int’
  341 | void devm_kfree(struct device *dev, const void *p);
      |                                     ~~~~~~~~~~~~^
drivers/pwm/pwm-phytium.c:113:9: error: implicit declaration of function ‘pwm_set_chip_data’; did you mean ‘irq_set_chip_data’? [-Werror=implicit-function-declaration]
  113 |         pwm_set_chip_data(pwm, NULL);
      |         ^~~~~~~~~~~~~~~~~
      |         irq_set_chip_data
drivers/pwm/pwm-phytium.c: At top level:
drivers/pwm/pwm-phytium.c:384:10: error: ‘const struct pwm_ops’ has no member named ‘owner’
  384 |         .owner   = THIS_MODULE,
      |          ^~~~~
In file included from ./arch/arm64/include/asm/alternative.h:9,
                 from ./arch/arm64/include/asm/lse.h:14,
                 from ./arch/arm64/include/asm/cmpxchg.h:14,
                 from ./arch/arm64/include/asm/atomic.h:16,
                 from ./include/linux/atomic.h:7,
                 from ./include/asm-generic/bitops/atomic.h:5,
                 from ./arch/arm64/include/asm/bitops.h:25,
                 from ./include/linux/bitops.h:68,
                 from drivers/pwm/pwm-phytium.c:8:
./include/linux/init.h:180:21: error: initialization of ‘int (*)(struct pwm_chip *, struct pwm_device *, struct pwm_state *)’ from incompatible pointer type ‘struct module *’ [-Werror=incompatible-pointer-types]
  180 | #define THIS_MODULE (&__this_module)
      |                     ^
drivers/pwm/pwm-phytium.c:384:20: note: in expansion of macro ‘THIS_MODULE’
  384 |         .owner   = THIS_MODULE,
      |                    ^~~~~~~~~~~
./include/linux/init.h:180:21: note: (near initialization for ‘pwm_phytium_ops.get_state’)
  180 | #define THIS_MODULE (&__this_module)
      |                     ^
drivers/pwm/pwm-phytium.c:384:20: note: in expansion of macro ‘THIS_MODULE’
  384 |         .owner   = THIS_MODULE,
      |                    ^~~~~~~~~~~
drivers/pwm/pwm-phytium.c: In function ‘pwm_phytium_probe’:
drivers/pwm/pwm-phytium.c:462:19: error: ‘struct pwm_chip’ has no member named ‘base’
  462 |         chip->chip.base = -1;
      |                   ^
drivers/pwm/pwm-phytium.c:468:27: error: ‘struct pwm_chip’ has no member named ‘of_pwm_n_cells’
  468 |                 chip->chip.of_pwm_n_cells = 3;
      |                           ^
cc1: all warnings being treated as errors

此处的错误应该是 6.7 前后两个上游更改导致的:

  1. 上游移除了 linux/pwm.hpwm_device->pwm 的定义,提交信息如下:
    pwm: Drop unused member "pwm" from struct pwm_device

    This member is only assigned to and never read. So drop it.

    Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
    Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
  1. 移除了 pwm_[gs]et_chip_data,导致驱动 .free 成员实现无法继续使用
MingcongBai commented 1 week ago

cc @Avenger-285714 @opsiff