From patchwork Thu Feb 1 15:57:12 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marco Pagani X-Patchwork-Id: 13541323 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (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 20A705F48A for ; Thu, 1 Feb 2024 15:57:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706803045; cv=none; b=FP9y7VZ9Gcg2czkWrM7hgLaOEzNRsKJZ2uGbVgOx+rqjeTRRWE8CCDyMfiU4lA9tDrY/vgRuF5GpxBvFeAk9NC8Dhe1clVnkY9UM0+b4Q2oEf6NM88m7gReXXjH9gaEDhsLefe+t4hfTGq13hPbfqbJz+ozgiualqjQ9wm56xl4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706803045; c=relaxed/simple; bh=Ct9xSYNdsoUYPlLCIr1Z8RBdDVFWjZUVGlWdpOnjEPM=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=Kt+fqkT3gtRnP1AbBFf7uQEKw5GPfDYJT6IUJeU4Z1XovtDP377jxWHORC8EaFiQLJBAs6VET5XmB/6jD8545eh8Ab/kspwuI/0GowSrYRajE0mofIWvIsffgRkjfK8w153mLcDqnAe39x1t20QDJa4IxlASwHddLKO3WA5F850= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=UgxXoyMV; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="UgxXoyMV" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1706803042; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=maGHN87wG8MBtliTQkYWRfmgkGSGFEAxdtgNEgO8IZs=; b=UgxXoyMVr+kpoYiJ2/c9Udil7WsOFk8Ze395n8VS05Ipll/pkCArJGlsZS5Zokthtpz4Uh DBR8RuSXKrnTrOauQW8dQO4W9NdZtiCwuootn2yCUEsinNB/mWhdY8iBu6MBpUVkr1T31O lkEuPfB2V+pkdx0q/WKV/w5AHcKUWH0= Received: from mail-wm1-f71.google.com (mail-wm1-f71.google.com [209.85.128.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-582-lO5yVx8UOr-WvURb1TPPHQ-1; Thu, 01 Feb 2024 10:57:20 -0500 X-MC-Unique: lO5yVx8UOr-WvURb1TPPHQ-1 Received: by mail-wm1-f71.google.com with SMTP id 5b1f17b1804b1-40eb06001c2so6350985e9.0 for ; Thu, 01 Feb 2024 07:57:20 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706803039; x=1707407839; 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=maGHN87wG8MBtliTQkYWRfmgkGSGFEAxdtgNEgO8IZs=; b=jAfPxd+INBpxwD0e4C7kVm6hzNos1UoJRjMNWB69ng194GgPr5T80TdEEapCgNnRO5 r3xI6KYED0lxIZR1lJhPUnJQF8A7CPK/xnpWgo1IEfYW6TK4zkAtm1sftnbpHJn4OqoF a8cuisn3kBlfDNMfMV+p7ZSUeG2U00IQawN0FlHQSvkDwd+haI48DIwPDoPcmuE7PN8h DD2U1c6Ex4fAPyc+kv9QtaMFCsj0dPWNLw3augjkazhCSqqjKpr5Nav0l4j8iEzuof4g btKZg1wmMimcsXSmGPLCUakVBhj5gpISyE6DQLQ2wC0dmC0x6gtUd0ieH97OzImrRw2p fIcA== X-Gm-Message-State: AOJu0YxllgBca9GhGCbROkASP1cI/iuYv+G5pmyLoaSlDTz6a5sA8cTE 90NcMoaEsvdtuisVR0S4akXigtLXLD2+jt6YizxbLl2GxiLH0T04HKNq2PiLG9d40dgcrLDAdsN u3H9XNYc+KiCeXsMD2ysOi7liXEY4xje7jjhiQ/oxRwuLoV4e3EhSHn/XLA== X-Received: by 2002:a05:600c:314b:b0:40f:993e:35ae with SMTP id h11-20020a05600c314b00b0040f993e35aemr4442920wmo.14.1706803039754; Thu, 01 Feb 2024 07:57:19 -0800 (PST) X-Google-Smtp-Source: AGHT+IH0W0gGAxhS7AvbYOR9IEMsbmKNAe1JnmjE9uWIlOec2Coqj66ic87Sx6Ko0Th2X1uXOusXgg== X-Received: by 2002:a05:600c:314b:b0:40f:993e:35ae with SMTP id h11-20020a05600c314b00b0040f993e35aemr4442906wmo.14.1706803039457; Thu, 01 Feb 2024 07:57:19 -0800 (PST) X-Forwarded-Encrypted: i=0; AJvYcCVVL2cyWQ+Jf0SpCRWNSmfCwuUPXNMVjyTUc7J9FC2UlhRkR+a2gh3QC4k94e6OappUvffd+ushGyqs8r0EsvRO/mmZ9tPh5KB+vCQhj/wqPvw0lVp06H6006DvZPfLw+NEyZGaxH0K97AMtex95t5Q9YaW2gsC/5MKO2OZks9jKEOWGKPFk+pQVhZgcqWg5KZL3M6pjrJzxisPuO7rdpo= Received: from klayman.redhat.com (net-2-34-24-75.cust.vodafonedsl.it. [2.34.24.75]) by smtp.gmail.com with ESMTPSA id v8-20020a05600c444800b0040e54f15d3dsm4849557wmn.31.2024.02.01.07.57.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 Feb 2024 07:57:19 -0800 (PST) From: Marco Pagani To: Moritz Fischer , Wu Hao , Xu Yilun , Tom Rix Cc: Marco Pagani , linux-fpga@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2] fpga: remove redundant checks for bridge ops Date: Thu, 1 Feb 2024 16:57:12 +0100 Message-ID: <20240201155713.82898-1-marpagan@redhat.com> X-Mailer: git-send-email 2.43.0 Precedence: bulk X-Mailing-List: linux-fpga@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Commit 0d70af3c2530 ("fpga: bridge: Use standard dev_release for class driver") introduced a check in fpga_bridge_register() that prevents registering a bridge without ops, making checking on every call redundant. v2: - removed ops check also in state_show() Signed-off-by: Marco Pagani Acked-by: Xu Yilun --- drivers/fpga/fpga-bridge.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) base-commit: c849ecb2ae8413f86c84627cb0af06dffce4e215 diff --git a/drivers/fpga/fpga-bridge.c b/drivers/fpga/fpga-bridge.c index a024be2b84e2..79c473b3c7c3 100644 --- a/drivers/fpga/fpga-bridge.c +++ b/drivers/fpga/fpga-bridge.c @@ -30,7 +30,7 @@ int fpga_bridge_enable(struct fpga_bridge *bridge) { dev_dbg(&bridge->dev, "enable\n"); - if (bridge->br_ops && bridge->br_ops->enable_set) + if (bridge->br_ops->enable_set) return bridge->br_ops->enable_set(bridge, 1); return 0; @@ -48,7 +48,7 @@ int fpga_bridge_disable(struct fpga_bridge *bridge) { dev_dbg(&bridge->dev, "disable\n"); - if (bridge->br_ops && bridge->br_ops->enable_set) + if (bridge->br_ops->enable_set) return bridge->br_ops->enable_set(bridge, 0); return 0; @@ -296,7 +296,7 @@ static ssize_t state_show(struct device *dev, struct fpga_bridge *bridge = to_fpga_bridge(dev); int state = 1; - if (bridge->br_ops && bridge->br_ops->enable_show) { + if (bridge->br_ops->enable_show) { state = bridge->br_ops->enable_show(bridge); if (state < 0) return state; @@ -401,7 +401,7 @@ void fpga_bridge_unregister(struct fpga_bridge *bridge) * If the low level driver provides a method for putting bridge into * a desired state upon unregister, do it. */ - if (bridge->br_ops && bridge->br_ops->fpga_bridge_remove) + if (bridge->br_ops->fpga_bridge_remove) bridge->br_ops->fpga_bridge_remove(bridge); device_unregister(&bridge->dev);