diff options
Diffstat (limited to 'drivers/mfd/rave-sp.c')
-rw-r--r-- | drivers/mfd/rave-sp.c | 44 |
1 files changed, 20 insertions, 24 deletions
diff --git a/drivers/mfd/rave-sp.c b/drivers/mfd/rave-sp.c index 67f7d4c654..c7968b75f5 100644 --- a/drivers/mfd/rave-sp.c +++ b/drivers/mfd/rave-sp.c @@ -1,4 +1,4 @@ -// SPDX-License-Identifier: GPL-2.0+ +// SPDX-License-Identifier: GPL-2.0-or-later /* * Multifunction core driver for Zodiac Inflight Innovations RAVE @@ -185,7 +185,7 @@ struct rave_sp_variant { * @part_number_bootloader: Bootloader version */ struct rave_sp { - struct device_d dev; + struct device dev; struct serdev_device *serdev; struct rave_sp_deframer deframer; unsigned int ackid; @@ -269,9 +269,8 @@ static int rave_sp_write(struct rave_sp *sp, const u8 *data, u8 data_size) length = dest - frame; - if (IS_ENABLED(DEBUG)) - print_hex_dump(0, "rave-sp tx: ", DUMP_PREFIX_NONE, - 16, 1, frame, length, false); + print_hex_dump_debug("rave-sp tx: ", DUMP_PREFIX_NONE, 16, 1, + frame, length, false); return serdev_device_write(sp->serdev, frame, length, SECOND); } @@ -311,7 +310,7 @@ int rave_sp_exec(struct rave_sp *sp, void *__data, size_t data_size, void *reply_data, size_t reply_data_size) { - struct device_d *dev = sp->serdev->dev; + struct device *dev = sp->serdev->dev; struct rave_sp_reply reply = { .data = reply_data, .length = reply_data_size, @@ -367,7 +366,7 @@ static void rave_sp_receive_event(struct rave_sp *sp, static void rave_sp_receive_reply(struct rave_sp *sp, const unsigned char *data, size_t length) { - struct device_d *dev = sp->serdev->dev; + struct device *dev = sp->serdev->dev; struct rave_sp_reply *reply; const size_t payload_length = length - 2; @@ -403,12 +402,11 @@ static void rave_sp_receive_frame(struct rave_sp *sp, const size_t checksum_length = sp->variant->checksum->length; const size_t payload_length = length - checksum_length; const u8 *crc_reported = &data[payload_length]; - struct device_d *dev = sp->serdev->dev; + struct device *dev = sp->serdev->dev; u8 crc_calculated[checksum_length]; - if (IS_ENABLED(DEBUG)) - print_hex_dump(0, "rave-sp rx: ", DUMP_PREFIX_NONE, - 16, 1, data, length, false); + print_hex_dump_debug("rave-sp rx: ", DUMP_PREFIX_NONE, 16, 1, + data, length, false); if (unlikely(length <= checksum_length)) { dev_warn(dev, "Dropping short frame\n"); @@ -432,7 +430,7 @@ static void rave_sp_receive_frame(struct rave_sp *sp, static int rave_sp_receive_buf(struct serdev_device *serdev, const unsigned char *buf, size_t size) { - struct device_d *dev = serdev->dev; + struct device *dev = serdev->dev; struct rave_sp *sp = dev->priv; struct rave_sp_deframer *deframer = &sp->deframer; const unsigned char *src = buf; @@ -605,7 +603,7 @@ static int rave_sp_default_cmd_translate(enum rave_sp_command command) } } -static const char *devm_rave_sp_version(struct device_d *dev, +static const char *devm_rave_sp_version(struct device *dev, struct rave_sp_version *version) { /* @@ -661,14 +659,14 @@ static int rave_sp_emulated_get_status(struct rave_sp *sp, return ret; status->general_status = - firmware_mode ? RAVE_SP_STATUS_GS_FIRMWARE_MODE : 0; + firmware_mode ? 0 : RAVE_SP_STATUS_GS_FIRMWARE_MODE; return 0; } static int rave_sp_get_status(struct rave_sp *sp) { - struct device_d *dev = sp->serdev->dev; + struct device *dev = sp->serdev->dev; struct rave_sp_status status; const char *mode; int ret; @@ -733,6 +731,7 @@ static const struct of_device_id __maybe_unused rave_sp_dt_ids[] = { { .compatible = "zii,rave-sp-rdu2", .data = &rave_sp_rdu2 }, { /* sentinel */ } }; +MODULE_DEVICE_TABLE(of, rave_sp_dt_ids); static int rave_sp_req_ip_addr(struct param_d *p, void *context) { @@ -768,7 +767,7 @@ static int rave_sp_req_ip_addr(struct param_d *p, void *context) static int rave_sp_add_params(struct rave_sp *sp) { - struct device_d *dev = &sp->dev; + struct device *dev = &sp->dev; struct param_d *p; int ret; @@ -787,20 +786,17 @@ static int rave_sp_add_params(struct rave_sp *sp) p = dev_add_param_ip(dev, "netmask", NULL, rave_sp_req_ip_addr, &sp->netmask, sp); - if (IS_ERR(p)) - return PTR_ERR(p); - - return 0; + return PTR_ERR_OR_ZERO(p); } -static int rave_sp_probe(struct device_d *dev) +static int rave_sp_probe(struct device *dev) { struct serdev_device *serdev = to_serdev_device(dev->parent); struct rave_sp *sp; u32 baud; int ret; - if (of_property_read_u32(dev->device_node, "current-speed", &baud)) { + if (of_property_read_u32(dev->of_node, "current-speed", &baud)) { dev_err(dev, "'current-speed' is not specified in device node\n"); return -EINVAL; @@ -855,10 +851,10 @@ static int rave_sp_probe(struct device_d *dev) return ret; } - return of_platform_populate(dev->device_node, NULL, dev); + return of_platform_populate(dev->of_node, NULL, dev); } -static struct driver_d rave_sp_drv = { +static struct driver rave_sp_drv = { .name = "rave-sp", .probe = rave_sp_probe, .of_compatible = DRV_OF_COMPAT(rave_sp_dt_ids), |