Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

drivers: usb_c: Place API into iterable section #82285

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion drivers/usb_c/ppc/nxp_nx20p3483.c
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ static int nx20p3483_dump_regs(const struct device *dev)
return 0;
}

static struct usbc_ppc_driver_api nx20p3483_driver_api = {
static DEVICE_API(usbc_ppc, nx20p3483_driver_api) = {
.is_dead_battery_mode = nx20p3483_is_dead_battery_mode,
.exit_dead_battery_mode = nx20p3483_exit_dead_battery_mode,
.is_vbus_source = nx20p3483_is_vbus_source,
Expand Down
2 changes: 1 addition & 1 deletion drivers/usb_c/ppc/usbc_ppc_numaker.c
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ static int numaker_ppc_dump_regs(const struct device *dev)
return numaker_tcpc_ppc_dump_regs(tcpc_dev);
}

static const struct usbc_ppc_driver_api numaker_ppc_driver_api = {
static DEVICE_API(usbc_ppc, numaker_ppc_driver_api) = {
.is_dead_battery_mode = numaker_ppc_is_dead_battery_mode,
.exit_dead_battery_mode = numaker_ppc_exit_dead_battery_mode,
.is_vbus_source = numaker_ppc_is_vbus_source,
Expand Down
2 changes: 1 addition & 1 deletion drivers/usb_c/tcpc/ps8xxx.c
Original file line number Diff line number Diff line change
Expand Up @@ -543,7 +543,7 @@ int ps8xxx_tcpc_set_alert_handler_cb(const struct device *dev, tcpc_alert_handle

/* Functions not assigned to the driver API but used by device */

static const struct tcpc_driver_api ps8xxx_driver_api = {
static DEVICE_API(tcpc, ps8xxx_driver_api) = {
.init = ps8xxx_tcpc_init,
.get_cc = ps8xxx_tcpc_get_cc,
.select_rp_value = ps8xxx_tcpc_select_rp_value,
Expand Down
2 changes: 1 addition & 1 deletion drivers/usb_c/tcpc/ucpd_numaker.c
Original file line number Diff line number Diff line change
Expand Up @@ -2304,7 +2304,7 @@ int numaker_tcpc_vbus_enable(const struct device *dev, bool enable)

/* End of "*_tcpc_vbus_*" functions */

static const struct tcpc_driver_api numaker_tcpc_driver_api = {
static DEVICE_API(tcpc, numaker_tcpc_driver_api) = {
.init = numaker_tcpc_init_recycle,
.get_cc = numaker_tcpc_get_cc,
.select_rp_value = numaker_tcpc_select_rp_value,
Expand Down
2 changes: 1 addition & 1 deletion drivers/usb_c/tcpc/ucpd_stm32.c
Original file line number Diff line number Diff line change
Expand Up @@ -1418,7 +1418,7 @@ static int ucpd_init(const struct device *dev)
return 0;
}

static const struct tcpc_driver_api driver_api = {
static DEVICE_API(tcpc, driver_api) = {
.init = ucpd_init,
.set_alert_handler_cb = ucpd_set_alert_handler_cb,
.get_cc = ucpd_get_cc,
Expand Down
2 changes: 1 addition & 1 deletion drivers/usb_c/vbus/usbc_vbus_adc.c
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ static int adc_vbus_init(const struct device *dev)
return 0;
}

static const struct usbc_vbus_driver_api driver_api = {
static DEVICE_API(usbc_vbus, driver_api) = {
.measure = adc_vbus_measure,
.check_level = adc_vbus_check_level,
.discharge = adc_vbus_discharge,
Expand Down
2 changes: 1 addition & 1 deletion drivers/usb_c/vbus/usbc_vbus_numaker.c
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ static int numaker_vbus_enable(const struct device *dev, bool enable)
return numaker_tcpc_vbus_enable(tcpc_dev, enable);
}

static const struct usbc_vbus_driver_api numaker_vbus_driver_api = {
static DEVICE_API(usbc_vbus, numaker_vbus_driver_api) = {
.check_level = numaker_vbus_check_level,
.measure = numaker_vbus_measure,
.discharge = numaker_vbus_discharge,
Expand Down
10 changes: 6 additions & 4 deletions drivers/usb_c/vbus/usbc_vbus_tcpci.c
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,12 @@ static int tcpci_enable(const struct device *dev, bool enable)
(enable) ? 0 : TCPC_REG_POWER_CTRL_VBUS_VOL_MONITOR_DIS);
}

static const struct usbc_vbus_driver_api vbus_tcpci_api = {.measure = tcpci_measure,
.check_level = tcpci_check_level,
.discharge = tcpci_discharge,
.enable = tcpci_enable};
static DEVICE_API(usbc_vbus, vbus_tcpci_api) = {
.measure = tcpci_measure,
.check_level = tcpci_check_level,
.discharge = tcpci_discharge,
.enable = tcpci_enable,
};

static int tcpci_init(const struct device *dev)
{
Expand Down
Loading