From ba0276b57251ca2edbd52be66662e3f7069cb6e1 Mon Sep 17 00:00:00 2001 From: Shashikala Prabhu Date: Fri, 17 Jul 2020 12:58:53 +0530 Subject: [PATCH] qcacmn: Correct the return types of functions in HIF component A few functions in HIF component returns QDF status value with return type as non QDF STATUS and vice versa. For such functions, update the correct return type. Change-Id: I806407dd0596cd03500242d97ca8220a7beb6c55 CRs-Fixed: 2734818 --- hif/inc/hif.h | 5 +-- hif/src/ce/ce_main.c | 4 ++- hif/src/hif_runtime_pm.c | 4 ++- hif/src/sdio/if_sdio.c | 5 ++- hif/src/sdio/if_sdio.h | 18 ++++++++--- hif/src/sdio/native_sdio/src/dev_quirks.c | 33 ++++++++++++-------- hif/src/sdio/native_sdio/src/hif.c | 38 ++++++++++++----------- hif/src/sdio/transfer/adma.c | 4 +-- hif/src/sdio/transfer/mailbox.c | 12 +++---- hif/src/snoc/if_snoc.c | 4 +-- hif/src/usb/if_usb.c | 4 +-- 11 files changed, 77 insertions(+), 54 deletions(-) diff --git a/hif/inc/hif.h b/hif/inc/hif.h index 57016d6610..9fc57b5587 100644 --- a/hif/inc/hif.h +++ b/hif/inc/hif.h @@ -426,8 +426,9 @@ static inline void hif_record_event(struct hif_opaque_softc *hif_ctx, event.tp = tp; event.type = type; - return hif_hist_record_event(hif_ctx, &event, - intr_grp_id); + hif_hist_record_event(hif_ctx, &event, intr_grp_id); + + return; } #else diff --git a/hif/src/ce/ce_main.c b/hif/src/ce/ce_main.c index b697336e31..a343fd8a20 100644 --- a/hif/src/ce/ce_main.c +++ b/hif/src/ce/ce_main.c @@ -1168,8 +1168,10 @@ static void hif_prepare_hal_shadow_register_cfg(struct hif_softc *scn, int *num_shadow_registers_configured) { struct HIF_CE_state *hif_state = HIF_GET_CE_STATE(scn); - return hif_state->ce_services->ce_prepare_shadow_register_v2_cfg( + hif_state->ce_services->ce_prepare_shadow_register_v2_cfg( scn, shadow_config, num_shadow_registers_configured); + + return; } static inline uint32_t ce_get_desc_size(struct hif_softc *scn, diff --git a/hif/src/hif_runtime_pm.c b/hif/src/hif_runtime_pm.c index 86fb595b6f..1a65a6e9a4 100644 --- a/hif/src/hif_runtime_pm.c +++ b/hif/src/hif_runtime_pm.c @@ -1077,7 +1077,9 @@ void hif_pm_runtime_mark_last_busy(struct hif_opaque_softc *hif_ctx) rpm_ctx->pm_stats.last_busy_marker = (void *)_RET_IP_; rpm_ctx->pm_stats.last_busy_timestamp = qdf_get_log_timestamp_usecs(); - return pm_runtime_mark_last_busy(hif_bus_get_dev(scn)); + pm_runtime_mark_last_busy(hif_bus_get_dev(scn)); + + return; } /** diff --git a/hif/src/sdio/if_sdio.c b/hif/src/sdio/if_sdio.c index 102b84d09f..6a6918f387 100644 --- a/hif/src/sdio/if_sdio.c +++ b/hif/src/sdio/if_sdio.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013-2019 The Linux Foundation. All rights reserved. + * Copyright (c) 2013-2020 The Linux Foundation. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for * any purpose with or without fee is hereby granted, provided that the @@ -159,7 +159,6 @@ QDF_STATUS hif_sdio_enable_bus(struct hif_softc *ol_sc, struct device *dev, void *bdev, const struct hif_bus_id *bid, enum hif_enable_type type) { - int ret = 0; const struct sdio_device_id *id = (const struct sdio_device_id *)bid; if (hif_sdio_device_inserted(ol_sc, dev, id)) { @@ -167,7 +166,7 @@ QDF_STATUS hif_sdio_enable_bus(struct hif_softc *ol_sc, struct device *dev, return QDF_STATUS_E_NOMEM; } - return ret; + return QDF_STATUS_SUCCESS; } diff --git a/hif/src/sdio/if_sdio.h b/hif/src/sdio/if_sdio.h index 191ea615ec..a71e61ecb3 100644 --- a/hif/src/sdio/if_sdio.h +++ b/hif/src/sdio/if_sdio.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013-2019 The Linux Foundation. All rights reserved. + * Copyright (c) 2013-2020 The Linux Foundation. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for * any purpose with or without fee is hereby granted, provided that the @@ -78,9 +78,19 @@ int ath_sdio_resume(void *context); void hif_init_qdf_ctx(qdf_device_t qdf_dev, void *ol_sc); void hif_deinit_qdf_ctx(void *ol_sc); -int hif_sdio_device_inserted(struct hif_softc *ol_sc, - struct device *dev, - const struct sdio_device_id *id); +/** + * hif_sdio_device_inserted() - Wrapper function for hif-sdio driver probe + * handler + * @ol_sc: HIF device context + * @dev: pointer to device structure + * @id: pointer to sdio_device_id + * + * Return: QDF_STATUS + */ +QDF_STATUS hif_sdio_device_inserted(struct hif_softc *ol_sc, + struct device *dev, + const struct sdio_device_id *id); + void hif_sdio_stop(struct hif_softc *hif_ctx); void hif_sdio_shutdown(struct hif_softc *hif_ctx); void hif_sdio_device_removed(struct hif_softc *hif_ctx, struct sdio_func *func); diff --git a/hif/src/sdio/native_sdio/src/dev_quirks.c b/hif/src/sdio/native_sdio/src/dev_quirks.c index 7c7e63ba01..acf4bfa804 100644 --- a/hif/src/sdio/native_sdio/src/dev_quirks.c +++ b/hif/src/sdio/native_sdio/src/dev_quirks.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013-2019 The Linux Foundation. All rights reserved. + * Copyright (c) 2013-2020 The Linux Foundation. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for * any purpose with or without fee is hereby granted, provided that the @@ -403,9 +403,10 @@ static int hif_cmd52_write_byte_8bit(struct sdio_func *func) * @ol_sc: softc instance * @func: pointer to sdio_func * - * Return: 0 on success, error number otherwise. + * Return: QDF_STATUS */ -int hif_sdio_set_bus_speed(struct hif_softc *ol_sc, struct sdio_func *func) +QDF_STATUS hif_sdio_set_bus_speed(struct hif_softc *ol_sc, + struct sdio_func *func) { uint32_t clock, clock_set = 12500000; struct hif_sdio_dev *device = get_hif_device(ol_sc, func); @@ -414,7 +415,7 @@ int hif_sdio_set_bus_speed(struct hif_softc *ol_sc, struct sdio_func *func) manfid = device->id->device & MANUFACTURER_ID_AR6K_BASE_MASK; if (manfid == MANUFACTURER_ID_QCN7605_BASE) - return 0; + return QDF_STATUS_SUCCESS; if (mmcclock > 0) clock_set = mmcclock; @@ -442,31 +443,33 @@ int hif_sdio_set_bus_speed(struct hif_softc *ol_sc, struct sdio_func *func) &device->host->ios); } - return 0; + return QDF_STATUS_SUCCESS; } /** - * hif_set_bus_width() - Set the sdio bus width + * hif_sdio_set_bus_width() - Set the sdio bus width * @ol_sc: softc instance * @func: pointer to sdio_func * - * Return: 0 on success, error number otherwise. + * Return: QDF_STATUS */ -int hif_sdio_set_bus_width(struct hif_softc *ol_sc, struct sdio_func *func) +QDF_STATUS hif_sdio_set_bus_width(struct hif_softc *ol_sc, + struct sdio_func *func) { int ret = 0; uint16_t manfid; uint8_t data = 0; struct hif_sdio_dev *device = get_hif_device(ol_sc, func); + QDF_STATUS status = QDF_STATUS_SUCCESS; manfid = device->id->device & MANUFACTURER_ID_AR6K_BASE_MASK; if (manfid == MANUFACTURER_ID_QCN7605_BASE) - return ret; + return status; #if KERNEL_VERSION(3, 4, 0) <= LINUX_VERSION_CODE if (mmcbuswidth == 0) - return ret; + return status; /* Set MMC Bus Width: 1-1Bit, 4-4Bit, 8-8Bit */ if (mmcbuswidth == 1) { @@ -504,12 +507,16 @@ int hif_sdio_set_bus_width(struct hif_softc *ol_sc, struct sdio_func *func) } else { HIF_ERROR("%s: Unsupported bus width %d", __func__, mmcbuswidth); - ret = QDF_STATUS_E_FAILURE; + status = QDF_STATUS_E_FAILURE; + goto out; } + status = qdf_status_from_os_return(ret); + +out: HIF_INFO("%s: Bus with : %d\n", __func__, mmcbuswidth); #endif - return ret; + return status; } @@ -666,7 +673,7 @@ QDF_STATUS reinit_sdio(struct hif_sdio_dev *device) manfid = device->id->device & MANUFACTURER_ID_AR6K_BASE_MASK; if (manfid == MANUFACTURER_ID_QCN7605_BASE) - return 0; + return QDF_STATUS_SUCCESS; sdio_claim_host(func); diff --git a/hif/src/sdio/native_sdio/src/hif.c b/hif/src/sdio/native_sdio/src/hif.c index 7100baf1d6..f1b127e9cd 100644 --- a/hif/src/sdio/native_sdio/src/hif.c +++ b/hif/src/sdio/native_sdio/src/hif.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013-2019 The Linux Foundation. All rights reserved. + * Copyright (c) 2013-2020 The Linux Foundation. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for * any purpose with or without fee is hereby granted, provided that the @@ -277,15 +277,16 @@ static int sdio_enable4bits(struct hif_sdio_dev *device, int enable) * @func: SDIO function context * @device: pointer to hif handle * - * Return: 0 for success and non-zero for failure + * Return: QDF_STATUS */ -A_STATUS hif_sdio_probe(struct hif_softc *ol_sc, - struct sdio_func *func, - struct hif_sdio_dev *device) +QDF_STATUS hif_sdio_probe(struct hif_softc *ol_sc, + struct sdio_func *func, + struct hif_sdio_dev *device) { int ret = 0; const struct sdio_device_id *id; uint32_t target_type; + QDF_STATUS status = QDF_STATUS_SUCCESS; HIF_ENTER(); scn = (struct hif_sdio_softc *)ol_sc; @@ -357,19 +358,19 @@ A_STATUS hif_sdio_probe(struct hif_softc *ol_sc, } if (athdiag_procfs_init(scn) != 0) { - ret = QDF_STATUS_E_FAILURE; + status = QDF_STATUS_E_FAILURE; goto err_attach1; } ret = hif_dev_register_channels(device, func); - return ret; + return qdf_status_from_os_return(ret); err_attach1: if (scn->ramdump_base) pld_hif_sdio_release_ramdump_mem(scn->ramdump_base); scn = NULL; - return ret; + return status; } /** @@ -567,13 +568,14 @@ void hif_sdio_shutdown(struct hif_softc *hif_ctx) * @func: pointer to sdio_func * @id: pointer to sdio_device_id * - * Return: 0 on success, error number otherwise. + * Return: QDF_STATUS */ -static int hif_device_inserted(struct hif_softc *ol_sc, - struct sdio_func *func, - const struct sdio_device_id *id) +static QDF_STATUS hif_device_inserted(struct hif_softc *ol_sc, + struct sdio_func *func, + const struct sdio_device_id *id) { - int i, ret = 0, count; + int i, count; + QDF_STATUS ret = QDF_STATUS_SUCCESS; struct hif_sdio_dev *device = NULL; HIF_INFO("%s: F%X, VID: 0x%X, DevID: 0x%X, block size: 0x%X/0x%X\n", @@ -665,7 +667,7 @@ static int hif_device_inserted(struct hif_softc *ol_sc, ret = hif_enable_func(ol_sc, device, func, false); if ((ret == QDF_STATUS_SUCCESS || ret == QDF_STATUS_E_PENDING)) - return 0; + return QDF_STATUS_SUCCESS; ret = QDF_STATUS_E_FAILURE; del_hif_dev: del_hif_device(device); @@ -1078,12 +1080,12 @@ void hif_dump_cccr(struct hif_sdio_dev *hif_device) HIF_ERROR("%s: Exit", __func__); } -int hif_sdio_device_inserted(struct hif_softc *ol_sc, - struct device *dev, - const struct sdio_device_id *id) +QDF_STATUS hif_sdio_device_inserted(struct hif_softc *ol_sc, + struct device *dev, + const struct sdio_device_id *id) { struct sdio_func *func = dev_to_sdio_func(dev); - int status = 0; + QDF_STATUS status = QDF_STATUS_SUCCESS; HIF_ERROR("%s: Enter", __func__); status = hif_device_inserted(ol_sc, func, id); diff --git a/hif/src/sdio/transfer/adma.c b/hif/src/sdio/transfer/adma.c index bce8c52bdf..af6d302215 100644 --- a/hif/src/sdio/transfer/adma.c +++ b/hif/src/sdio/transfer/adma.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019 The Linux Foundation. All rights reserved. + * Copyright (c) 2019-2020 The Linux Foundation. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for * any purpose with or without fee is hereby granted, provided that the @@ -344,7 +344,7 @@ QDF_STATUS hif_disable_func(struct hif_sdio_dev *device, QDF_STATUS hif_enable_func(struct hif_softc *ol_sc, struct hif_sdio_dev *device, struct sdio_func *func, bool resume) { - int ret = QDF_STATUS_SUCCESS; + QDF_STATUS ret = QDF_STATUS_SUCCESS; if (!device) { HIF_ERROR("%s: HIF device is NULL", __func__); diff --git a/hif/src/sdio/transfer/mailbox.c b/hif/src/sdio/transfer/mailbox.c index 91ad93f4cd..9ec30ce263 100644 --- a/hif/src/sdio/transfer/mailbox.c +++ b/hif/src/sdio/transfer/mailbox.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013-2019 The Linux Foundation. All rights reserved. + * Copyright (c) 2013-2020 The Linux Foundation. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for * any purpose with or without fee is hereby granted, provided that the @@ -1563,10 +1563,10 @@ hif_read_write(struct hif_sdio_dev *device, * @device: HIF device object * @func: function pointer * - * Return success or failure + * Return QDF_STATUS */ -static int hif_sdio_func_enable(struct hif_softc *ol_sc, - struct sdio_func *func) +static QDF_STATUS hif_sdio_func_enable(struct hif_softc *ol_sc, + struct sdio_func *func) { struct hif_sdio_dev *device = get_hif_device(ol_sc, func); @@ -1611,7 +1611,7 @@ static int hif_sdio_func_enable(struct hif_softc *ol_sc, sdio_release_host(func); } - return 0; + return QDF_STATUS_SUCCESS; } /** @@ -1941,7 +1941,7 @@ QDF_STATUS hif_disable_func(struct hif_sdio_dev *device, QDF_STATUS hif_enable_func(struct hif_softc *ol_sc, struct hif_sdio_dev *device, struct sdio_func *func, bool resume) { - int ret = QDF_STATUS_SUCCESS; + QDF_STATUS ret = QDF_STATUS_SUCCESS; HIF_ENTER(); diff --git a/hif/src/snoc/if_snoc.c b/hif/src/snoc/if_snoc.c index 62d4ec702b..ec42a7f2e3 100644 --- a/hif/src/snoc/if_snoc.c +++ b/hif/src/snoc/if_snoc.c @@ -276,7 +276,7 @@ QDF_STATUS hif_snoc_enable_bus(struct hif_softc *ol_sc, if (ret) { HIF_ERROR("%s: failed to set dma mask error = %d", __func__, ret); - return ret; + return qdf_status_from_os_return(ret); } ret = qdf_device_init_wakeup(ol_sc->qdf_dev, true); @@ -286,7 +286,7 @@ QDF_STATUS hif_snoc_enable_bus(struct hif_softc *ol_sc, else if (ret) { HIF_ERROR("%s: device_init_wakeup: err= %d", __func__, ret); - return ret; + return qdf_status_from_os_return(ret); } ret = hif_snoc_get_target_type(ol_sc, dev, bdev, bid, diff --git a/hif/src/usb/if_usb.c b/hif/src/usb/if_usb.c index 2793b0fa9f..c1173d0d75 100644 --- a/hif/src/usb/if_usb.c +++ b/hif/src/usb/if_usb.c @@ -188,7 +188,7 @@ QDF_STATUS hif_usb_enable_bus(struct hif_softc *scn, { struct usb_interface *interface = (struct usb_interface *)bdev; struct usb_device_id *id = (struct usb_device_id *)bid; - int ret = 0; + QDF_STATUS ret = QDF_STATUS_SUCCESS; struct hif_usb_softc *sc; struct usb_device *usbdev = interface_to_usbdev(interface); int vendor_id, product_id; @@ -263,7 +263,7 @@ QDF_STATUS hif_usb_enable_bus(struct hif_softc *scn, hif_usb_unload_dev_num = usbdev->devnum; g_usb_sc = sc; HIF_EXIT(); - return 0; + return QDF_STATUS_SUCCESS; err_reset: hif_usb_diag_write_cold_reset(scn);