From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id F2257C433FE for ; Wed, 12 Oct 2022 05:37:13 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 25C8684D88; Wed, 12 Oct 2022 07:37:11 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com 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=gmail.com header.i=@gmail.com header.b="n7F98buc"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 8520D84C86; Wed, 12 Oct 2022 07:37:09 +0200 (CEST) Received: from mail-ed1-x529.google.com (mail-ed1-x529.google.com [IPv6:2a00:1450:4864:20::529]) (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 2260784C86 for ; Wed, 12 Oct 2022 07:37:07 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=ovpanait@gmail.com Received: by mail-ed1-x529.google.com with SMTP id s2so23029540edd.2 for ; Tue, 11 Oct 2022 22:37:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=FiPflPhbwbsHIJnoeMBmIKP53/wISuXv2gVeSkfl9RU=; b=n7F98bucgkihVjloz/21cA3GNjf41vGM+eiOMZznfm5nPy9gPQtNAKEn76NYqGG/0S JZXWEMyzuU3XtK01At/bJB5zlYaxudFHcGOLULE3neWMWDGUFQoax/Rcsra/Pvrli7Xm Dd8efwAkQYWTKvdeNGDARcLPClOTlj8I/jBsOpMLCU0pHm9YyRStiDn+R3ihi0bBIbUi 4B5y0+RWZzADGNm3BtGEwxlaM+qMAVYwdzwXYWoSRTVWyzxx/xJJlR9fe6BZj4BBf/Nr Dzc3ukUWBWoOPtfSnVAJWeM9lz33nbvV5fvNtndKtaOVwI3RWLNXjT41Z3Rl9cEJLVjf Whwg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=FiPflPhbwbsHIJnoeMBmIKP53/wISuXv2gVeSkfl9RU=; b=5nf8lmviAYJscgcTi/UshHF7bjLU6D0Lvlucd2lFR5egWqd3m1IY9pW9HKt8wBe3a7 Zz3eiuU703I4vJv2VEnzVHtDC+DCGGjEeCNQfaVNUq2ziiN6RFhq/AR6NSBxTyWONRWa 5u70mSlTthjHUDdNFoZKBCYOuI9bMWKrZ1CflHK4Gwdd1tTmJR9xZdJ7V41HxNIlogYw pOvCEmsPh5MKO+n6cigrqGOwtlfdMv383DD50R62/OcOkbixoX/v3XucFmeSLQ9FyxkQ g1kpzKIrWnyuZjgjkTm9A36rkGdvpNb7zQP6rtgD1RvXPMQp3x6lvYIsXyaebyLmoGw1 0SKQ== X-Gm-Message-State: ACrzQf2exG/Qk3Vy6+SqS6G52V3Zo/rO9fyizfmlcEX9G9Gw0tPFUHmb mfldulpejeETRXu5wx1VcTZqhO31MxwADg== X-Google-Smtp-Source: AMsMyM45yk52vxmQAX4/vRk8ncOeQwM10LsNlW1J57Wis5uSNjkiIpv3KmZf50xMMpW2tY9kbfdg6w== X-Received: by 2002:a05:6402:440d:b0:450:de54:3fcf with SMTP id y13-20020a056402440d00b00450de543fcfmr26044163eda.312.1665553026600; Tue, 11 Oct 2022 22:37:06 -0700 (PDT) Received: from localhost.localdomain ([2a02:2f0e:ca15:2800:c696:dfd3:f393:fcf7]) by smtp.gmail.com with ESMTPSA id i26-20020a170906265a00b00787f91a6b16sm644372ejc.26.2022.10.11.22.37.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 11 Oct 2022 22:37:06 -0700 (PDT) From: Ovidiu Panait To: u-boot@lists.denx.de Cc: Ovidiu Panait , Andy Shevchenko , Patrice Chotard , Simon Glass Subject: [PATCH 1/3] timer-uclass: add timer_get_ops() macro Date: Wed, 12 Oct 2022 08:36:54 +0300 Message-Id: <20221012053656.1492457-1-ovpanait@gmail.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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.6 at phobos.denx.de X-Virus-Status: Clean Align timer uclass with the other subsystems and provide a timer_get_ops() convenience macro. Using this instead of the generic device_get_ops() also prevents -Wdiscarded-qualifiers warnings when used with non-const variables. Signed-off-by: Ovidiu Panait --- drivers/timer/timer-uclass.c | 2 +- include/timer.h | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/timer/timer-uclass.c b/drivers/timer/timer-uclass.c index cbc3647698..bdc77b3822 100644 --- a/drivers/timer/timer-uclass.c +++ b/drivers/timer/timer-uclass.c @@ -32,7 +32,7 @@ DECLARE_GLOBAL_DATA_PTR; int notrace timer_get_count(struct udevice *dev, u64 *count) { - const struct timer_ops *ops = device_get_ops(dev); + struct timer_ops *ops = timer_get_ops(dev); if (!ops->get_count) return -ENOSYS; diff --git a/include/timer.h b/include/timer.h index a044cb034e..d33a26e28f 100644 --- a/include/timer.h +++ b/include/timer.h @@ -6,6 +6,8 @@ #ifndef _TIMER_H_ #define _TIMER_H_ +#define timer_get_ops(dev) ((struct timer_ops *)(dev)->driver->ops) + /** * dm_timer_init() - initialize a timer for time keeping. On success * initializes gd->timer so that lib/timer can use it for future -- 2.25.1