From patchwork Wed Dec 2 13:47:51 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sudip Mukherjee X-Patchwork-Id: 7746231 Return-Path: X-Original-To: patchwork-linux-spi@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 9E09C9F350 for ; Wed, 2 Dec 2015 13:48:42 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id D344B20627 for ; Wed, 2 Dec 2015 13:48:41 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 0C85320600 for ; Wed, 2 Dec 2015 13:48:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758328AbbLBNsY (ORCPT ); Wed, 2 Dec 2015 08:48:24 -0500 Received: from mail-pa0-f54.google.com ([209.85.220.54]:34230 "EHLO mail-pa0-f54.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758435AbbLBNsH (ORCPT ); Wed, 2 Dec 2015 08:48:07 -0500 Received: by padhx2 with SMTP id hx2so41546344pad.1; Wed, 02 Dec 2015 05:48:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=AL1O/qBnBOqckbcRWQXk1h3xhp8EmafPOpo0Q4L+3Zk=; b=NToiga6Pkky90geOKuuageEt1SnZCHdbbnyQ0jodhWoiZGN+ZSkOnYKLw8GRaA3pT4 aRn1OyAJqQmWe/OcXzbkJ/0qfWbQBCqqcbGyzXUEcuck/07+6Q28fjduzUTcG+/US6g0 eZ7nrvO/MifccPjPAUs2BR0hmV7dLv29RITdDexDWscVmIFrCjML6Nq3rdhP9fS81DfX 4pFvENUyjYIq1ENzR6D3qQGqQAPCu+cmwMXsFEGje5V2LVAGB5Mrb3GY4mUVH+yR2Lxe jCXmFzPSrrdnjDAeoCjbZHl4eLZOdi0UIREe3KE1JLDL2k4IpBGppQV4brm5uZnEGzyc wZ1w== X-Received: by 10.98.65.200 with SMTP id g69mr4733509pfd.33.1449064086724; Wed, 02 Dec 2015 05:48:06 -0800 (PST) Received: from sudip-pc.vectortproxy.org ([122.169.145.251]) by smtp.gmail.com with ESMTPSA id 6sm4612874pfm.58.2015.12.02.05.48.04 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 02 Dec 2015 05:48:06 -0800 (PST) From: Sudip Mukherjee To: Mark Brown Cc: linux-kernel@vger.kernel.org, linux-spi@vger.kernel.org, Sudip Mukherjee Subject: [PATCH 4/4] spi: butterfly: use new parport device model Date: Wed, 2 Dec 2015 19:17:51 +0530 Message-Id: <1449064071-4915-4-git-send-email-sudipm.mukherjee@gmail.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1449064071-4915-1-git-send-email-sudipm.mukherjee@gmail.com> References: <1449064071-4915-1-git-send-email-sudipm.mukherjee@gmail.com> Sender: linux-spi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-spi@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Modify spi-butterfly driver to use the new parallel port device model. Signed-off-by: Sudip Mukherjee --- Only change is in the module loading part. It has been tested by inserting and removing the module repeatedly, tested with unbind also. drivers/spi/spi-butterfly.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/drivers/spi/spi-butterfly.c b/drivers/spi/spi-butterfly.c index f16ef7f..22a31e4 100644 --- a/drivers/spi/spi-butterfly.c +++ b/drivers/spi/spi-butterfly.c @@ -189,6 +189,7 @@ static void butterfly_attach(struct parport *p) struct butterfly *pp; struct spi_master *master; struct device *dev = p->physport->dev; + struct pardev_cb butterfly_cb; if (butterfly || !dev) return; @@ -221,9 +222,9 @@ static void butterfly_attach(struct parport *p) * parport hookup */ pp->port = p; - pd = parport_register_device(p, "spi_butterfly", - NULL, NULL, NULL, - 0 /* FLAGS */, pp); + memset(&butterfly_cb, 0, sizeof(butterfly_cb)); + butterfly_cb.private = pp; + pd = parport_register_dev_model(p, "spi_butterfly", &butterfly_cb, 0); if (!pd) { status = -ENOMEM; goto clean0; @@ -321,8 +322,9 @@ static void butterfly_detach(struct parport *p) static struct parport_driver butterfly_driver = { .name = "spi_butterfly", - .attach = butterfly_attach, + .match_port = butterfly_attach, .detach = butterfly_detach, + .devmodel = true, }; static int __init butterfly_init(void)