From patchwork Tue Oct 27 16:35:59 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Neil Armstrong X-Patchwork-Id: 536730 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 3B56314030E for ; Wed, 28 Oct 2015 03:36:53 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=baylibre_com.20150623.gappssmtp.com header.i=@baylibre_com.20150623.gappssmtp.com header.b=cnzwcnBC; dkim-atps=neutral Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S964950AbbJ0Qgt (ORCPT ); Tue, 27 Oct 2015 12:36:49 -0400 Received: from mail-wi0-f178.google.com ([209.85.212.178]:35990 "EHLO mail-wi0-f178.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965047AbbJ0QgE (ORCPT ); Tue, 27 Oct 2015 12:36:04 -0400 Received: by wicfx6 with SMTP id fx6so167769929wic.1 for ; Tue, 27 Oct 2015 09:36:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre_com.20150623.gappssmtp.com; s=20150623; h=from:subject:to:cc:organization:message-id:date:user-agent :mime-version:content-type:content-transfer-encoding; bh=3HE9d4Gg+K4KgibcRdICItclGQNF4w++3Ko5ghjHM0c=; b=cnzwcnBCE4Z5TodsKwPJZhwfeMCzl+ZxpNueQ4S7ujoJYIMZupe8OgVVJgnWtBSLgP Zq6U2IUfdWmwsBwD3zXUQSqsr/zBWerRPzw4dgXRbjXoyTdwhGvhTFKgAZhNEvsKrXsC JGAeUbV+uVOmFvCbDMOUB1/N5HS+rfI1a3NnLztnhOy+ElPNunpM0zsMZ2J+irmhJbC/ uSYNdKLQFN/5efG78yPHNwUGuwPWwDzC1cF9vnCGvvf3//CvqaCzl/Qr+dzwAFmpod+5 KvCvNizToOrbdd1tH+1LhlRKPf2yFeO0QJGTxQs7cUAoHbSdGdrysxHUbB0Nh1aDpZ1l NejQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:subject:to:cc:organization:message-id:date :user-agent:mime-version:content-type:content-transfer-encoding; bh=3HE9d4Gg+K4KgibcRdICItclGQNF4w++3Ko5ghjHM0c=; b=SJYe4du5oEdeuoaSddr66gx9VvAR6e+u3jfJ1OxbxdOa5DBLTVc43FfysuVe39u6Ol FAmPAWsCwcDTMxS3nnMK7rvtYRn6DA3TEN036BeCqCbkcDotoiDyeWzpYklSIBlmlcFk 9d/jnTM0+sWhAkI2dYPZwPGvk4tmqbh4q2KKwTYuA1Jbrx0kCPts0YNiO5IV3O0Z6lgc IqwvVrQbOclL2uKA1tVhxHg1/USHjgwj5f1FN1KDuGiDiS5ZnUMORGldjNg6G/g0C7dW aY840/kwaKP40kN/BKBUotx3v67IT15cExORI7sELZ/K9X+20ss03YlvHVsK6qwEO2xr 6doA== X-Gm-Message-State: ALoCoQmC9j0TIXJIMZvGh+1fY9H0SS84V58Y0yajoZVLd/Aqx3TeztVHDrHuQxy93hLH8E9bOkgp X-Received: by 10.180.74.47 with SMTP id q15mr29415477wiv.73.1445963762700; Tue, 27 Oct 2015 09:36:02 -0700 (PDT) Received: from [192.168.2.52] (cag06-6-78-235-100-105.fbx.proxad.net. [78.235.100.105]) by smtp.gmail.com with ESMTPSA id by11sm14797237wib.13.2015.10.27.09.36.00 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 27 Oct 2015 09:36:02 -0700 (PDT) From: Neil Armstrong Subject: [RFC PATCH 2/3] net: dsa: mv88e6xxx: add common and ppu remove function To: "David S. Miller" Cc: Andrew Lunn , Florian Fainelli , Guenter Roeck , vivien.didelot@savoirfairelinux.com, Fabian Frederick , Pavel Nakonechny , Joe Perches , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Organization: Baylibre Message-ID: <562FA7EF.3030505@baylibre.com> Date: Tue, 27 Oct 2015 17:35:59 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.2.0 MIME-Version: 1.0 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org With the previously introduced remove callback, add a mv88e6xxx common remove function to cleanup all ressources. Signed-off-by: Neil Armstrong --- drivers/net/dsa/mv88e6xxx.c | 18 ++++++++++++++++++ drivers/net/dsa/mv88e6xxx.h | 2 ++ 2 files changed, 20 insertions(+) diff --git a/drivers/net/dsa/mv88e6xxx.c b/drivers/net/dsa/mv88e6xxx.c index b1b14f5..6287096 100644 --- a/drivers/net/dsa/mv88e6xxx.c +++ b/drivers/net/dsa/mv88e6xxx.c @@ -331,6 +331,16 @@ void mv88e6xxx_ppu_state_init(struct dsa_switch *ds) ps->ppu_timer.function = mv88e6xxx_ppu_reenable_timer; } +void mv88e6xxx_ppu_state_remove(struct dsa_switch *ds) +{ + struct mv88e6xxx_priv_state *ps = ds_to_priv(ds); + + del_timer_sync(&ps->ppu_timer); + + cancel_work_sync(&ps->bridge_work); + flush_work(&ps->bridge_work); +} + int mv88e6xxx_phy_read_ppu(struct dsa_switch *ds, int addr, int regnum) { int ret; @@ -2083,6 +2093,14 @@ int mv88e6xxx_setup_common(struct dsa_switch *ds) return 0; } +void mv88e6xxx_remove_common(struct dsa_switch *ds) +{ + struct mv88e6xxx_priv_state *ps = ds_to_priv(ds); + + cancel_work_sync(&ps->bridge_work); + flush_work(&ps->bridge_work); +} + int mv88e6xxx_setup_global(struct dsa_switch *ds) { struct mv88e6xxx_priv_state *ps = ds_to_priv(ds); diff --git a/drivers/net/dsa/mv88e6xxx.h b/drivers/net/dsa/mv88e6xxx.h index 6f9ed5d..64d37a0 100644 --- a/drivers/net/dsa/mv88e6xxx.h +++ b/drivers/net/dsa/mv88e6xxx.h @@ -417,6 +417,7 @@ struct mv88e6xxx_hw_stat { int mv88e6xxx_switch_reset(struct dsa_switch *ds, bool ppu_active); int mv88e6xxx_setup_ports(struct dsa_switch *ds); int mv88e6xxx_setup_common(struct dsa_switch *ds); +void mv88e6xxx_remove_common(struct dsa_switch *ds); int mv88e6xxx_setup_global(struct dsa_switch *ds); int __mv88e6xxx_reg_read(struct mii_bus *bus, int sw_addr, int addr, int reg); int mv88e6xxx_reg_read(struct dsa_switch *ds, int addr, int reg); @@ -431,6 +432,7 @@ int mv88e6xxx_phy_read_indirect(struct dsa_switch *ds, int port, int regnum); int mv88e6xxx_phy_write_indirect(struct dsa_switch *ds, int port, int regnum, u16 val); void mv88e6xxx_ppu_state_init(struct dsa_switch *ds); +void mv88e6xxx_ppu_state_remove(struct dsa_switch *ds); int mv88e6xxx_phy_read_ppu(struct dsa_switch *ds, int addr, int regnum); int mv88e6xxx_phy_write_ppu(struct dsa_switch *ds, int addr, int regnum, u16 val);