From patchwork Mon Jun 24 13:14:39 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 807042 Delivered-To: patch@linaro.org Received: by 2002:a5d:508d:0:b0:362:4979:7f74 with SMTP id a13csp1878930wrt; Mon, 24 Jun 2024 06:19:40 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVtutLntxXt10teiTnqdvd8YtLbXADYkbxqV+uQ7hIx3XvaZHkBAs4yXJxV+s/wZ3qSB+Aq+jdTXZLtNasQvXnv X-Google-Smtp-Source: AGHT+IFmCG7zvVCJvhgGUScQop47AQ2lCmrXNuCeLcJXchnViXVNkRETBkMF42dv6DTCvNgLNgUf X-Received: by 2002:a05:6870:eca5:b0:250:73d9:7739 with SMTP id 586e51a60fabf-25d06e564b5mr4976742fac.45.1719235179472; Mon, 24 Jun 2024 06:19:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1719235179; cv=none; d=google.com; s=arc-20160816; b=ifk6x60pdyKX7hBs0ShlF188//W9Gl3noM8CO+B8vlQzkeYa8PAPtxO9kKqXp4XvAG S2rduiLho/f2yuy8ranl4CHeqCnqTNCLJwlvXW1a2zAs1capq0A3PJWB8KDFtuUTH/F7 k1nU2tXPl4Aho8aflzGxy5Hp5W/yfSFA5xcGZvuQPhEo5I8Bac/OVA8QG57E89y61JRU prVToVBmgNK5VFby4lgFl5owOoExAefFsWb5nnad+1FEtPEBcIIAUlUytCkeB9xq8PHH ipSkZOB1OmzdHl9pIKJn72dRuU47tUea6JTZ9G/zWsux/FBMXz/IFxVrXKZBzNnhEGXl 2xaQ== 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:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=cdaAnkUJwowtFskE1jnezvCSjmf7OfsaigbewXS0J/c=; fh=/TyiCVzPJVYkT4NtrOYZRXAcrkaiLXA/rwqp4QqIc5M=; b=WC/Sf/9k3n0fy8yW3WCdXfr+PVpjBiNrmCR9XqKtLr9lHnnbwq9/bcU791qcGf/nHE ptVTSkqV2Ae2iPQtgfjRjvcAmyRxfj70QDnhHC0kBw9FBcMTIl3hr0lHQaNLRcNco/pa e0ef9WmENJKjtv7+/eepRjONJW/Y8v0l59BK3VRXiveAUBDE8pU/EXstVGljsjgirc09 3kcTeaQM2/vHBWAoKKpVnk7hs0OYEpoBDtcqcma5C37wfDacUB/raBDOuhdtaxwFelAO 1Cq14B9NbMQekMSHT89k14znYkxW58jqqi6Bk0SELq+L1Z0yk8b0VTUahRjfOeWdz2Ss BNzA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=dcxT2kCI; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id d75a77b69052e-444c2c3e3a6si79281461cf.508.2024.06.24.06.19.39 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 24 Jun 2024 06:19:39 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=dcxT2kCI; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sLjYt-0005ES-6V; Mon, 24 Jun 2024 09:16:48 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sLjYY-0004Wb-Jc for qemu-devel@nongnu.org; Mon, 24 Jun 2024 09:16:31 -0400 Received: from mail-lj1-x236.google.com ([2a00:1450:4864:20::236]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sLjYW-0005cc-Uf for qemu-devel@nongnu.org; Mon, 24 Jun 2024 09:16:26 -0400 Received: by mail-lj1-x236.google.com with SMTP id 38308e7fff4ca-2ec52fbb50cso21891711fa.2 for ; Mon, 24 Jun 2024 06:16:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1719234981; x=1719839781; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=cdaAnkUJwowtFskE1jnezvCSjmf7OfsaigbewXS0J/c=; b=dcxT2kCIg8m9Hm+Ga5mbs6X3mJ943gViHmm2gNoloOKAZtNngKXMetmVLFB3NO7Lpx S4bhDs7GDnMmrf1zgpSlm2Vc+AmGsR+FYhNofP2xe2e3xf+Mm0DHhj1evcVKzqA9l2Bo IRzcHAIXqG9H8K1kSDJvVLSw7CrCBHuLIjLsf03by7zQ3hMxIWG3wr5M54/WV2syG3Kq iykVAuVgRFBf4jDPUIEkhHHmw1M+MR2l6H8ewkW/kcXIBIsAtqCl3pIvt/xQrppTiuLT 6XVxBt2GpzBL9reAWXyZl7dHDH19cZoGg60eP0xfn1mEwPwEZcRkEIgPQzs+UGI5gHJq k9tQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719234981; x=1719839781; h=content-transfer-encoding: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=cdaAnkUJwowtFskE1jnezvCSjmf7OfsaigbewXS0J/c=; b=lLoUwfYIRXhdmdpLIgH9XIx2XWPAm/L4Wu+jJ4CVFmcFWVJi4g2IjNtoZPwVeqYXzi bTWOehH0vNQmGibbXcVnFmqBi0Y+se5M8QUO0HrwBK9z6VeMIjx5KO4yW2DxrrnDY6hr j7E3kYwwK6uf6mLuIsQNy8jy2PRAy1YfafOoZdJ4LmtOtalqjhniqvMeFWXkiAAHwjAg V1wOT9DzUJi3tfeeLMLfuaa3M7gCCRa52dhHvPDyjYgLukUBRwqHg+6WCa7WukhTVQEh EuS0dRgSQOMCMC3bNSddtOtIb7EHqkyyl9GlI1YZoq9QgO2tCTJyJbqMyU98DcJf/AFd 5ENA== X-Gm-Message-State: AOJu0YwK1EYW81hqreT21eT+mWlHIVfR0AP5gura0pB5rS09eIaJGG6M +dLnIDCntTm55AROdUD75nUYbsWJkTIJWAyA1hE7pzz7viFgRbMOgqXJ0rfSIe4dUi8wumOcLvs 1 X-Received: by 2002:a2e:890d:0:b0:2eb:e258:717f with SMTP id 38308e7fff4ca-2ec5b2f0400mr27285961fa.42.1719234981135; Mon, 24 Jun 2024 06:16:21 -0700 (PDT) Received: from m1x-phil.lan (bd137-h02-176-184-46-22.dsl.sta.abo.bbox.fr. [176.184.46.22]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4247d208e13sm171560425e9.36.2024.06.24.06.16.20 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 24 Jun 2024 06:16:20 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , =?utf-8?q?C?= =?utf-8?q?=C3=A9dric_Le_Goater?= Subject: [PULL 18/19] hw/sd/sdcard: Inline BLK_READ_BLOCK / BLK_WRITE_BLOCK macros Date: Mon, 24 Jun 2024 15:14:39 +0200 Message-ID: <20240624131440.81111-19-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240624131440.81111-1-philmd@linaro.org> References: <20240624131440.81111-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::236; envelope-from=philmd@linaro.org; helo=mail-lj1-x236.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org These macros only save 3 chars and make the code harder to maintain, simply remove them. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Cédric Le Goater Tested-by: Cédric Le Goater Message-Id: <20240621080554.18986-20-philmd@linaro.org> --- hw/sd/sd.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/hw/sd/sd.c b/hw/sd/sd.c index 969340e5cb..d4e3d079a8 100644 --- a/hw/sd/sd.c +++ b/hw/sd/sd.c @@ -819,8 +819,6 @@ static void sd_blk_write(SDState *sd, uint64_t addr, uint32_t len) } } -#define BLK_READ_BLOCK(a, len) sd_blk_read(sd, a, len) -#define BLK_WRITE_BLOCK(a, len) sd_blk_write(sd, a, len) #define APP_READ_BLOCK(a, len) memset(sd->data, 0xec, len) #define APP_WRITE_BLOCK(a, len) @@ -872,7 +870,7 @@ static void sd_erase(SDState *sd) continue; } } - BLK_WRITE_BLOCK(erase_addr, erase_len); + sd_blk_write(sd, erase_addr, erase_len); } } @@ -1903,7 +1901,7 @@ void sd_write_byte(SDState *sd, uint8_t value) if (sd->data_offset >= sd->blk_len) { /* TODO: Check CRC before committing */ sd->state = sd_programming_state; - BLK_WRITE_BLOCK(sd->data_start, sd->data_offset); + sd_blk_write(sd, sd->data_start, sd->data_offset); sd->blk_written ++; sd->csd[14] |= 0x40; /* Bzzzzzzztt .... Operation complete. */ @@ -1929,7 +1927,7 @@ void sd_write_byte(SDState *sd, uint8_t value) if (sd->data_offset >= sd->blk_len) { /* TODO: Check CRC before committing */ sd->state = sd_programming_state; - BLK_WRITE_BLOCK(sd->data_start, sd->data_offset); + sd_blk_write(sd, sd->data_start, sd->data_offset); sd->blk_written++; sd->data_start += sd->blk_len; sd->data_offset = 0; @@ -2077,8 +2075,9 @@ uint8_t sd_read_byte(SDState *sd) break; case 17: /* CMD17: READ_SINGLE_BLOCK */ - if (sd->data_offset == 0) - BLK_READ_BLOCK(sd->data_start, io_len); + if (sd->data_offset == 0) { + sd_blk_read(sd, sd->data_start, io_len); + } ret = sd->data[sd->data_offset ++]; if (sd->data_offset >= io_len) @@ -2091,7 +2090,7 @@ uint8_t sd_read_byte(SDState *sd) sd->data_start, io_len)) { return 0x00; } - BLK_READ_BLOCK(sd->data_start, io_len); + sd_blk_read(sd, sd->data_start, io_len); } ret = sd->data[sd->data_offset ++];