From patchwork Wed Feb 28 21:53:16 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve Schrock X-Patchwork-Id: 13575997 Received: from mx0b-003ede02.pphosted.com (mx0b-003ede02.pphosted.com [205.220.181.153]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 16A718627C for ; Wed, 28 Feb 2024 21:55:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.181.153 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709157321; cv=none; b=gOo9V3vUzYQgWckWZiJI/j4cxdoLdHGLL9YL0ioMOmwr2IOkWxRN6zllGWUmN5qBEfDH6ut/qOfHzFK6LXgrblooxfgiwuaJgEFXLkuItyfh3veYB7qQBi9Cz/3cSRuXkZyGc1idBF+LaAQ0RiQqaE0xGiyUla/4KnIjaWzjsbA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709157321; c=relaxed/simple; bh=cJhO+e3E1sgxLx1pMijX0P3/3w1U4z4Csz5SEPqYmDE=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version:Content-Type; b=aOxa50hyPb4T7jjQq95iYcWY4GRI5unfaFvhxrmeyhCm8k3Ozj7rpC23Gz8BSI/fTdNqee11B1NJaRxyTmiTDP75f6gqZ+N0dQpkub4Uok9Dmyp3ZugN2nbZKOanWWhjXkXL2F1yO6kfc/BmJ9IVuvXvXOrPxRiiBFTbWUCwy0I= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=getcruise.com; spf=pass smtp.mailfrom=getcruise.com; dkim=pass (2048-bit key) header.d=getcruise.com header.i=@getcruise.com header.b=llhp4NP6; dkim=pass (2048-bit key) header.d=getcruise.com header.i=@getcruise.com header.b=bRdoLmZ5; arc=none smtp.client-ip=205.220.181.153 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=getcruise.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=getcruise.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=getcruise.com header.i=@getcruise.com header.b="llhp4NP6"; dkim=pass (2048-bit key) header.d=getcruise.com header.i=@getcruise.com header.b="bRdoLmZ5" Received: from pps.filterd (m0286618.ppops.net [127.0.0.1]) by mx0b-003ede02.pphosted.com (8.17.1.24/8.17.1.24) with ESMTP id 41SGJCoY023941 for ; Wed, 28 Feb 2024 13:55:13 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=getcruise.com; h=from:to:cc:subject:date:message-id:mime-version:content-type; s=ppemail; bh=qwvee3Lj+wq9GpF+Oqh79fyShcGxwGdm8LOe+UIQdBs=; b=l lhp4NP6KIKIKm9+ldqNX/yRrbfLm29MUg5pX8DAuCrSxdv7tJ7ccdKFP6pL1B++T QkJ1jzryUmkfh8QEhYC9HNVsN55LhVDpXRFpN3hCr0rqo5BRghjb1TCO+8WntnNf CO2IYmtPsyU7me7inTpjKxufAbPt7VrfR3sFZ+RyB1hWrInnnY0M2pi7X0r4LfIZ lNRVZZNZP7YaUGIuzwIRICM2PL3MElPKZbWHwY/miz+B/9nbGEdGDhYyN6yzkfun IKgb9IBLW6oZFQ02MvODh3RBe28j2vucsMC8fVptCywmW1Z/IVzaOQzH3MkREn1e +Br+bx/Zz899r1X7FA7sg== Received: from mail-oa1-f70.google.com (mail-oa1-f70.google.com [209.85.160.70]) by mx0b-003ede02.pphosted.com (PPS) with ESMTPS id 3wff1xks7v-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT) for ; Wed, 28 Feb 2024 13:55:12 -0800 (PST) Received: by mail-oa1-f70.google.com with SMTP id 586e51a60fabf-205fc343d1aso224661fac.1 for ; Wed, 28 Feb 2024 13:55:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=getcruise.com; s=google; t=1709157312; x=1709762112; darn=lists.linux.dev; h=mime-version:message-id:date:subject:cc:to:from:from:to:cc:subject :date:message-id:reply-to; bh=qwvee3Lj+wq9GpF+Oqh79fyShcGxwGdm8LOe+UIQdBs=; b=bRdoLmZ5LTqJARauseV9h3PszNMfj1PG1bjHEPxNvuY0IcOAGPCDz2osRxl7cFlKbN 8m92m2AIPRnFpWA5m/eHkeRCUZ+9ZFSspSXt1/rOBcbTcem86zD/5Eo9aIU0ZK6GQx0s /QDPz/aU5JvZwBNGpR3X+bg+oy2roFcavuo6Cxo75tymE7GUNcrNx3JBV0BGBjqjEHPv MqRqxiqGl/TUU7TP+EkXvE+pXBxvfDByEA2/HzULPhPGwroVXr72RP3oCqEGJQI6bDCF QBx+YoO9pmO7PKAvRHmTbLSRNXcYmh09QFoiC85BtWMaPPHnbDDSF08JCnpdWygGBGCY mBKA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709157312; x=1709762112; h=mime-version:message-id:date:subject:cc:to:from:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=qwvee3Lj+wq9GpF+Oqh79fyShcGxwGdm8LOe+UIQdBs=; b=qZ4nu+O98iFfez15acoWW7bxBX+ZF/ti6s6xYQ8bDHep+cVkGUv3NT/z7EFAy5D1u3 ZkQ0NXrtif3w1M3VKxYlhrH6Y6s6heRUhnWLea7L6+TFEHXQfmMms+jFzfbJ00gTIA5u twA2IhaWbg9ij28eyGTkEszUYaEKmyKUn4mwpFL57zze2DxcHZ6w/cK+VcPUZr/GtRsB +k4PYNzHSC8qXos/B/nek6DQKU0/82+lkCqP6gubS+DBNo5UFwIsBYk81iqHgEak0xT3 mjUi2EkP4cfn0LAq8YMfb0mwTd3IWSDH2fWfDADTThlfg4+1Rm0yGq2Q6tg9dSjzM4eX LG/Q== X-Gm-Message-State: AOJu0YxCUJAScPfiyWTLoTSXwXcR+lIWaIbbOH3ml30a/8xnWwfvqbZw cRof/sTbHQykos2V0PmDunx4zyzzIvLlXbqELhmbnKf1AWnGQk59Sc+AoNyCAJV+s0+qMuB2EI2 pvrXme0MSvNmx1zl+zxNX6jpo3lTBNMXe7+7G4xaRjLMr6/6lbuYXx4bYbNNDTv3NR5ztHpgg9w q/fz/9w5zFfPRiaRp8tDPWUyVdlzrQL/SSPCItVgoXatYrPDc= X-Received: by 2002:a05:6870:30b:b0:21f:d1e6:d8e1 with SMTP id m11-20020a056870030b00b0021fd1e6d8e1mr156271oaf.27.1709157310710; Wed, 28 Feb 2024 13:55:10 -0800 (PST) X-Google-Smtp-Source: AGHT+IEeimwLPjsvHio1Gw7sZJPxzEm59CgI+ZCnBpcxDnG+z2tLXhn/r58EcbuHqHWJpqgVdAHI6w== X-Received: by 2002:a05:6870:30b:b0:21f:d1e6:d8e1 with SMTP id m11-20020a056870030b00b0021fd1e6d8e1mr156257oaf.27.1709157310239; Wed, 28 Feb 2024 13:55:10 -0800 (PST) Received: from localhost.localdomain ([140.177.178.112]) by smtp.gmail.com with ESMTPSA id z8-20020ae9f448000000b00787c6ed9a68sm33963qkl.91.2024.02.28.13.55.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Feb 2024 13:55:09 -0800 (PST) From: Steve Schrock To: ofono@lists.linux.dev Cc: Steve Schrock Subject: [PATCH 1/4] qmi: Create a method to find a service by type Date: Wed, 28 Feb 2024 21:53:16 +0000 Message-Id: <20240228215319.153068-1-steve.schrock@getcruise.com> X-Mailer: git-send-email 2.40.1 Precedence: bulk X-Mailing-List: ofono@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Proofpoint-GUID: 0z9ycmWB95o7vpLmtQK9YwMcBp9FLaOd X-Proofpoint-ORIG-GUID: 0z9ycmWB95o7vpLmtQK9YwMcBp9FLaOd X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-02-28_08,2024-02-27_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 suspectscore=0 impostorscore=0 mlxscore=0 adultscore=0 spamscore=0 phishscore=0 priorityscore=1501 bulkscore=0 clxscore=1015 lowpriorityscore=0 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2402120000 definitions=main-2402280174 --- drivers/qmimodem/qmi.c | 43 +++++++++++++++++++++++------------------- 1 file changed, 24 insertions(+), 19 deletions(-) diff --git a/drivers/qmimodem/qmi.c b/drivers/qmimodem/qmi.c index ffb26326..aca4df0d 100644 --- a/drivers/qmimodem/qmi.c +++ b/drivers/qmimodem/qmi.c @@ -953,39 +953,44 @@ static const void *tlv_get(const void *data, uint16_t size, return NULL; } -bool qmi_device_get_service_version(struct qmi_device *device, uint16_t type, - uint16_t *major, uint16_t *minor) +static const struct qmi_service_info *__find_service_info_by_type( + struct qmi_device *device, uint16_t type) { + const struct qmi_service_info *info = NULL; const struct l_queue_entry *entry; for (entry = l_queue_get_entries(device->service_infos); entry; entry = entry->next) { - const struct qmi_service_info *info = entry->data; - - if (info->service_type != type) - continue; + info = entry->data; - *major = info->major; - *minor = info->minor; - return true; + if (info->service_type == type) + break; } - return false; + return info; } -bool qmi_device_has_service(struct qmi_device *device, uint16_t type) +bool qmi_device_get_service_version(struct qmi_device *device, uint16_t type, + uint16_t *major, uint16_t *minor) { - const struct l_queue_entry *entry; + const struct qmi_service_info *info; - for (entry = l_queue_get_entries(device->service_infos); - entry; entry = entry->next) { - const struct qmi_service_info *info = entry->data; + info = __find_service_info_by_type(device, type); + if (!info) + return false; - if (info->service_type == type) - return true; - } + *major = info->major; + *minor = info->minor; + return true; +} - return false; +bool qmi_device_has_service(struct qmi_device *device, uint16_t type) +{ + const struct qmi_service_info *info; + + info = __find_service_info_by_type(device, type); + + return info != NULL; } struct discover_data { From patchwork Wed Feb 28 21:53:17 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve Schrock X-Patchwork-Id: 13575999 Received: from mx0b-003ede02.pphosted.com (mx0b-003ede02.pphosted.com [205.220.181.153]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DBC597005A for ; Wed, 28 Feb 2024 21:55:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.181.153 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709157323; cv=none; b=kinzAksHAAU9nMXB4l0RCwT44xex2cN6L7KCPWJy+4L8exSnC7pQOCQIWbxonRJ/1e+Ks9tyrh1+r+qEdfHdC/HxC3yCkMlk70j+OwWk/4x7KLsrihGW0+AwESvfVWeON/vGTzc+p6Kjcouk2yDWInvbTTYPwkVCa7CAchuAcBo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709157323; c=relaxed/simple; bh=0nfuaSP6gKoMPLQfx+sWn3YgfpUNKb/jK2ZX+jHiCQU=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version:Content-Type; b=RAnA/02DrmpRVoZD+KNNSOeatqgltd1/kd9jNkjlbXl4ZnCjaJ3Vzpg2zJFJffCm8+j24oQrDx7M4lJ/aiPQhgfN8YZX19A9oJwMpNzJ47ZduD6RvgILcDob24oanaJjWRZRhIFHKa3xJRQ6a7wjao5FlFuNJD1KNKsXyo6Ah2M= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=getcruise.com; spf=pass smtp.mailfrom=getcruise.com; dkim=pass (2048-bit key) header.d=getcruise.com header.i=@getcruise.com header.b=F6EQpwY1; dkim=pass (2048-bit key) header.d=getcruise.com header.i=@getcruise.com header.b=oMx9PE/i; arc=none smtp.client-ip=205.220.181.153 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=getcruise.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=getcruise.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=getcruise.com header.i=@getcruise.com header.b="F6EQpwY1"; dkim=pass (2048-bit key) header.d=getcruise.com header.i=@getcruise.com header.b="oMx9PE/i" Received: from pps.filterd (m0286620.ppops.net [127.0.0.1]) by mx0b-003ede02.pphosted.com (8.17.1.24/8.17.1.24) with ESMTP id 41SDVp5R011822 for ; Wed, 28 Feb 2024 13:55:13 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=getcruise.com; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-type; s=ppemail; bh=jojanBxAb6l9xElYvxk2E5 dp7BQRcUgBKPh8s2VW6xw=; b=F6EQpwY1D7WkELtpeGJcxeXirPZp0vy2dPvMg3 L1/XhGWsEzjCGsCANh3U5qaLG4uFyC0Wkxqeo7fRxZ39r8oRi2SopeRQFPON7o9F RvXxZKFzU40YJrvaSrwN4nikucmWR/a75ZZTiNrP+e9Glrv8PzWo320O9d4rkEHE gWb3uGpSDILRPjA0qd7I9vt/vGE8sE1g3McMsjQjYBV8qA1ohd2w5BNOqNFhCl+t HVtWLW0yYUw3v7MRG66C1KPWTzf/AOk3knCP3CKMq7MxDrRgzOr09MFl3kU/eqoX HPFHV9ddKHch6T6sISROVTs3fJHnRZwFrmWe9RgXx1SH6rVw== Received: from mail-oa1-f71.google.com (mail-oa1-f71.google.com [209.85.160.71]) by mx0b-003ede02.pphosted.com (PPS) with ESMTPS id 3wgygr2fex-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT) for ; Wed, 28 Feb 2024 13:55:13 -0800 (PST) Received: by mail-oa1-f71.google.com with SMTP id 586e51a60fabf-21e7751f76fso171284fac.2 for ; Wed, 28 Feb 2024 13:55:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=getcruise.com; s=google; t=1709157312; x=1709762112; darn=lists.linux.dev; h=mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:from:to:cc:subject:date:message-id:reply-to; bh=jojanBxAb6l9xElYvxk2E5dp7BQRcUgBKPh8s2VW6xw=; b=oMx9PE/ihswrcTwLbaeJnIVkciatT6VJfMDw+gHK9llVMOr2t1mTcXYf7Tyf7Bf7xN LONL6tjQB5fcBDU3/U2k1rLG3l0yPOwWbg3MdMJnG2Lhz9z2iLYvoR7JEQbJ63grPdQh Z3Nm456cqu5rLDpgB0dDN24J12lfcArspjftPRsWHaf8kTEuukA56UETV6QibcQkPcC7 HXI43zC4pcO6U3Fa3XpCdJOmyvj6xpDxS4pKlJZk1lX0Iog2R3uylrnbDEQB3vZwkMVQ z4Uzd/SzsIqatZtZZz/kMjT2ixqmulv2kQBpr6AafbYua/C3VzuP73ewQOwufHbMOBqu +2QQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709157312; x=1709762112; h=mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=jojanBxAb6l9xElYvxk2E5dp7BQRcUgBKPh8s2VW6xw=; b=EidLk4Q2VgD8p1vxFcjQr5nxKBbD3645B+jQbMXpp/Jr+3+xg6VMvJoBww/7a/kdBB UpAbc3t+AnDfAUtiuApB+uvZBObsmCpwQDoK7iSzSU9YcD7V8jBbz/zj0Tz9iMh2yLm+ Yu4TQondRHDijNr3XLLRzBE/hqa5BbiMA4p+oGOwkiHjxsmcEeAMdC6aV6e9gzJN/wWe auuu2oJHKhWqjGB1qPJkqqOu4/NAsQX2Fn5ndY28GbkD0ugdJffBRRktKgsD9xbSpSld nXWtyWLjLs3M3rBBUAUdFF/95tSHlm3KWJIKkGh5tyxzbHwn1tmA+bjhUKFVKchkS4bc /QCA== X-Gm-Message-State: AOJu0Yzh28Om6UNCWguHN9Y1d5sFMJ/ZZCnhPqlhFwA77Oxdu4n5T7/d AizNIE/1g+sXsmX0vJ5UmrB/rDzBbNKdBMy8VvxyPrw4uKl6mzfnL7PMyV0nF03gXPAZ8vGcI9J KOjCoBXJ313OSXvjj9I3n0I44L1UryT5FwzP+rs4UjlTs2ynBnPARX1nFXqYgUKMMz7JRXaGiRf Z+B/IgJ+8Fd8p66hUIsjlxeVIgygvYZUCTdyfhSrm0iwKqvTw= X-Received: by 2002:a05:6870:f14a:b0:21e:8dc7:342e with SMTP id l10-20020a056870f14a00b0021e8dc7342emr154033oac.25.1709157312496; Wed, 28 Feb 2024 13:55:12 -0800 (PST) X-Google-Smtp-Source: AGHT+IGbGBLnCT8QfzIQAjU6Q9Ba6o1cYhW85k7Uzru7jKVMylMtCcrkgGMdlNdAwiTdXg81QFcwVg== X-Received: by 2002:a05:6870:f14a:b0:21e:8dc7:342e with SMTP id l10-20020a056870f14a00b0021e8dc7342emr153983oac.25.1709157311066; Wed, 28 Feb 2024 13:55:11 -0800 (PST) Received: from localhost.localdomain ([140.177.178.112]) by smtp.gmail.com with ESMTPSA id z8-20020ae9f448000000b00787c6ed9a68sm33963qkl.91.2024.02.28.13.55.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Feb 2024 13:55:10 -0800 (PST) From: Steve Schrock To: ofono@lists.linux.dev Cc: Steve Schrock Subject: [PATCH 2/4] qmi: Add more service info to qmi_service Date: Wed, 28 Feb 2024 21:53:17 +0000 Message-Id: <20240228215319.153068-2-steve.schrock@getcruise.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20240228215319.153068-1-steve.schrock@getcruise.com> References: <20240228215319.153068-1-steve.schrock@getcruise.com> Precedence: bulk X-Mailing-List: ofono@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Proofpoint-ORIG-GUID: WPbdxexpyOXrY6TsR3BZp-VRAXG4wCaN X-Proofpoint-GUID: WPbdxexpyOXrY6TsR3BZp-VRAXG4wCaN X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-02-28_08,2024-02-27_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 impostorscore=0 mlxscore=0 adultscore=0 suspectscore=0 priorityscore=1501 spamscore=0 bulkscore=0 malwarescore=0 phishscore=0 mlxlogscore=999 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2402120000 definitions=main-2402280173 QRTR will need to know the node and port for writes. --- drivers/qmimodem/qmi.c | 29 ++++++++++++++--------------- 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/drivers/qmimodem/qmi.c b/drivers/qmimodem/qmi.c index aca4df0d..a297a77f 100644 --- a/drivers/qmimodem/qmi.c +++ b/drivers/qmimodem/qmi.c @@ -118,9 +118,7 @@ struct qmi_device_qmux { struct qmi_service { int ref_count; struct qmi_device *device; - uint8_t type; - uint16_t major; - uint16_t minor; + struct qmi_service_info info; uint8_t client_id; uint16_t next_notify_id; struct l_queue *notify_list; @@ -315,7 +313,7 @@ static void __service_find_by_type(const void *key, void *value, if (L_PTR_TO_UINT(key) & 0x80000000) return; - if (service->type == data->type) + if (service->info.service_type == data->type) data->found_service = service; } @@ -1689,17 +1687,18 @@ static void qmux_client_create_callback(uint16_t message, uint16_t length, service->ref_count = 1; service->device = data->device; - service->type = data->type; - service->major = data->major; - service->minor = data->minor; + service->info.service_type = data->type; + service->info.major = data->major; + service->info.minor = data->minor; service->client_id = client_id->client; service->notify_list = l_queue_new(); __debug_device(device, "service created [client=%d,type=%d]", - service->client_id, service->type); + service->client_id, + service->info.service_type); - hash_id = service->type | (service->client_id << 8); + hash_id = service->info.service_type | (service->client_id << 8); l_hashmap_replace(device->service_list, L_UINT_TO_PTR(hash_id), service, (void **) &old_service); @@ -2528,12 +2527,12 @@ void qmi_service_unref(struct qmi_service *service) qmi_service_cancel_all(service); qmi_service_unregister_all(service); - hash_id = service->type | (service->client_id << 8); + hash_id = service->info.service_type | (service->client_id << 8); l_hashmap_remove(device->service_list, L_UINT_TO_PTR(hash_id)); if (device->ops->client_release) - device->ops->client_release(device, service->type, + device->ops->client_release(device, service->info.service_type, service->client_id); l_free(service); @@ -2544,7 +2543,7 @@ const char *qmi_service_get_identifier(struct qmi_service *service) if (!service) return NULL; - return __service_type_to_string(service->type); + return __service_type_to_string(service->info.service_type); } bool qmi_service_get_version(struct qmi_service *service, @@ -2554,10 +2553,10 @@ bool qmi_service_get_version(struct qmi_service *service, return false; if (major) - *major = service->major; + *major = service->info.major; if (minor) - *minor = service->minor; + *minor = service->info.minor; return true; } @@ -2631,7 +2630,7 @@ uint16_t qmi_service_send(struct qmi_service *service, data->user_data = user_data; data->destroy = destroy; - req = __request_alloc(service->type, service->client_id, + req = __request_alloc(service->info.service_type, service->client_id, message, param ? param->data : NULL, param ? param->length : 0, From patchwork Wed Feb 28 21:53:18 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve Schrock X-Patchwork-Id: 13575996 Received: from mx0a-003ede02.pphosted.com (mx0a-003ede02.pphosted.com [205.220.169.153]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B666A86244 for ; Wed, 28 Feb 2024 21:55:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.169.153 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709157321; cv=none; b=Dfq7eCVqef1MVUbuz0ek/eP3y4M6CduY1ykikk8MqWDnv76Jb7HtRAP4ktVDkx8eoN238b12/Nkm/7rK+qkoU8+r811IkyiGAmyGvDaw1pzRzIiumsdtwE+hdItxvPygS6tSnAV0Q704PQIV1RuGtBpoAAop5ris91G9SpjsCFU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709157321; c=relaxed/simple; bh=AgWizmoOwgIUjqkAZUap5yVjPLRRZTlkGZIMQ3POeyU=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version:Content-Type; b=pI74X+dQgeiwNxhMkDEIUPJNh0ywTj+nVtl88cmhBL14NiCyJsAw5dRYWxdAIihZm6uO8Kb6FE9QYfpFF40KQgN78mIXUtSva2hHe0urgN0oen02Fb3czZu1fJbWjtBxcza41Ev46Fswot5o27WB3JwjozqV+Y0g+p+JIR++7xQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=getcruise.com; spf=pass smtp.mailfrom=getcruise.com; dkim=pass (2048-bit key) header.d=getcruise.com header.i=@getcruise.com header.b=TghOZPla; dkim=pass (2048-bit key) header.d=getcruise.com header.i=@getcruise.com header.b=JlqIS/8x; arc=none smtp.client-ip=205.220.169.153 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=getcruise.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=getcruise.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=getcruise.com header.i=@getcruise.com header.b="TghOZPla"; dkim=pass (2048-bit key) header.d=getcruise.com header.i=@getcruise.com header.b="JlqIS/8x" Received: from pps.filterd (m0286614.ppops.net [127.0.0.1]) by mx0b-003ede02.pphosted.com (8.17.1.24/8.17.1.24) with ESMTP id 41SDTdCm030592 for ; Wed, 28 Feb 2024 13:55:13 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=getcruise.com; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-type; s=ppemail; bh=hdjz1RCJfEntEHoKpfu4oy Sv6j2YfxSRh5DgvUyBHuc=; b=TghOZPla3IFJsaETOun4gNECdvbWwddLuqyEL4 1O7autYcZDAYMUu2tFTm67mbjuZBJNppkED2w2Fe6PBSyrIfeQ3OR3czhud9lxCr 3Z54TdkPK2ZBZD7ySGr7CaKaTYb9I5ZbWgRVNHt+iElE3irWUrF++ZGDqziTg/Vm wi5ukEVPz7dOClCJzForiMfjMvuWI3rtOLF2g866GCjsNbuLYj1oRVEB9E0nee0v ugUFkE3KggvS54+Glvo0tVkqsiiQPJwjhmKjrcmeVeU5YwgdniyERk0PmEFnykSH pOsAd2kXA9+UOScNrOnUuUUjCMWqvEoyW0kXNQ7EDVacP/jw== Received: from mail-qk1-f197.google.com (mail-qk1-f197.google.com [209.85.222.197]) by mx0b-003ede02.pphosted.com (PPS) with ESMTPS id 3wj1bq8m80-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT) for ; Wed, 28 Feb 2024 13:55:13 -0800 (PST) Received: by mail-qk1-f197.google.com with SMTP id af79cd13be357-787d1903812so22973585a.2 for ; Wed, 28 Feb 2024 13:55:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=getcruise.com; s=google; t=1709157312; x=1709762112; darn=lists.linux.dev; h=mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:from:to:cc:subject:date:message-id:reply-to; bh=hdjz1RCJfEntEHoKpfu4oySv6j2YfxSRh5DgvUyBHuc=; b=JlqIS/8xTITIjJEIzHk8FJXoazRjqNQSfA/FeNLeJSqjRj5OzjLcRiE79F605OtrEO o5EaO5aHsqk0qyn7NJlQbvFT9k3uNW+miAYH8Ho4JSKNMlZcuRxDQ3IK0AI3wFfo1OCW AEm2XbYuhcfPuzR7SoNkFoAYoZieULusuDtg9kE5Oa+4KP8eAsTQMLjf3n3oTedddMd1 YE/p/h414UohmBW7WPk/yq4NjHHJcrhfos0dN3+psZ0fBmCsOM13jihH/n/RTG1pOUvD oxxY0Wc+8sF84AvaxBUMcRwgocEHnBP86Vj9HXXF97VLVibGr8RusCpGUB7DX7UO8bg+ ZfBA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709157312; x=1709762112; h=mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=hdjz1RCJfEntEHoKpfu4oySv6j2YfxSRh5DgvUyBHuc=; b=I17Cc3WhA6HrGgUXqar8BDQMKVGuW4pJKHk0KorR8I+UTuxJ2jFI7bDsfCV9P/9eJG oRqgn2YpfktzTOYRIKod66c3XUkzt6wdlPvTeMuFYeXTvCa2/A7ScPLWU/mKIBP3F7k0 4f3AJkxCsB5AtmyT6bxIZKbP7AhrQibvmtR6QNgsiTNkwKu3qF3q/uDFTt/BDmVWkFwZ jhXTI7h/Btaa4YNR8dn6BGJM1AmnPFb8d3aC8uERzmuHQ30ROIera4pIIxPjOhsgIwmb RuSgfowREN0uzBO7c4SYVpXrmhIlbIrtCisgCtTXkrsacXK7aQJxNwrp7bRysSjUqB72 dKPg== X-Gm-Message-State: AOJu0YzQHtobBp5ouH0et0D310V0vAKaiYLoauDmLKmUJY/Wy9/4EoDE Q5IQmk15qVn6z5vpDXq3Ec6ueL5+c9U+5s62C3C3osrZDTNlNQTpSRVAsqzbisTnMmRqQ9KYagv HZIxWPKYUwYaGG6dFx+B2d7cTL9mi5re75xABRiaP3DC54jHu4LF+pDibo0kuOEyvE++SkSuARJ vkLba0P5dc98tZPo4mPiWRQDCycB1uAAldD+ARSqnygRPaWCk= X-Received: by 2002:a05:620a:5d91:b0:787:2727:6a7e with SMTP id xx17-20020a05620a5d9100b0078727276a7emr331244qkn.28.1709157311956; Wed, 28 Feb 2024 13:55:11 -0800 (PST) X-Google-Smtp-Source: AGHT+IHTnUHXDo6EoncH/SDKuTXQ5oaV6NUVy883mMAJQ5JdHqjxoOQn+2ged5GLxhYL4CdBa61rjw== X-Received: by 2002:a05:620a:5d91:b0:787:2727:6a7e with SMTP id xx17-20020a05620a5d9100b0078727276a7emr331230qkn.28.1709157311542; Wed, 28 Feb 2024 13:55:11 -0800 (PST) Received: from localhost.localdomain ([140.177.178.112]) by smtp.gmail.com with ESMTPSA id z8-20020ae9f448000000b00787c6ed9a68sm33963qkl.91.2024.02.28.13.55.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Feb 2024 13:55:11 -0800 (PST) From: Steve Schrock To: ofono@lists.linux.dev Cc: Steve Schrock Subject: [PATCH 3/4] qmi: Allow for 16-bit service types in the type hash Date: Wed, 28 Feb 2024 21:53:18 +0000 Message-Id: <20240228215319.153068-3-steve.schrock@getcruise.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20240228215319.153068-1-steve.schrock@getcruise.com> References: <20240228215319.153068-1-steve.schrock@getcruise.com> Precedence: bulk X-Mailing-List: ofono@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Proofpoint-GUID: 2Wyrm3orIVvpvsrXTE3yFG30KVwahJLT X-Proofpoint-ORIG-GUID: 2Wyrm3orIVvpvsrXTE3yFG30KVwahJLT X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-02-28_08,2024-02-27_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 lowpriorityscore=0 suspectscore=0 spamscore=0 priorityscore=1501 impostorscore=0 adultscore=0 bulkscore=0 mlxlogscore=999 phishscore=0 mlxscore=0 clxscore=1015 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2402120000 definitions=main-2402280174 Only QMUX has client ids and they fit into 8 bits. --- drivers/qmimodem/qmi.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/drivers/qmimodem/qmi.c b/drivers/qmimodem/qmi.c index a297a77f..afa7b962 100644 --- a/drivers/qmimodem/qmi.c +++ b/drivers/qmimodem/qmi.c @@ -734,6 +734,11 @@ static void service_notify(const void *key, void *value, void *user_data) result); } +static unsigned int service_list_create_hash(uint16_t service_type, uint8_t client_id) +{ + return (service_type | (client_id << 16)); +} + static void handle_indication(struct qmi_device *device, uint8_t service_type, uint8_t client_id, uint16_t message, uint16_t length, const void *data) @@ -757,8 +762,7 @@ static void handle_indication(struct qmi_device *device, return; } - hash_id = service_type | (client_id << 8); - + hash_id = service_list_create_hash(service_type, client_id); service = l_hashmap_lookup(device->service_list, L_UINT_TO_PTR(hash_id)); @@ -1698,8 +1702,8 @@ static void qmux_client_create_callback(uint16_t message, uint16_t length, service->client_id, service->info.service_type); - hash_id = service->info.service_type | (service->client_id << 8); - + hash_id = service_list_create_hash(service->info.service_type, + service->client_id); l_hashmap_replace(device->service_list, L_UINT_TO_PTR(hash_id), service, (void **) &old_service); @@ -2527,8 +2531,8 @@ void qmi_service_unref(struct qmi_service *service) qmi_service_cancel_all(service); qmi_service_unregister_all(service); - hash_id = service->info.service_type | (service->client_id << 8); - + hash_id = service_list_create_hash(service->info.service_type, + service->client_id); l_hashmap_remove(device->service_list, L_UINT_TO_PTR(hash_id)); if (device->ops->client_release) From patchwork Wed Feb 28 21:53:19 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve Schrock X-Patchwork-Id: 13575998 Received: from mx0a-003ede02.pphosted.com (mx0a-003ede02.pphosted.com [205.220.169.153]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8C13586244 for ; Wed, 28 Feb 2024 21:55:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.169.153 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709157323; cv=none; b=LyAHq4zE8qA3t4Kl5xX7QNka59In1fM7gDTvY0YYVOvCLrarZ2qHilh3U0z8KWXwFzowVyVVDL9BFE+CTK/z8R5VGxKj4GijWMqquW4hNXFfIyOLVKp2iVu2liNDBW67UzDjsOxNJz7vCaYkOFHUKn1JK8elqJIwHLaxQVyvRzs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709157323; c=relaxed/simple; bh=PtVKPKXACHePnBQCQpjxqBhgy4wgRGNf+6PYU7G6wKA=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version:Content-Type; b=qjr7044QG4s91Q4R4WbICnfNZ0dX5bVMnjoli0v2SPNKDL8MrovVYQ6sEh9WZwt40PX3yBuuUroDwF0lQGBT55UBhTZzzMVnV68tjKBzZUgSGLxcFUayLR3FqWJbtNMPXsWLyK90vTzeMInZ9ImgtjEDwO9v4LjUYHPzYkrm/K0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=getcruise.com; spf=pass smtp.mailfrom=getcruise.com; dkim=pass (2048-bit key) header.d=getcruise.com header.i=@getcruise.com header.b=bkhwUxPV; dkim=pass (2048-bit key) header.d=getcruise.com header.i=@getcruise.com header.b=CvJ8qL+T; arc=none smtp.client-ip=205.220.169.153 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=getcruise.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=getcruise.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=getcruise.com header.i=@getcruise.com header.b="bkhwUxPV"; dkim=pass (2048-bit key) header.d=getcruise.com header.i=@getcruise.com header.b="CvJ8qL+T" Received: from pps.filterd (m0286616.ppops.net [127.0.0.1]) by mx0b-003ede02.pphosted.com (8.17.1.24/8.17.1.24) with ESMTP id 41SD02dU028564 for ; Wed, 28 Feb 2024 13:55:15 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=getcruise.com; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-type; s=ppemail; bh=L6yPoWdmlQbD8Hky3/uBef 6MJ1eq/dO2PC0HlTk2Wrg=; b=bkhwUxPV/LiH3i75JyA5pOWwKs46MDzZAc+jfG 86RccJZBBvaA/BPfEXcFD/NLN3yXytsqGCYhA12pEnSi0rtsnLJD0tgsnORnRxX6 gv3oPKNpwdJyaOL2RkxrTTLKVcHq1rVdkiJLmWqZxIDE9IvN9/y9YS8YRvZ47qWc zpwMyZ/LwhTiRMhDK8XhUjPLhodZV7j8INhF61/4RXYUxssRZvEX73pz/w0eZVxg 5fMxaDBfUPDKYYGgsQ23D+DmuAesCHchvLwcoogtLm4ezzo8vDP3Pf3uhHHzD3ex dVyWDAI5oNFv+2j4H1igEw0Ln4wrHAx+7eS7pkM+xAALK47g== Received: from mail-ot1-f72.google.com (mail-ot1-f72.google.com [209.85.210.72]) by mx0b-003ede02.pphosted.com (PPS) with ESMTPS id 3wfewa3t07-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT) for ; Wed, 28 Feb 2024 13:55:14 -0800 (PST) Received: by mail-ot1-f72.google.com with SMTP id 46e09a7af769-6e49d73202cso167945a34.1 for ; Wed, 28 Feb 2024 13:55:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=getcruise.com; s=google; t=1709157314; x=1709762114; darn=lists.linux.dev; h=mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:from:to:cc:subject:date:message-id:reply-to; bh=L6yPoWdmlQbD8Hky3/uBef6MJ1eq/dO2PC0HlTk2Wrg=; b=CvJ8qL+TgaEG37Ab6rmbm21QGa/39gDSlKJjwmPRqRt0LZq/LBdHvKcR1kdsA/5WHA 6Xf4PQR0d6ozAfOYQ5hqXiwCqzi2NKaWTMrpaEzK3AoYQgx7Cl2raK2xeU0FGeRNziFP zlF8dUL+UI8fl6AZ+leEtjYX5xm0ikkNSsCEAJahs10v2GTCnwLQiYYpvtUdS7XYjpYT dDAVjQqfTFRRjisYSLRFvtttevnf9bL0Vx11aen5PSzawjrZP8D6codijb6tGPBoXFGC yorZ1x0mQE6FhqIS7uasPzzx9WDMzoLQENy2QIKbZROSmAUPBy6CGLy7PNYpf3funaWQ S6/A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709157314; x=1709762114; h=mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=L6yPoWdmlQbD8Hky3/uBef6MJ1eq/dO2PC0HlTk2Wrg=; b=chJHZDhUsnE3mmxUiNTAAJcFjBlKe1bqA5K4JHYhXIu6EPZlLgWroHuAK+LwRTZWlG 02s2XBL4ow5JeyciODDDGIYHToxxQ9VEjFYN6eRjZQl6Ab78MlMo5eVqRRgaKlO51vD7 g0dq0He/KsDllbI2f1sBehfARA8CXhow1DcRoeAtkCP/F57No4Hud/M3WmetrElV2IQW xoKBse4cI5bnou2PPPhqAuC9jjxu3St3lrqGb2LVjiy8tjvUq8cSvgQwSI1gIOogt5Aj z/uB7FcSmPeGph8u0DazghzAWG0E3F7AykvZIEF9/7k56Cy3jvWN8xtD/9O3/ZB0nsvw PZRA== X-Gm-Message-State: AOJu0Yzka5bR2b60DjZfipxR5jQko8vj+u+Qa22V4I+Sonzy6qnqkHve ZdAsDE9quOq1aNLeC8KJZOiUhE7jagCAxxLKKpVyooZQxAV2YIgm1PBVCIWwbpV0ed4Jl4ZJlPJ BBKrnk9REbbwpoyVUlFedS9uFyu7s9Ad8iPT9rZsCVEgU+zf48rHlQjF+ASaj7Wsk7IbJZSKcCI 2qeaYSm/4UhRsXxm/Oh5QmOgWRoOmQNJgeGPGJqouChOpRURE= X-Received: by 2002:a05:6870:170a:b0:21f:db0e:4aab with SMTP id h10-20020a056870170a00b0021fdb0e4aabmr148419oae.59.1709157312378; Wed, 28 Feb 2024 13:55:12 -0800 (PST) X-Google-Smtp-Source: AGHT+IEWmQG+nS6zdTlMNB5a5WWtx+UG5fxPumbeLYw8EhAqm1AfmUP9nkXuDDaV4yoeYRCpzLmnmA== X-Received: by 2002:a05:6870:170a:b0:21f:db0e:4aab with SMTP id h10-20020a056870170a00b0021fdb0e4aabmr148400oae.59.1709157312036; Wed, 28 Feb 2024 13:55:12 -0800 (PST) Received: from localhost.localdomain ([140.177.178.112]) by smtp.gmail.com with ESMTPSA id z8-20020ae9f448000000b00787c6ed9a68sm33963qkl.91.2024.02.28.13.55.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Feb 2024 13:55:11 -0800 (PST) From: Steve Schrock To: ofono@lists.linux.dev Cc: Steve Schrock Subject: [PATCH 4/4] qmi: Enable basic client creation if it is not subclassed Date: Wed, 28 Feb 2024 21:53:19 +0000 Message-Id: <20240228215319.153068-4-steve.schrock@getcruise.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20240228215319.153068-1-steve.schrock@getcruise.com> References: <20240228215319.153068-1-steve.schrock@getcruise.com> Precedence: bulk X-Mailing-List: ofono@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Proofpoint-GUID: rk5jz10jMW_f_ggxM-sKx45cs6cAa-bB X-Proofpoint-ORIG-GUID: rk5jz10jMW_f_ggxM-sKx45cs6cAa-bB X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-02-28_08,2024-02-27_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 impostorscore=0 bulkscore=0 suspectscore=0 mlxscore=0 adultscore=0 lowpriorityscore=0 mlxlogscore=944 spamscore=0 priorityscore=1501 clxscore=1015 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2402120000 definitions=main-2402280174 QRTR does not require client ID allocation requests. --- drivers/qmimodem/qmi.c | 93 ++++++++++++++++++++++++++++++++++-------- 1 file changed, 76 insertions(+), 17 deletions(-) diff --git a/drivers/qmimodem/qmi.c b/drivers/qmimodem/qmi.c index afa7b962..6e4c99dc 100644 --- a/drivers/qmimodem/qmi.c +++ b/drivers/qmimodem/qmi.c @@ -1388,6 +1388,25 @@ static uint8_t __ctl_request_submit(struct qmi_device_qmux *qmux, return req->tid; } +static struct qmi_service *service_create(struct qmi_device *device, + const struct qmi_service_info *info, uint8_t client_id) +{ + struct qmi_service *service = l_new(struct qmi_service, 1); + + service->ref_count = 1; + service->device = device; + service->client_id = client_id; + service->notify_list = l_queue_new(); + + memcpy(&service->info, info, sizeof(service->info)); + + __debug_device(device, "service created [client=%d,type=%d]", + service->client_id, + service->info.service_type); + + return service; +} + static void service_create_shared_reply(struct l_idle *idle, void *user_data) { struct service_create_shared_data *data = user_data; @@ -1398,6 +1417,20 @@ static void service_create_shared_reply(struct l_idle *idle, void *user_data) DISCOVERY_DONE(data, data->service, data->user_data); } +static void service_create_shared_no_discovery_reply(struct l_idle *idle, + void *user_data) +{ + struct service_create_shared_data *data = user_data; + + l_idle_remove(data->idle); + data->idle = NULL; + + if (data->func) + data->func(data->service, data->user_data); + + __discovery_free(&data->super); +} + static void service_create_shared_pending_reply(struct qmi_device *device, unsigned int type, struct qmi_service *service) @@ -1664,6 +1697,7 @@ static void qmux_client_create_callback(uint16_t message, uint16_t length, struct qmi_device *device = data->device; struct qmi_service *service = NULL; struct qmi_service *old_service = NULL; + struct qmi_service_info info; const struct qmi_result_code *result_code; const struct qmi_client_id *client_id; uint16_t len; @@ -1686,21 +1720,12 @@ static void qmux_client_create_callback(uint16_t message, uint16_t length, if (client_id->service != data->type) goto done; - service = l_new(struct qmi_service, 1); - - service->ref_count = 1; - service->device = data->device; + memset(&info, 0, sizeof(service->info)); + info.service_type = data->type; + info.major = data->major; + info.minor = data->minor; - service->info.service_type = data->type; - service->info.major = data->major; - service->info.minor = data->minor; - - service->client_id = client_id->client; - service->notify_list = l_queue_new(); - - __debug_device(device, "service created [client=%d,type=%d]", - service->client_id, - service->info.service_type); + service = service_create(device, &info, client_id->client); hash_id = service_list_create_hash(service->info.service_type, service->client_id); @@ -2443,6 +2468,43 @@ bool qmi_service_create_shared(struct qmi_device *device, uint16_t type, if (type == QMI_SERVICE_CONTROL) return false; + if (!device->ops->client_create) { + struct service_create_shared_data *data; + + /* + * The hash id is simply the service type in this case. There + * is no "pending" state for discovery and no client id. + */ + service = l_hashmap_lookup(device->service_list, + L_UINT_TO_PTR(type_val)); + if (!service) { + const struct qmi_service_info *info; + + info = __find_service_info_by_type(device, type); + if (!info) + return false; + + service = service_create(device, info, 0); + l_hashmap_insert(device->service_list, + L_UINT_TO_PTR(type_val), service); + } + + data = l_new(struct service_create_shared_data, 1); + + data->super.destroy = service_create_shared_data_free; + data->device = device; + data->func = func; + data->user_data = user_data; + data->destroy = destroy; + + data->service = qmi_service_ref(service); + data->idle = l_idle_create( + service_create_shared_no_discovery_reply, + data, NULL); + + return true; + } + shared = l_hashmap_lookup(device->service_list, L_UINT_TO_PTR(type_val | 0x80000000)); @@ -2486,9 +2548,6 @@ bool qmi_service_create_shared(struct qmi_device *device, uint16_t type, return true; } - if (!device->ops->client_create) - return -ENOTSUP; - r = device->ops->client_create(device, type, func, user_data, destroy); return r == 0; }