From nobody Tue Apr 7 01:27:34 2026 Received: from mail-wm1-f47.google.com (mail-wm1-f47.google.com [209.85.128.47]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3EE5A1427A for ; Mon, 16 Mar 2026 23:01:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.47 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773702066; cv=none; b=NQ5DbwT6Wdiq866xwZ61fZxWBmWhbNp/q6hjnpQTX8YDOyISHw3VxrFVJ3nUEoUipUehNHGHxGSjL+21WTxeaSAS/Zrg9AfHCgkr8exOrlxVSKHlmaJXSM2gLK60lR3qPuwyeXEAhLVDfPF2QAeF64/XGIRa754Pgmdl5tC5KQ4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773702066; c=relaxed/simple; bh=1wKm/jlPxKVXG8m6zDBE27fdroUMwlmsdP5Gma60dKU=; h=Message-ID:Date:MIME-Version:To:Cc:From:Subject:Content-Type; b=iyN+zhPfPKOStScsnqKMs7nXdM08Wo4mW8O3fbWdA7MBxMw7LW/90hRLM1LX0EohUAWRG7hnSXP8De19W4nIWrKH5lSOVrWOS2DaeOx8nmcmOsQONOCYKKD2b1k0eyu5JWFnWMMdpItRcll03P2ChBkm5FtIEheltnLX0ksnSKA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=bjLXOvy7; arc=none smtp.client-ip=209.85.128.47 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="bjLXOvy7" Received: by mail-wm1-f47.google.com with SMTP id 5b1f17b1804b1-48539cbb7b1so29975925e9.3 for ; Mon, 16 Mar 2026 16:01:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1773702063; x=1774306863; darn=vger.kernel.org; h=content-transfer-encoding:subject:from:cc:to:content-language :user-agent:mime-version:date:message-id:from:to:cc:subject:date :message-id:reply-to; bh=dcqTdocC391+gBQ0zfM4IQHNy82wPF5/63o0ExytDSA=; b=bjLXOvy7YIqRnuWjnI34qdqqFHcHW451EWigfdvu27TtjW5Rht6avpa/oEGEVaUCzq GT/3Dpb/kaH4Bt2wFwaC6fnZrp9CdML54Mog5IWHtVizQV81aEVFE5hsysGMGYtIkZfw iazw/OcynS/oa70w+vslGlf3U8T57m3xgq/F2DnzJrQDfRsdP9YTpaOKLMMQ//E8gnWy 6EH1OyTzGQtePcG/hLBZ9OcPlfH8DW96EN9cIONFESTO43XvIvj04H5P0ZpxhO5CdlC3 h8Wb/5lxxoN5QhIGZLqFUITM2Vo12X09PPdCnwJdWAD497pdxYsf6V6V/eAh8Zx4M1OU UYfw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1773702063; x=1774306863; h=content-transfer-encoding:subject:from:cc:to:content-language :user-agent:mime-version:date:message-id:x-gm-gg:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=dcqTdocC391+gBQ0zfM4IQHNy82wPF5/63o0ExytDSA=; b=FXllIaiW0PMJbNI3k4uRaRzw4y4Y/4qyCyIVd3f3HSyDuC/X61yDG/JJTFyPLPsSZN 9RW/riivpcdOmhVmctYDazqMUe7wJ5RgiLEDbAqWBI20s8oFJryYWsAugLVpblFofEuu aopgJPrBwsXYkrIL0RHrmkVTQ8Kk5pL5zs8trevctgO7TI8ksgBoa/3nypZrcDkdCEJN OFhg+BifsFnHWk6Mb1wAwAbVCyIv+B0Sd+AObEvsCDTgJc0QTSTtUlONuHrPMqTYVMG9 9OdDzMEm3UqPz0NmP+vhaTaDYxHq8K3ITFCm4Z5k+M+5tTzxos4/mBIYHoLU5TPkVRES JQqg== X-Gm-Message-State: AOJu0Yxwgws+hEZqibDKfDUiybzKEWzj5ODg9NbSR8EQ558BqN6IkXBu vRhVrCbXcsDYwEkwggrap5Rw5376uNni9yiDzjpdDZFGKoShBYXd6RDRluYnmg== X-Gm-Gg: ATEYQzwB8Ej568u1VlcGArSlfWYc5KRuN/916PDM7JIZu4vzk8/bF5gzpFYW9rukK7O hOPvkUnSMmv/Ivh6DvvkDAw+EXc5ay4JXQihkXwr/S9NIoN0NhlWF3bVRPHwQ1qo09ypteZ9/ZP eF5jPjwwTUnrJDGGP3Llr0jO3+0YJ622SJj9TyTnGLl+XBHIwQcfwol9ifccil18XsjwF7k/37Q vVYrDWvVshJcGqHVtJqhsctstKhKXNakyOWHMXumXMIkhslhcdjV5TG4nDmXy6VW2LpNTFEL+Kx K/WrlQbddQXUCkfYqwamTUDIADtKdz/85h2RWuybz5MvBCqQ7FO7PDTfmtdz8QU0Nc64v+4F7xK uOvUsV8pjO4YSFLhWG9/NoKep0mieCiAq9HFNyd5BdHW7QYcYIF16x+AzCHDroMGy3aUNteir5q l2HrKubueMzpoTBV6oMhs/UHYAOIzhMhP0Y+bDckngwbmKIEFCKF1Dkw0qeZMzfiyuGP/rdWwN/ VJwIJuZErppaIJv6wGWcrYtNm2ednyqWo41RWB89Qi+TuVUXzJF2ODO1jD9CehVog== X-Received: by 2002:a05:600c:8b2c:b0:485:3f65:94a1 with SMTP id 5b1f17b1804b1-48556714b4dmr256492175e9.18.1773702063248; Mon, 16 Mar 2026 16:01:03 -0700 (PDT) Received: from ?IPV6:2003:ea:8f1d:a900:d899:a285:c20c:fd3f? (p200300ea8f1da900d899a285c20cfd3f.dip0.t-ipconnect.de. [2003:ea:8f1d:a900:d899:a285:c20c:fd3f]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4856eaffbbdsm22153035e9.15.2026.03.16.16.01.01 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 16 Mar 2026 16:01:02 -0700 (PDT) Message-ID: Date: Tue, 17 Mar 2026 00:01:00 +0100 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Content-Language: en-US To: MyungJoo Ham , Chanwoo Choi Cc: Linux Kernel Mailing List From: Heiner Kallweit Subject: [PATCH] extcon: remove unused support for mutually exclusive cables Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" 1fe189bfb0fa ("extcon: palmas: Remove the mutually_exclusive array") removed the last user of the mutually exclusive cable support in 2015. As no user has shown up in the last 11 yrs, let's drop support for mutually exclusive cables. Note: Removing the sysfs attributes is fine as they (incl. directory "mutually_exclusive") were created only if a user declared mutually exclusive cables. Means this doesn't break any userspace application. Signed-off-by: Heiner Kallweit --- Documentation/ABI/testing/sysfs-class-extcon | 25 ----- drivers/extcon/extcon.c | 102 ------------------- drivers/extcon/extcon.h | 14 --- 3 files changed, 141 deletions(-) diff --git a/Documentation/ABI/testing/sysfs-class-extcon b/Documentation/A= BI/testing/sysfs-class-extcon index f8e705375..782505efa 100644 --- a/Documentation/ABI/testing/sysfs-class-extcon +++ b/Documentation/ABI/testing/sysfs-class-extcon @@ -15,10 +15,6 @@ Description: may have both HDMI and Charger attached, or analog audio, video, and USB cables attached simultaneously. =20 - If there are cables mutually exclusive with each other, - such binary relations may be expressed with extcon_dev's - mutually_exclusive array. - What: /sys/class/extcon/.../name Date: February 2012 Contact: MyungJoo Ham @@ -57,8 +53,6 @@ Description: # echo 0xHEX > state =20 This updates the whole state of the extcon device. - Inputs of all the methods are required to meet the - mutually_exclusive conditions if they exist. =20 It is recommended to use this "global" state interface if you need to set the value atomically. The later state @@ -80,22 +74,3 @@ Description: state of cable "X" (integer between 0 and 31) of an extcon device. The state value is either 0 (detached) or 1 (attached). - -What: /sys/class/extcon/.../mutually_exclusive/... -Date: December 2011 -Contact: MyungJoo Ham -Description: - Shows the relations of mutually exclusiveness. For example, - if the mutually_exclusive array of extcon device is - {0x3, 0x5, 0xC, 0x0}, then the output is:: - - # ls mutually_exclusive/ - 0x3 - 0x5 - 0xc - # - - Note that mutually_exclusive is a sub-directory of the extcon - device and the file names under the mutually_exclusive - directory show the mutually-exclusive sets, not the contents - of the files. diff --git a/drivers/extcon/extcon.c b/drivers/extcon/extcon.c index 98d85cc11..a0bcea0c4 100644 --- a/drivers/extcon/extcon.c +++ b/drivers/extcon/extcon.c @@ -243,26 +243,6 @@ static DEFINE_IDA(extcon_dev_ids); static LIST_HEAD(extcon_dev_list); static DEFINE_MUTEX(extcon_dev_list_lock); =20 -static int check_mutually_exclusive(struct extcon_dev *edev, u32 new_state) -{ - int i; - - if (!edev->mutually_exclusive) - return 0; - - for (i =3D 0; edev->mutually_exclusive[i]; i++) { - int weight; - u32 correspondants =3D new_state & edev->mutually_exclusive[i]; - - /* calculate the total number of bits set */ - weight =3D hweight32(correspondants); - if (weight > 1) - return i + 1; - } - - return 0; -} - static int find_cable_index_by_id(struct extcon_dev *edev, const unsigned = int id) { int i; @@ -558,12 +538,6 @@ int extcon_set_state(struct extcon_dev *edev, unsigned= int id, bool state) if (!is_extcon_changed(edev, index, state)) goto out; =20 - if (check_mutually_exclusive(edev, - (edev->state & ~BIT(index)) | (state & BIT(index)))) { - ret =3D -EPERM; - goto out; - } - /* * Initialize the value of extcon property before setting * the detached state for an external connector. @@ -1037,7 +1011,6 @@ static void extcon_dev_release(struct device *dev) { } =20 -static const char *muex_name =3D "mutually_exclusive"; static void dummy_sysfs_dev_release(struct device *dev) { } @@ -1138,59 +1111,6 @@ static int extcon_alloc_cables(struct extcon_dev *ed= ev) return 0; } =20 -/** - * extcon_alloc_muex() - alloc the mutual exclusive for extcon device - * @edev: extcon device - * - * Returns 0 if success or error number if fail. - */ -static int extcon_alloc_muex(struct extcon_dev *edev) -{ - char *name; - int index; - - if (!edev) - return -EINVAL; - - if (!(edev->max_supported && edev->mutually_exclusive)) - return 0; - - /* Count the size of mutually_exclusive array */ - for (index =3D 0; edev->mutually_exclusive[index]; index++) - ; - - edev->attrs_muex =3D kzalloc_objs(*edev->attrs_muex, index + 1); - if (!edev->attrs_muex) - return -ENOMEM; - - edev->d_attrs_muex =3D kzalloc_objs(*edev->d_attrs_muex, index); - if (!edev->d_attrs_muex) { - kfree(edev->attrs_muex); - return -ENOMEM; - } - - for (index =3D 0; edev->mutually_exclusive[index]; index++) { - name =3D kasprintf(GFP_KERNEL, "0x%x", - edev->mutually_exclusive[index]); - if (!name) { - for (index--; index >=3D 0; index--) - kfree(edev->d_attrs_muex[index].attr.name); - - kfree(edev->d_attrs_muex); - kfree(edev->attrs_muex); - return -ENOMEM; - } - sysfs_attr_init(&edev->d_attrs_muex[index].attr); - edev->d_attrs_muex[index].attr.name =3D name; - edev->d_attrs_muex[index].attr.mode =3D 0000; - edev->attrs_muex[index] =3D &edev->d_attrs_muex[index].attr; - } - edev->attr_g_muex.name =3D muex_name; - edev->attr_g_muex.attrs =3D edev->attrs_muex; - - return 0; -} - /** * extcon_alloc_groups() - alloc the groups for extcon device * @edev: extcon device @@ -1218,9 +1138,6 @@ static int extcon_alloc_groups(struct extcon_dev *ede= v) for (index =3D 0; index < edev->max_supported; index++) edev->extcon_dev_type.groups[index] =3D &edev->cables[index].attr_g; =20 - if (edev->mutually_exclusive) - edev->extcon_dev_type.groups[index] =3D &edev->attr_g_muex; - edev->dev.type =3D &edev->extcon_dev_type; =20 return 0; @@ -1280,10 +1197,6 @@ int extcon_dev_register(struct extcon_dev *edev) if (ret < 0) goto err_alloc_cables; =20 - ret =3D extcon_alloc_muex(edev); - if (ret < 0) - goto err_alloc_muex; - ret =3D extcon_alloc_groups(edev); if (ret < 0) goto err_alloc_groups; @@ -1325,13 +1238,6 @@ int extcon_dev_register(struct extcon_dev *edev) if (edev->max_supported) kfree(edev->extcon_dev_type.groups); err_alloc_groups: - if (edev->max_supported && edev->mutually_exclusive) { - for (index =3D 0; edev->mutually_exclusive[index]; index++) - kfree(edev->d_attrs_muex[index].attr.name); - kfree(edev->d_attrs_muex); - kfree(edev->attrs_muex); - } -err_alloc_muex: for (index =3D 0; index < edev->max_supported; index++) kfree(edev->cables[index].attr_g.name); if (edev->max_supported) @@ -1370,14 +1276,6 @@ void extcon_dev_unregister(struct extcon_dev *edev) =20 ida_free(&extcon_dev_ids, edev->id); =20 - if (edev->mutually_exclusive && edev->max_supported) { - for (index =3D 0; edev->mutually_exclusive[index]; - index++) - kfree(edev->d_attrs_muex[index].attr.name); - kfree(edev->d_attrs_muex); - kfree(edev->attrs_muex); - } - for (index =3D 0; index < edev->max_supported; index++) kfree(edev->cables[index].attr_g.name); =20 diff --git a/drivers/extcon/extcon.h b/drivers/extcon/extcon.h index 946182687..ac87b7083 100644 --- a/drivers/extcon/extcon.h +++ b/drivers/extcon/extcon.h @@ -11,14 +11,6 @@ * @supported_cable: Array of supported cable names ending with EXTCON_NON= E. * If supported_cable is NULL, cable name related APIs * are disabled. - * @mutually_exclusive: Array of mutually exclusive set of cables that can= not - * be attached simultaneously. The array should be - * ending with 0 or be NULL (no mutually exclusive cables). - * For example, if it is {0x7, 0x30, 0}, then, - * {0, 1}, {0, 1, 2}, {0, 2}, {1, 2}, or {4, 5} cannot - * be attached simulataneously. {0x7, 0} is equivalent to - * {0x3, 0x6, 0x5, 0}. If it is {0xFFFFFFFF, 0}, there - * can be no simultaneous connections. * @dev: Device of this extcon. * @id: Unique device ID of this extcon. * @state: Attach/detach state of this extcon. Do not provide at @@ -43,7 +35,6 @@ struct extcon_dev { /* Optional user initializing data */ const char *name; const unsigned int *supported_cable; - const u32 *mutually_exclusive; =20 /* Internal data. Please do not set. */ struct device dev; @@ -58,11 +49,6 @@ struct extcon_dev { /* /sys/class/extcon/.../cable.n/... */ struct device_type extcon_dev_type; struct extcon_cable *cables; - - /* /sys/class/extcon/.../mutually_exclusive/... */ - struct attribute_group attr_g_muex; - struct attribute **attrs_muex; - struct device_attribute *d_attrs_muex; }; =20 #endif /* __LINUX_EXTCON_INTERNAL_H__ */ --=20 2.53.0