Now that device_api attribute is unmodified at runtime, as well as all the other attributes, it is possible to switch all device driver instance to be constant. A coccinelle rule is used for this: @r_const_dev_1 disable optional_qualifier @ @@ -struct device * +const struct device * @r_const_dev_2 disable optional_qualifier @ @@ -struct device * const +const struct device * Fixes #27399 Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
47 lines
1.2 KiB
C
47 lines
1.2 KiB
C
/*
|
|
* Copyright (c) 2017, NXP
|
|
*
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
*/
|
|
|
|
#include <init.h>
|
|
#include <drivers/pinmux.h>
|
|
#include <fsl_port.h>
|
|
|
|
static int hexiwear_kw40z_pinmux_init(const struct device *dev)
|
|
{
|
|
ARG_UNUSED(dev);
|
|
|
|
#ifdef CONFIG_PINMUX_MCUX_PORTB
|
|
const struct device *portb =
|
|
device_get_binding(CONFIG_PINMUX_MCUX_PORTB_NAME);
|
|
#endif
|
|
|
|
#ifdef CONFIG_PINMUX_MCUX_PORTC
|
|
const struct device *portc =
|
|
device_get_binding(CONFIG_PINMUX_MCUX_PORTC_NAME);
|
|
#endif
|
|
|
|
#if DT_NODE_HAS_STATUS(DT_NODELABEL(lpuart0), okay) && CONFIG_SERIAL
|
|
/* UART0 RX, TX */
|
|
pinmux_pin_set(portc, 6, PORT_PCR_MUX(kPORT_MuxAlt4));
|
|
pinmux_pin_set(portc, 7, PORT_PCR_MUX(kPORT_MuxAlt4));
|
|
#endif
|
|
|
|
#if DT_NODE_HAS_STATUS(DT_NODELABEL(i2c1), okay) && CONFIG_I2C
|
|
/* I2C1 SCL, SDA */
|
|
pinmux_pin_set(portc, 6, PORT_PCR_MUX(kPORT_MuxAlt3)
|
|
| PORT_PCR_PS_MASK);
|
|
pinmux_pin_set(portc, 6, PORT_PCR_MUX(kPORT_MuxAlt3)
|
|
| PORT_PCR_PS_MASK);
|
|
#endif
|
|
|
|
#if DT_NODE_HAS_STATUS(DT_NODELABEL(adc0), okay) && CONFIG_ADC
|
|
/* ADC0_SE1 */
|
|
pinmux_pin_set(portb, 1, PORT_PCR_MUX(kPORT_PinDisabledOrAnalog));
|
|
#endif
|
|
|
|
return 0;
|
|
}
|
|
|
|
SYS_INIT(hexiwear_kw40z_pinmux_init, PRE_KERNEL_1, CONFIG_PINMUX_INIT_PRIORITY);
|