Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp2132792pxa; Mon, 17 Aug 2020 01:27:23 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxgQbkeL3wKepapAc5Lsnpe8Ha4jFiQ5pBt9dCyBatnSaydtST7QU1SZGREfRSgGzGh8KiN X-Received: by 2002:aa7:c74f:: with SMTP id c15mr14016081eds.331.1597652843295; Mon, 17 Aug 2020 01:27:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597652843; cv=none; d=google.com; s=arc-20160816; b=eLsCKxEy5OKu0vqZSqTuqaIITwAsgluLFUNPSP5q63WsmkLK+PzMRFK5b+NJsn/1Mk Ouh4Mzmx15Z+JOpdcramlrbJzNiMOTKfAMrcpKukLXbcQiSjB3i3ozb8FvVu6wkZ7vVC JayQyZ8X9GQKs7HbjdwT72FO5vcWkP6KRmkTxoRUTXq5L9ua8/6wdlMAiwsomt1LEaLx BtCceuQu+vEyAsM1x82BqVsoCXhbfYA49hVAZTeDpP4PPjqVtTHdhQgEk4WCgWn8sAJj QezNoZ9Sa9e8tu7yc8LhGKADFV9m015POeYI4L2qAaLqNmDbxNaZI2paAfL72XSvSKsv WGmg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=NGc9GivMW4Gl2PZYS1sshtdVeD119m/l6GvQX46weos=; b=YSAvfwZGRku9k4/GFgQg+KumLH5aQHeZPY5Cdj7p4oqKWRH0dTnjsTiUvBWQ7C2KG9 QZ/G1lApOJraGt4tReBp+nAU+DXS/G0gXFUzkMUaMELmP8Ec6eJk90S9V56ZErZ5ZLIf GA6sYLnb9mK55t2fMcq+BPtG0gngN0q9hpXD1xncdOoEAIfanyCVxq77gReiYq06cdT7 GlJizQtQWJrkf6+/oHMCO6u81WkcGn5nFzdS8dSzbeDXxytEA0MoxyPDj4dLglfEwuat 900mrTPEUeUD5PshKeSJKL6fINgMyWVqPQlABqef6I3Z4egnCN18herInvbdqEoBvrRh U73g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=LBLxHBYX; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id n17si5979235edt.242.2020.08.17.01.27.00; Mon, 17 Aug 2020 01:27:23 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=LBLxHBYX; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727112AbgHQI0a (ORCPT + 99 others); Mon, 17 Aug 2020 04:26:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52706 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728404AbgHQI0S (ORCPT ); Mon, 17 Aug 2020 04:26:18 -0400 Received: from mail-pl1-x644.google.com (mail-pl1-x644.google.com [IPv6:2607:f8b0:4864:20::644]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 809D8C061388; Mon, 17 Aug 2020 01:26:18 -0700 (PDT) Received: by mail-pl1-x644.google.com with SMTP id s14so1164890plp.4; Mon, 17 Aug 2020 01:26:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=NGc9GivMW4Gl2PZYS1sshtdVeD119m/l6GvQX46weos=; b=LBLxHBYXHHShApS1V6EqhqlERMx39IJoGg9XyyNS0xxKKPf7wzJlvUp7OZH7MsJNbk Hhy8KpiRMnmdXLU49x03cAV9Hb30GjB3mLnkNXIVN7t7SxDQ0pzRJNjp101YiuBGrc6h +OaSLNfkE2xI7g79vNgCQ+sgLmy75Y0bBKtNhkfSvXuudjABMDUQL5Enx7nI0chgO32d t5Vq04PRATxJxYQ15CIpAo/xswWJNmoEItx+gz7uWetOIqMKbHGTpI5tFRruhMbNCxzv d36pjAk2F3GLgsY9HZ1tEBwdbzTGHHfWhsaWugChVMUm6Bu0PrSMhwW9pPUh7m5In5hF 8d0w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=NGc9GivMW4Gl2PZYS1sshtdVeD119m/l6GvQX46weos=; b=WbehfnymTJS+u/d4NtI1QlPz8bVfbZnnukB/8Dmkm7zzrQDKwUv0uSpi1YFNI6+sxs yZ72oSii+Ayeg7m7c0V4MpeGJfyTQirk8cpW/AUeQuzHSxY95hz9CROweSEgOcat4Pcf ByfCHyJK8Nyjhd6mRDLsJOFXNh414yJRztuZAtb6/DsiKFV1/YoeoBz8sg+nNyjZNH2i 05hDaw7kmrQrryG26Tide2RvnV3vwev+aOK7Y76i+QouvBae/sNh4FYXkXjc471vL7dD 55aGbE8n6mFr7vunfROoFAiul2hxEcqg6jzAm1ei6uh/bbl5gLQ0EW0xm1uJGUxXWniw TTtw== X-Gm-Message-State: AOAM531tIP2JDNXu3V/jpXaJVFJ0H5/xd8YK4tt2KCoYPmN3N7d97v4T xcPcmcWDcIrKk8NEGgEKgG0= X-Received: by 2002:a17:90b:208:: with SMTP id fy8mr11168449pjb.131.1597652778097; Mon, 17 Aug 2020 01:26:18 -0700 (PDT) Received: from localhost.localdomain ([49.207.202.98]) by smtp.gmail.com with ESMTPSA id r186sm19928482pfr.162.2020.08.17.01.26.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 17 Aug 2020 01:26:17 -0700 (PDT) From: Allen Pais To: jes@trained-monkey.org, davem@davemloft.net, kuba@kernel.org, kda@linux-powerpc.org, dougmill@linux.ibm.com, cooldavid@cooldavid.org, mlindner@marvell.com, borisp@mellanox.com Cc: keescook@chromium.org, linux-acenic@sunsite.dk, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linuxppc-dev@lists.ozlabs.org, linux-rdma@vger.kernel.org, oss-drivers@netronome.com, Allen Pais , Romain Perier Subject: [PATCH 14/20] ethernet: micrel: convert tasklets to use new tasklet_setup() API Date: Mon, 17 Aug 2020 13:54:28 +0530 Message-Id: <20200817082434.21176-16-allen.lkml@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200817082434.21176-1-allen.lkml@gmail.com> References: <20200817082434.21176-1-allen.lkml@gmail.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org In preparation for unconditionally passing the struct tasklet_struct pointer to all tasklet callbacks, switch to using the new tasklet_setup() and from_tasklet() to pass the tasklet pointer explicitly. Signed-off-by: Romain Perier Signed-off-by: Allen Pais --- drivers/net/ethernet/micrel/ks8842.c | 19 ++++++++++--------- drivers/net/ethernet/micrel/ksz884x.c | 14 ++++++-------- 2 files changed, 16 insertions(+), 17 deletions(-) diff --git a/drivers/net/ethernet/micrel/ks8842.c b/drivers/net/ethernet/micrel/ks8842.c index f3f6dfe3eddc..8fd32f98c494 100644 --- a/drivers/net/ethernet/micrel/ks8842.c +++ b/drivers/net/ethernet/micrel/ks8842.c @@ -587,10 +587,11 @@ static int __ks8842_start_new_rx_dma(struct net_device *netdev) return err; } -static void ks8842_rx_frame_dma_tasklet(unsigned long arg) +static void ks8842_rx_frame_dma_tasklet(struct tasklet_struct *t) { - struct net_device *netdev = (struct net_device *)arg; - struct ks8842_adapter *adapter = netdev_priv(netdev); + struct ks8842_adapter *adapter = from_tasklet(adapter, t, dma_rx.tasklet); + struct net_device *netdev = (struct net_device *)((char *)adapter - + ALIGN(sizeof(struct net_device), NETDEV_ALIGN)); struct ks8842_rx_dma_ctl *ctl = &adapter->dma_rx; struct sk_buff *skb = ctl->skb; dma_addr_t addr = sg_dma_address(&ctl->sg); @@ -720,10 +721,11 @@ static void ks8842_handle_rx_overrun(struct net_device *netdev, netdev->stats.rx_fifo_errors++; } -static void ks8842_tasklet(unsigned long arg) +static void ks8842_tasklet(struct tasklet_struct *t) { - struct net_device *netdev = (struct net_device *)arg; - struct ks8842_adapter *adapter = netdev_priv(netdev); + struct ks8842_adapter *adapter = from_tasklet(adapter, t, tasklet); + struct net_device *netdev = (struct net_device *)((char *)adapter - + ALIGN(sizeof(struct net_device), NETDEV_ALIGN)); u16 isr; unsigned long flags; u16 entry_bank; @@ -953,8 +955,7 @@ static int ks8842_alloc_dma_bufs(struct net_device *netdev) goto err; } - tasklet_init(&rx_ctl->tasklet, ks8842_rx_frame_dma_tasklet, - (unsigned long)netdev); + tasklet_setup(&rx_ctl->tasklet, ks8842_rx_frame_dma_tasklet); return 0; err: @@ -1173,7 +1174,7 @@ static int ks8842_probe(struct platform_device *pdev) adapter->dma_tx.channel = -1; } - tasklet_init(&adapter->tasklet, ks8842_tasklet, (unsigned long)netdev); + tasklet_setup(&adapter->tasklet, ks8842_tasklet); spin_lock_init(&adapter->lock); netdev->netdev_ops = &ks8842_netdev_ops; diff --git a/drivers/net/ethernet/micrel/ksz884x.c b/drivers/net/ethernet/micrel/ksz884x.c index bb646b65cc95..5130507bbf54 100644 --- a/drivers/net/ethernet/micrel/ksz884x.c +++ b/drivers/net/ethernet/micrel/ksz884x.c @@ -5159,9 +5159,9 @@ static int dev_rcv_special(struct dev_info *hw_priv) return received; } -static void rx_proc_task(unsigned long data) +static void rx_proc_task(struct tasklet_struct *t) { - struct dev_info *hw_priv = (struct dev_info *) data; + struct dev_info *hw_priv = from_tasklet(hw_priv, t, rx_tasklet); struct ksz_hw *hw = &hw_priv->hw; if (!hw->enabled) @@ -5181,9 +5181,9 @@ static void rx_proc_task(unsigned long data) } } -static void tx_proc_task(unsigned long data) +static void tx_proc_task(struct tasklet_struct *t) { - struct dev_info *hw_priv = (struct dev_info *) data; + struct dev_info *hw_priv = from_tasklet(hw_priv, t, tx_tasklet); struct ksz_hw *hw = &hw_priv->hw; hw_ack_intr(hw, KS884X_INT_TX_MASK); @@ -5436,10 +5436,8 @@ static int prepare_hardware(struct net_device *dev) rc = request_irq(dev->irq, netdev_intr, IRQF_SHARED, dev->name, dev); if (rc) return rc; - tasklet_init(&hw_priv->rx_tasklet, rx_proc_task, - (unsigned long) hw_priv); - tasklet_init(&hw_priv->tx_tasklet, tx_proc_task, - (unsigned long) hw_priv); + tasklet_setup(&hw_priv->rx_tasklet, rx_proc_task); + tasklet_setup(&hw_priv->tx_tasklet, tx_proc_task); hw->promiscuous = 0; hw->all_multi = 0; -- 2.17.1