From fe4e4f287cb9b5379f3fa9c897600b7c0e32438e Mon Sep 17 00:00:00 2001 From: Yue Ma Date: Wed, 1 Jul 2020 12:43:47 -0700 Subject: [PATCH 1/2] abi: Update qcom whitelist with devm_device* APIs Add devm_device_add_group and devm_device_remove_group to qcom whitelist to avoid build failure. Change-Id: I68acc186ec509e2f556019b20cfa370dbd3bab06 Signed-off-by: Yue Ma --- abi_gki_aarch64_724ffa0096.xml | 905 ++++++++++++++++----------------- abi_gki_aarch64_qcom_whitelist | 2 + 2 files changed, 439 insertions(+), 468 deletions(-) diff --git a/abi_gki_aarch64_724ffa0096.xml b/abi_gki_aarch64_724ffa0096.xml index 0833bd44fcf2..b2ec40c7fbaf 100644 --- a/abi_gki_aarch64_724ffa0096.xml +++ b/abi_gki_aarch64_724ffa0096.xml @@ -558,6 +558,8 @@ + + @@ -17687,6 +17689,16 @@ + + + + + + + + + + @@ -23125,7 +23137,7 @@ - + @@ -23134,7 +23146,7 @@ - + @@ -24016,7 +24028,7 @@ - + @@ -29161,7 +29173,6 @@ - @@ -29280,18 +29291,27 @@ - + - + - + - - + + - - + + + + + + + + + + + @@ -29335,27 +29355,26 @@ - + + + + + + + + + - + - + - - + + - - - - - - - - - - - + + @@ -29577,6 +29596,7 @@ + @@ -29596,7 +29616,7 @@ - + @@ -29604,7 +29624,7 @@ - + @@ -30225,7 +30245,7 @@ - + @@ -30374,6 +30394,56 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -30469,14 +30539,6 @@ - - - - - - - - @@ -30486,6 +30548,7 @@ + @@ -30630,7 +30693,7 @@ - + @@ -33788,13 +33851,13 @@ - + - + @@ -34344,7 +34407,7 @@ - + @@ -34410,7 +34473,7 @@ - + @@ -34447,7 +34510,7 @@ - + @@ -34631,7 +34694,7 @@ - + @@ -35524,10 +35587,10 @@ - + - + @@ -36037,10 +36100,10 @@ - + - + @@ -36747,7 +36810,7 @@ - + @@ -36756,7 +36819,7 @@ - + @@ -38768,7 +38831,7 @@ - + @@ -39436,7 +39499,7 @@ - + @@ -39603,7 +39666,7 @@ - + @@ -39621,7 +39684,7 @@ - + @@ -39654,7 +39717,7 @@ - + @@ -39672,7 +39735,7 @@ - + @@ -41129,6 +41192,8 @@ + + @@ -41141,7 +41206,7 @@ - + @@ -41194,7 +41259,7 @@ - + @@ -41261,7 +41326,6 @@ - @@ -41574,7 +41638,6 @@ - @@ -46770,41 +46833,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -46841,7 +46869,6 @@ - @@ -46879,9 +46906,9 @@ - + - + @@ -47235,7 +47262,7 @@ - + @@ -47853,7 +47880,7 @@ - + @@ -47974,117 +48001,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -48120,14 +48036,7 @@ - - - - - - - @@ -48156,6 +48065,102 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -48183,69 +48188,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -48681,7 +48623,7 @@ - + @@ -48689,7 +48631,7 @@ - + @@ -48808,10 +48750,10 @@ - + - + @@ -50920,7 +50862,7 @@ - + @@ -50968,7 +50910,7 @@ - + @@ -51175,7 +51117,7 @@ - + @@ -58509,7 +58451,7 @@ - + @@ -58531,10 +58473,10 @@ - + - + @@ -58573,7 +58515,7 @@ - + @@ -58664,7 +58606,7 @@ - + @@ -58986,7 +58928,7 @@ - + @@ -59125,7 +59067,7 @@ - + @@ -59235,7 +59177,7 @@ - + @@ -59250,7 +59192,7 @@ - + @@ -59315,7 +59257,7 @@ - + @@ -60208,7 +60150,7 @@ - + @@ -60312,7 +60254,7 @@ - + @@ -60321,7 +60263,7 @@ - + @@ -60516,14 +60458,6 @@ - - - - - - - - @@ -60561,6 +60495,14 @@ + + + + + + + + @@ -60913,10 +60855,10 @@ - + - + @@ -60955,7 +60897,7 @@ - + @@ -60967,7 +60909,7 @@ - + @@ -61059,10 +61001,10 @@ - + - + @@ -61664,7 +61606,7 @@ - + @@ -62642,7 +62584,7 @@ - + @@ -62663,7 +62605,7 @@ - + @@ -63508,7 +63450,7 @@ - + @@ -63555,7 +63497,7 @@ - + @@ -63620,10 +63562,10 @@ - + - + @@ -63632,7 +63574,7 @@ - + @@ -63785,10 +63727,10 @@ - + - + @@ -63836,7 +63778,7 @@ - + @@ -63855,10 +63797,10 @@ - + - + @@ -65454,6 +65396,22 @@ + + + + + + + + + + + + + + + + @@ -67426,7 +67384,7 @@ - + @@ -67434,7 +67392,7 @@ - + @@ -67466,7 +67424,7 @@ - + @@ -67474,7 +67432,7 @@ - + @@ -67533,7 +67491,7 @@ - + @@ -69018,7 +68976,7 @@ - + @@ -69081,7 +69039,7 @@ - + @@ -69610,7 +69568,7 @@ - + @@ -70460,7 +70418,7 @@ - + @@ -70518,7 +70476,7 @@ - + @@ -72035,7 +71993,7 @@ - + @@ -72221,7 +72179,7 @@ - + @@ -72479,7 +72437,7 @@ - + @@ -73266,10 +73224,10 @@ - + - + @@ -77287,7 +77245,7 @@ - + @@ -77752,7 +77710,7 @@ - + @@ -77797,7 +77755,7 @@ - + @@ -78591,7 +78549,7 @@ - + @@ -79632,7 +79590,7 @@ - + @@ -79641,7 +79599,7 @@ - + @@ -80280,10 +80238,10 @@ - + - + @@ -80723,10 +80681,10 @@ - + - + @@ -80964,7 +80922,7 @@ - + @@ -81073,7 +81031,7 @@ - + @@ -81114,7 +81072,7 @@ - + @@ -81144,7 +81102,7 @@ - + @@ -81255,7 +81213,7 @@ - + @@ -81679,10 +81637,10 @@ - + - + @@ -81693,7 +81651,7 @@ - + @@ -82390,7 +82348,7 @@ - + @@ -82443,7 +82401,7 @@ - + @@ -82451,7 +82409,7 @@ - + @@ -82459,7 +82417,7 @@ - + @@ -83685,7 +83643,7 @@ - + @@ -83773,6 +83731,25 @@ + + + + + + + + + + + + + + + + + + + @@ -83826,25 +83803,6 @@ - - - - - - - - - - - - - - - - - - - @@ -84182,7 +84140,7 @@ - + @@ -84327,7 +84285,7 @@ - + @@ -84397,8 +84355,8 @@ - - + + @@ -84663,7 +84621,7 @@ - + @@ -84682,6 +84640,14 @@ + + + + + + + + @@ -85420,7 +85386,7 @@ - + @@ -85436,7 +85402,7 @@ - + @@ -85637,7 +85603,7 @@ - + @@ -85885,6 +85851,17 @@ + + + + + + + + + + + @@ -86485,7 +86462,7 @@ - + @@ -86509,7 +86486,7 @@ - + @@ -86756,7 +86733,7 @@ - + @@ -86778,18 +86755,7 @@ - - - - - - - - - - - - + @@ -86797,10 +86763,10 @@ - + - + @@ -87214,7 +87180,7 @@ - + @@ -87972,14 +87938,6 @@ - - - - - - - - @@ -88997,7 +88955,7 @@ - + @@ -89005,7 +88963,7 @@ - + @@ -93527,7 +93485,7 @@ - + @@ -93535,7 +93493,7 @@ - + @@ -93559,7 +93517,7 @@ - + @@ -93567,7 +93525,7 @@ - + @@ -93583,7 +93541,7 @@ - + @@ -93591,7 +93549,26 @@ - + + + + + + + + + + + + + + + + + + + + @@ -93605,7 +93582,7 @@ - + @@ -93616,7 +93593,7 @@ - + @@ -93624,7 +93601,7 @@ - + @@ -93635,7 +93612,7 @@ - + @@ -93646,7 +93623,7 @@ - + @@ -93654,7 +93631,7 @@ - + @@ -93662,15 +93639,7 @@ - - - - - - - - - + @@ -93678,7 +93647,7 @@ - + @@ -93686,7 +93655,7 @@ - + @@ -93694,7 +93663,7 @@ - + @@ -93702,7 +93671,7 @@ - + @@ -93710,7 +93679,7 @@ - + @@ -94297,7 +94266,7 @@ - + @@ -94305,7 +94274,7 @@ - + @@ -94313,7 +94282,7 @@ - + @@ -95427,17 +95396,17 @@ - + - + - + @@ -95490,7 +95459,7 @@ - + @@ -95507,7 +95476,7 @@ - + @@ -95516,7 +95485,7 @@ - + @@ -95524,10 +95493,10 @@ - + - + @@ -95549,7 +95518,7 @@ - + @@ -95557,7 +95526,7 @@ - + @@ -95658,13 +95627,13 @@ - + - + @@ -97473,7 +97442,7 @@ - + @@ -97700,10 +97669,10 @@ - + - + @@ -99080,7 +99049,7 @@ - + @@ -100747,7 +100716,7 @@ - + diff --git a/abi_gki_aarch64_qcom_whitelist b/abi_gki_aarch64_qcom_whitelist index 46f6a113ea17..45cf42805d25 100644 --- a/abi_gki_aarch64_qcom_whitelist +++ b/abi_gki_aarch64_qcom_whitelist @@ -398,6 +398,8 @@ devm_clk_register dev_mc_sync_multiple dev_mc_unsync + devm_device_add_group + devm_device_remove_group devm_extcon_dev_allocate devm_extcon_dev_register devm_extcon_register_notifier From 72161038f2a84ddcec4c66c42a7a2e9f3d0af4dd Mon Sep 17 00:00:00 2001 From: Yue Ma Date: Tue, 9 Jun 2020 17:39:37 -0700 Subject: [PATCH 2/2] cnss2: Add support to create device sysfs group Currently CNSS driver creates sysfs nodes from different paths. Add support to create device sysfs group to consolidate the paths so that it will be easy to extend in the future. Change-Id: I9e923288018cad558d3cd591f08f73dcf9c60219 Signed-off-by: Yue Ma --- drivers/net/wireless/cnss2/main.c | 72 ++++++++++++++++++------------- drivers/net/wireless/cnss2/main.h | 1 - 2 files changed, 42 insertions(+), 31 deletions(-) diff --git a/drivers/net/wireless/cnss2/main.c b/drivers/net/wireless/cnss2/main.c index eef8058e4638..f528e73b6538 100644 --- a/drivers/net/wireless/cnss2/main.c +++ b/drivers/net/wireless/cnss2/main.c @@ -1985,11 +1985,11 @@ static void cnss_unregister_bus_scale(struct cnss_plat_data *plat_priv) icc_put(bus_bw_info->cnss_path); } -static ssize_t shutdown_store(struct kobject *kobj, - struct kobj_attribute *attr, +static ssize_t shutdown_store(struct device *dev, + struct device_attribute *attr, const char *buf, size_t count) { - struct cnss_plat_data *plat_priv = cnss_get_plat_priv(NULL); + struct cnss_plat_data *plat_priv = dev_get_drvdata(dev); if (plat_priv) { set_bit(CNSS_IN_REBOOT, &plat_priv->driver_state); @@ -2046,54 +2046,66 @@ static ssize_t fs_ready_store(struct device *dev, return count; } -static struct kobj_attribute shutdown_attribute = __ATTR_WO(shutdown); static DEVICE_ATTR_WO(fs_ready); +static DEVICE_ATTR_WO(shutdown); -static int cnss_create_shutdown_sysfs(struct cnss_plat_data *plat_priv) +static struct attribute *cnss_attrs[] = { + &dev_attr_fs_ready.attr, + &dev_attr_shutdown.attr, + NULL, +}; + +static struct attribute_group cnss_attr_group = { + .attrs = cnss_attrs, +}; + +static int cnss_create_sysfs_link(struct cnss_plat_data *plat_priv) { - int ret = 0; + struct device *dev = &plat_priv->plat_dev->dev; + int ret; - plat_priv->shutdown_kobj = kobject_create_and_add("shutdown_wlan", - kernel_kobj); - if (!plat_priv->shutdown_kobj) { - cnss_pr_err("Failed to create shutdown_wlan kernel object\n"); - return -ENOMEM; - } - - ret = sysfs_create_file(plat_priv->shutdown_kobj, - &shutdown_attribute.attr); + ret = sysfs_create_link(kernel_kobj, &dev->kobj, "cnss"); if (ret) { - cnss_pr_err("Failed to create sysfs shutdown file, err = %d\n", + cnss_pr_err("Failed to create cnss link, err = %d\n", ret); - kobject_put(plat_priv->shutdown_kobj); - plat_priv->shutdown_kobj = NULL; + goto out; } + /* This is only for backward compatibility. */ + ret = sysfs_create_link(kernel_kobj, &dev->kobj, "shutdown_wlan"); + if (ret) { + cnss_pr_err("Failed to create shutdown_wlan link, err = %d\n", + ret); + goto rm_cnss_link; + } + + return 0; + +rm_cnss_link: + sysfs_remove_link(kernel_kobj, "cnss"); +out: return ret; } -static void cnss_remove_shutdown_sysfs(struct cnss_plat_data *plat_priv) +static void cnss_remove_sysfs_link(struct cnss_plat_data *plat_priv) { - if (plat_priv->shutdown_kobj) { - sysfs_remove_file(plat_priv->shutdown_kobj, - &shutdown_attribute.attr); - kobject_put(plat_priv->shutdown_kobj); - plat_priv->shutdown_kobj = NULL; - } + sysfs_remove_link(kernel_kobj, "shutdown_wlan"); + sysfs_remove_link(kernel_kobj, "cnss"); } static int cnss_create_sysfs(struct cnss_plat_data *plat_priv) { int ret = 0; - ret = device_create_file(&plat_priv->plat_dev->dev, &dev_attr_fs_ready); + ret = devm_device_add_group(&plat_priv->plat_dev->dev, + &cnss_attr_group); if (ret) { - cnss_pr_err("Failed to create device fs_ready file, err = %d\n", + cnss_pr_err("Failed to create cnss device group, err = %d\n", ret); goto out; } - cnss_create_shutdown_sysfs(plat_priv); + cnss_create_sysfs_link(plat_priv); return 0; out: @@ -2102,8 +2114,8 @@ out: static void cnss_remove_sysfs(struct cnss_plat_data *plat_priv) { - cnss_remove_shutdown_sysfs(plat_priv); - device_remove_file(&plat_priv->plat_dev->dev, &dev_attr_fs_ready); + cnss_remove_sysfs_link(plat_priv); + devm_device_remove_group(&plat_priv->plat_dev->dev, &cnss_attr_group); } static int cnss_event_work_init(struct cnss_plat_data *plat_priv) diff --git a/drivers/net/wireless/cnss2/main.h b/drivers/net/wireless/cnss2/main.h index 8d0a94092b19..2a352b61e65b 100644 --- a/drivers/net/wireless/cnss2/main.h +++ b/drivers/net/wireless/cnss2/main.h @@ -400,7 +400,6 @@ struct cnss_plat_data { bool cbc_enabled; u8 use_nv_mac; u8 set_wlaon_pwr_ctrl; - struct kobject *shutdown_kobj; }; #ifdef CONFIG_ARCH_QCOM