Received: by 2002:a89:288:0:b0:1f7:eeee:6653 with SMTP id j8csp107013lqh; Mon, 6 May 2024 12:47:44 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWtNC0WDVKOF+PkhECiGMorW+ZKTS6HKaSvz/RrHdXgROX47xCvZEmgHwSiBnv5RZxnobZ9xx9b2cs2XKnxYp6GXdCjxYedo9HC/1dJPQ== X-Google-Smtp-Source: AGHT+IH0W3g+bkNeA64tZG6+xCG6RLeFbp0+bu/xajzK35OlKA/n9//IngjMqTV9APYT81gz0ECX X-Received: by 2002:a05:6a21:3e02:b0:1ae:42f1:7e52 with SMTP id bk2-20020a056a213e0200b001ae42f17e52mr14108554pzc.6.1715024864284; Mon, 06 May 2024 12:47:44 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715024864; cv=pass; d=google.com; s=arc-20160816; b=Y2emte5u9JwOcZ4MSpny6GOnlBdaX91/QxOlfhI99Jox3PBKC92jfBkikzGKX/1uYB 4w09dOnURwIKiIjhQBIrOy3x8YShT08Jq0Q1C0qwexrq7E8r52csvXoCbZXNN/30PT8d y2AL269DIGcKHRD2a5bkUl/ZS31gySzsZ4ccQCqEWhwEs2l0n5sVa6do0q5Y/zueRQuZ 0Er/tVnEkaV3bwdIyYExwQTevTkJMr7kymN6bwgpEj6bwBQ5xJtu3hTYEBSqWpJbQirw uzOika86bO9PlTeBQkYoi7p3A9eeLlqcmcCH10mrR21S7hhoX/YhaCpi3p6oRxvhfNgK jidg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:list-unsubscribe:list-subscribe:list-id:precedence :content-transfer-encoding:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=aH/CEYtXdCPSJ9Q/mQVEl+JZf6khZ14VjjTJYXXXKvs=; fh=+ublBM+9GGWYoKbssKiMLEYTC/PmLwBCGlvV+Nagl9Q=; b=ntKrDOBI9K25HalGJK77U2hMxZktdWxC376j8Ng+BkGRNA9w5M9MfJMv4vgjOkX/n8 fHD9knLzE5Z6MTuHdJWpgAlp8q3Ol6lkfxYB63aVOYsToVZ5js7Kr4sZ/ccKU/BGM+wE JN8Rv8lx/0ktuDzj3yCeNf5OSwpfMw1N6M1q99zVrxEaOgWLNyaZZw1onaFTM1TjqGhw Mno4bZwnFExq0sE8IbnGnHbslg3ILJgN8gz0GdAcxuf6t4eKRQd3AuZFFUpcKXgAMU2v bcnnpx5OarSQ06SvQNlJNfrwciEX9HCZ/er0FAPxkH592bkVVobKGw6Hw8tnRE8MMqoM BHPA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=I3UFXPEx; arc=pass (i=1 spf=pass spfdomain=linux.ibm.com dkim=pass dkdomain=ibm.com dmarc=pass fromdomain=linux.ibm.com); spf=pass (google.com: domain of linux-kernel+bounces-170368-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-170368-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=NONE dis=NONE) header.from=ibm.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id j2-20020aa78dc2000000b006f45520f6fasi4914170pfr.307.2024.05.06.12.47.44 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 May 2024 12:47:44 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-170368-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=I3UFXPEx; arc=pass (i=1 spf=pass spfdomain=linux.ibm.com dkim=pass dkdomain=ibm.com dmarc=pass fromdomain=linux.ibm.com); spf=pass (google.com: domain of linux-kernel+bounces-170368-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-170368-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=NONE dis=NONE) header.from=ibm.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id B934C2815ED for ; Mon, 6 May 2024 19:47:43 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 80FD815E214; Mon, 6 May 2024 19:45:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b="I3UFXPEx" Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) (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 9178215B140; Mon, 6 May 2024 19:45:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=148.163.158.5 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715024712; cv=none; b=uK9klFPVfsB2+ePEmwwrh1FLuRAd8rdjAH3QNgo0NciYYQTpSNzSyAbcoVeBcvGlHvcumpeaID0ve+hRhYNAutBxCDUWCyZHTFxpu/auiLl3VSOYBLOH9gSpdG6L1QLt3yEvVXBjVKCjZn3lE8kIiF+fIeK9wmL/N+E0MJoAkS0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715024712; c=relaxed/simple; bh=kUwVALdxu99SEPBl/ePsq2cQ7vLy7Q2eLMzidY2/w34=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=Er1PMAwanGHEdvKlpvzEObXjMda4ptEAbWsuZdxP+CtBVkpj3xahWARn42pU4fnzHkx06q9obEarUp0GR3VDDjq0KGdwm+LQ/7WxCbw50fjXd1Bi3v5LydmHuHBNE3lW7O8WylsrcmhNGiDZ8s0vQj2wVoQd5bYDAnYezavrJmc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com; spf=pass smtp.mailfrom=linux.ibm.com; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b=I3UFXPEx; arc=none smtp.client-ip=148.163.158.5 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.ibm.com Received: from pps.filterd (m0360072.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 446JcOOF029249; Mon, 6 May 2024 19:45:03 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : mime-version; s=pp1; bh=aH/CEYtXdCPSJ9Q/mQVEl+JZf6khZ14VjjTJYXXXKvs=; b=I3UFXPEx9VOr4BT6/fHk5e056GNCv23l9gqJCeS1asPm+732DivC4/6Y3NAYaMZgvm06 lNULR8+MZCYp3Bk7vmrujoSsb0wnLhczdYpT4MCY/txf51fnKcdWvCp4uA9Wrj+bLc9T 6CIMnfslMwZKyKndr1Ehaqm3EWRi0lVeZU4U26T+JDO58wBaVFNK3hmjMMIDiTZ7FCOa nuU3KL072PIC1CDOjugdWMjKw7MZNq5H3rOPhsmp68MXJ8t0f0JYh/tf72a6dz/P9b3y 7s2t00bgsm5gWp7o9CcA9kDdueJRA+T16OarpwnMEEUYR/OBa0z/4pgnI/9+4o0tiNgM Mw== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3xy5hpr0d3-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 06 May 2024 19:45:02 +0000 Received: from m0360072.ppops.net (m0360072.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 446Jj28U006197; Mon, 6 May 2024 19:45:02 GMT Received: from ppma21.wdc07v.mail.ibm.com (5b.69.3da9.ip4.static.sl-reverse.com [169.61.105.91]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3xy5hpr0d1-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 06 May 2024 19:45:02 +0000 Received: from pps.filterd (ppma21.wdc07v.mail.ibm.com [127.0.0.1]) by ppma21.wdc07v.mail.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 446IeNob010569; Mon, 6 May 2024 19:45:01 GMT Received: from smtprelay01.fra02v.mail.ibm.com ([9.218.2.227]) by ppma21.wdc07v.mail.ibm.com (PPS) with ESMTPS id 3xx0bp1vhs-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 06 May 2024 19:45:01 +0000 Received: from smtpav07.fra02v.mail.ibm.com (smtpav07.fra02v.mail.ibm.com [10.20.54.106]) by smtprelay01.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 446Jit8K53150186 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 6 May 2024 19:44:57 GMT Received: from smtpav07.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id B0DF42004B; Mon, 6 May 2024 19:44:55 +0000 (GMT) Received: from smtpav07.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 7DE3C2005A; Mon, 6 May 2024 19:44:55 +0000 (GMT) Received: from tuxmaker.boeblingen.de.ibm.com (unknown [9.152.85.9]) by smtpav07.fra02v.mail.ibm.com (Postfix) with ESMTP; Mon, 6 May 2024 19:44:55 +0000 (GMT) From: Heiko Carstens To: Nathan Chancellor , Arnd Bergmann , Thomas Huth , Alexandra Winter , Thorsten Winkler , Andrew Morton , Jiri Slaby , Greg Kroah-Hartman Cc: linux-kernel@vger.kernel.org, linux-s390@vger.kernel.org, Vasily Gorbik , Alexander Gordeev , netdev@vger.kernel.org, llvm@lists.linux.dev, patches@lists.linux.dev, Sven Schnelle , Christian Borntraeger Subject: [PATCH 3/6] s390/netiucv: Make use of iucv_alloc_device() Date: Mon, 6 May 2024 21:44:51 +0200 Message-Id: <20240506194454.1160315-4-hca@linux.ibm.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20240506194454.1160315-1-hca@linux.ibm.com> References: <20240506194454.1160315-1-hca@linux.ibm.com> X-TM-AS-GCONF: 00 X-Proofpoint-GUID: kQtvJvvNIoCKbNOIsoI4TtTTEEepSEJy X-Proofpoint-ORIG-GUID: Rjx8IQLUet9Fqag0Ej5DQWBKoJtB0Ge8 Content-Transfer-Encoding: 8bit X-Proofpoint-UnRewURL: 0 URL was un-rewritten Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.650,FMLib:17.11.176.26 definitions=2024-05-06_13,2024-05-06_02,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 mlxscore=0 adultscore=0 mlxlogscore=999 malwarescore=0 impostorscore=0 lowpriorityscore=0 bulkscore=0 spamscore=0 suspectscore=0 clxscore=1015 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2404010000 definitions=main-2405060141 Make use of iucv_alloc_device() to get rid of quite some code. In addition this also removes a cast to an incompatible function (clang W=1): drivers/s390/net/netiucv.c:1716:18: error: cast from 'void (*)(const void *)' to 'void (*)(struct device *)' converts to incompatible function type [-Werror,-Wcast-function-type-strict] 1716 | dev->release = (void (*)(struct device *))kfree; | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Reported-by: Nathan Chancellor Closes: https://lore.kernel.org/r/20240417-s390-drivers-fix-cast-function-type-v1-3-fd048c9903b0@kernel.org Signed-off-by: Heiko Carstens --- drivers/s390/net/netiucv.c | 20 ++++---------------- 1 file changed, 4 insertions(+), 16 deletions(-) diff --git a/drivers/s390/net/netiucv.c b/drivers/s390/net/netiucv.c index 8852b03f943b..039e18d46f76 100644 --- a/drivers/s390/net/netiucv.c +++ b/drivers/s390/net/netiucv.c @@ -1696,26 +1696,14 @@ static const struct attribute_group *netiucv_attr_groups[] = { static int netiucv_register_device(struct net_device *ndev) { struct netiucv_priv *priv = netdev_priv(ndev); - struct device *dev = kzalloc(sizeof(struct device), GFP_KERNEL); + struct device *dev; int ret; IUCV_DBF_TEXT(trace, 3, __func__); - if (dev) { - dev_set_name(dev, "net%s", ndev->name); - dev->bus = &iucv_bus; - dev->parent = iucv_root; - dev->groups = netiucv_attr_groups; - /* - * The release function could be called after the - * module has been unloaded. It's _only_ task is to - * free the struct. Therefore, we specify kfree() - * directly here. (Probably a little bit obfuscating - * but legitime ...). - */ - dev->release = (void (*)(struct device *))kfree; - dev->driver = &netiucv_driver; - } else + dev = iucv_alloc_device(netiucv_attr_groups, &netiucv_driver, NULL, + "net%s", ndev->name); + if (!dev) return -ENOMEM; ret = device_register(dev); -- 2.40.1