From patchwork Thu Mar 28 17:59:22 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Caleb Connolly X-Patchwork-Id: 783634 Delivered-To: patch@linaro.org Received: by 2002:a5d:4e01:0:b0:33e:7753:30bd with SMTP id p1csp2861457wrt; Thu, 28 Mar 2024 11:02:53 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCU9mclPh1Ys/RyeifLgmUfV51XTrx+6qenVotPde6rXedwGFyMYI7Qfnvi6wYQwKIrj27eryHciv9QSoEUqTQFc X-Google-Smtp-Source: AGHT+IEjP1OavM9DXBMhthOF0e6pT91B4dGukMvn4j1p4T/itau0wOPG3w+QtXImBVZsAwmay/FM X-Received: by 2002:a5d:6645:0:b0:343:34aa:c727 with SMTP id f5-20020a5d6645000000b0034334aac727mr962732wrw.4.1711648973606; Thu, 28 Mar 2024 11:02:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1711648973; cv=none; d=google.com; s=arc-20160816; b=c8RMIFaYnySMy3cN32mj43Sr7pkAkCVnb3Zmmsu9S0BJLn50h62sOIAsRsmFmT9e9o Cqq9/5gBPWdML/wkyTZe4gaPWkyrZZ+K1yAclnCs7c/oexkJWuwMMdHzgCgxczvl2ulr k2htNBHUL5daj5HhG8QY8tQ5r+QvUI8bP7uF+20YbLQlTFZVPTqHR8lTQ7/vgF8L4SlZ 4DJ/tMwelBUY9DazAlbi8tsoc3amAeLIGgbs+oYw8qYtpXvI2Izv55ilRRRzC2qmC0uu YnwoREbJumn2536+9Wi1OM1dvuKhA4fR5g87F9Y6nVPEdyID+ru1qV3oVTLCydoMozLG Vqzg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:cc:to:in-reply-to:references :message-id:content-transfer-encoding:mime-version:subject:date:from :dkim-signature; bh=2rIilUL3fPgdL00EeRjYvSoOr0+tfQS+h1cCC5JbimE=; fh=UCbbILluXgMGxxdmaQRBDvD8iVM0YPl1euVl8qV8Tp4=; b=nfCAhRyG8XZ/9c/6xfNesbKD5I0bErVP/iOPKXIqL28hHZqQgPLUkSZK1D5PVor0Em CdXaQwIVsdc6VInSAavyNsa8Ew6m9yjeaOtZxxsRjZbSw6I62GYW5uoYFTzLiIITJEh2 8o7YLffac4LlSpoHE/CmOlFPvN1P6F+yB7P4ZfhaZaqBsIFDohjtvwO56uG+ED7h6IlL 353AFym68Rm4nfRRnQoSKd/XKzDhrlwdlT/9ncNmX/WbVMwLqFIVbRQ28dyK8qIDFKE6 t4nGBIRLD0ndoAHMvA92Jhi07xQ18roMWohyTKszvt43XtTt0daeGGE2hwX7ZgrFZ76H g2Cw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=I5kfjqVp; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from phobos.denx.de (phobos.denx.de. [2a01:238:438b:c500:173d:9f52:ddab:ee01]) by mx.google.com with ESMTPS id f16-20020adfdb50000000b0033e73f04276si1086475wrj.371.2024.03.28.11.02.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 28 Mar 2024 11:02:53 -0700 (PDT) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=I5kfjqVp; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id D865588206; Thu, 28 Mar 2024 19:00:04 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="I5kfjqVp"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id DB979881F3; Thu, 28 Mar 2024 19:00:00 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-wr1-x42a.google.com (mail-wr1-x42a.google.com [IPv6:2a00:1450:4864:20::42a]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 638A8881DA for ; Thu, 28 Mar 2024 18:59:58 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=caleb.connolly@linaro.org Received: by mail-wr1-x42a.google.com with SMTP id ffacd0b85a97d-341cf28e013so767995f8f.3 for ; Thu, 28 Mar 2024 10:59:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1711648798; x=1712253598; darn=lists.denx.de; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=2rIilUL3fPgdL00EeRjYvSoOr0+tfQS+h1cCC5JbimE=; b=I5kfjqVpwcB/0Gp8M8SJpbDZAaZzXCtGrA7xgpiGvRyh879yMn+pKi/VGQE5kNyJpm z+CAKhv7+SSDRgiC9v94I1qAkOO6dMbkB47vuM3bOAwaVkJo5bzQKrMqLoelRzLOcnDr 86xqCnPNYawsDpnpL3QgjPteuMX/Yh27YIki3/2V3DLLjr5vuRnbrxvL5rdoKEf++c7C BNoO8nZE4t70iPvr61CBKw75HakBq8eHKW2WpkKAaS/4S7oPLDuU7ywux4/ywufYBAB4 eBfoN4OP4IOCsSk+Dc2Id/5wSE+gmrhldVZN2GLZnTxedm61nnD6ZRQr1h0woYWibW1y 1TgA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711648798; x=1712253598; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=2rIilUL3fPgdL00EeRjYvSoOr0+tfQS+h1cCC5JbimE=; b=IKPJ7Uqx+bksd27kQYu6+snJDOyWtTY6w43C49uEDIMKwcLOwK380RBRn4s1ModD7i t/xsCP566EbF6V56sHyQKWPNpxuuAYZp/hOXqy8uqMzN3gomz1M2Rd5Fk/DKkNPkj+uK l9sKnxpyL3qsG7ouM9wZcKQE93FwVCy6kB4f0yefYO5lIzOGGHLer3lxM0L8PzCjuepi Ez6kzlIMT1dSQuBmlK1ahIowlSOS1w70dV6ee9sUqUm9MC4Dt+Dl2k2cnpg46iZY2tz7 MFQt7INxireDTXStlreO9cnYuY/6ETBXG2ddStkMgQ+3o7b57ZKZI6pQGqWbwYJMuMQA 33/Q== X-Gm-Message-State: AOJu0YwU6+TJcwuBTKKL/kv4ePOlUVy+77WLFXlvDt04B1QaqGw92l2G RmFyg6c+GZF2l53xPvBraOC6mwqwhAfQNjFmjEeZnLjtEdA53pniZNOCWcRNvJgv77nfy4lef7p 3 X-Received: by 2002:adf:fa42:0:b0:33e:8b93:87c6 with SMTP id y2-20020adffa42000000b0033e8b9387c6mr2678093wrr.42.1711648797948; Thu, 28 Mar 2024 10:59:57 -0700 (PDT) Received: from lion.localdomain (host-92-17-96-232.as13285.net. [92.17.96.232]) by smtp.gmail.com with ESMTPSA id y13-20020a5d4acd000000b00341e5f487casm2292237wrs.46.2024.03.28.10.59.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 28 Mar 2024 10:59:57 -0700 (PDT) From: Caleb Connolly Date: Thu, 28 Mar 2024 17:59:22 +0000 Subject: [PATCH v5 16/16] usb: gadget: UMS: fix 64-bit division on ARM32 MIME-Version: 1.0 Message-Id: <20240328-b4-qcom-livetree-v5-16-4e98228b3d03@linaro.org> References: <20240328-b4-qcom-livetree-v5-0-4e98228b3d03@linaro.org> In-Reply-To: <20240328-b4-qcom-livetree-v5-0-4e98228b3d03@linaro.org> To: Tom Rini , Caleb Connolly , Neil Armstrong , Sumit Garg , Lukasz Majewski , Sean Anderson Cc: u-boot@lists.denx.de, Mattijs Korpershoek X-Mailer: b4 0.14-dev X-Developer-Signature: v=1; a=openpgp-sha256; l=2332; i=caleb.connolly@linaro.org; h=from:subject:message-id; bh=GILrVlJTLB7vGoUqwXYfiSFWeP5Fqv5LLGhQ18mVlh4=; b=owGbwMvMwCFYaeA6f6eBkTjjabUkhjTWDVwHLU3WZuzJkhAQvvLzAOPldO9bixbuywjcsfvp+ tOPN4QkdZSyMAhyMMiKKbKIn1hm2bT2sr3G9gUXYOawMoEMYeDiFICJ1Kgz/E/m8La2Z4haV5PP LM6scOvA0flRgQxOctVrqkNX6KotWMPIMFN1Xb3RwyarF2mlCYcmqXqudrzP2Xqmxdv+7ZN/5hX XXwMA X-Developer-Key: i=caleb.connolly@linaro.org; a=openpgp; fpr=83B24DA7FE145076BC38BB250CD904EB673A7C47 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean The patch introducing support for dynamic sector sizes changed the types used in some divisions, resulting in the compiler attempting to use libgcc helpers (__aeabi_ldivmod). Replace these divisions with calls to lldiv() to handle this correctly. Fixes: 74e56e0c5065 ("usb: gadget: UMS: support multiple sector sizes") Signed-off-by: Caleb Connolly --- Cc: Mattijs Korpershoek --- drivers/usb/gadget/f_mass_storage.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/drivers/usb/gadget/f_mass_storage.c b/drivers/usb/gadget/f_mass_storage.c index d880928044f4..ef90c7ec7fb5 100644 --- a/drivers/usb/gadget/f_mass_storage.c +++ b/drivers/usb/gadget/f_mass_storage.c @@ -239,8 +239,9 @@ /* #define VERBOSE_DEBUG */ /* #define DUMP_MSGS */ #include +#include #include #include #include #include @@ -768,10 +769,10 @@ static int do_read(struct fsg_common *common) } /* Perform the read */ rc = ums[common->lun].read_sector(&ums[common->lun], - file_offset / curlun->blksize, - amount / curlun->blksize, + lldiv(file_offset, curlun->blksize), + lldiv(amount, curlun->blksize), (char __user *)bh->buf); if (!rc) return -EIO; @@ -942,10 +943,10 @@ static int do_write(struct fsg_common *common) amount = bh->outreq->actual; /* Perform the write */ rc = ums[common->lun].write_sector(&ums[common->lun], - file_offset / curlun->blksize, - amount / curlun->blksize, + lldiv(file_offset, curlun->blksize), + lldiv(amount, curlun->blksize), (char __user *)bh->buf); if (!rc) return -EIO; nwritten = rc * curlun->blksize; @@ -1058,10 +1059,10 @@ static int do_verify(struct fsg_common *common) } /* Perform the read */ rc = ums[common->lun].read_sector(&ums[common->lun], - file_offset / curlun->blksize, - amount / curlun->blksize, + lldiv(file_offset, curlun->blksize), + lldiv(amount, curlun->blksize), (char __user *)bh->buf); if (!rc) return -EIO; nread = rc * curlun->blksize;