From nobody Sun Nov 24 17:00:48 2024 Received: from mail-wm1-f49.google.com (mail-wm1-f49.google.com [209.85.128.49]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8F8C518BC0B for ; Sun, 3 Nov 2024 21:26:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.49 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730669191; cv=none; b=uDD2RU4b49sZHz8RmYnnwxGmET8E2g5/J+OtdPjM/JtqdjY/lf/ocyuWq8hi/dRoyP9I2NE4i6uuNzlayG/QO/CiDI3ZpkiojtvZgej2yHxEadnbLZ3BXWk+Z6GVEmTyZLOy/hg80qAO0ODHk73z3suCeAuir6BRvahK+7iBEvI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730669191; c=relaxed/simple; bh=Yuzlz/gAXGepN585boJbCqwkRBFgUVeNpMhTrcpSlGs=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=okGiBUKP+WDzZnD3OF6rVHbP6X9J6KrFiI0sckukbqxI40PpMs4SLOgsa3J4+1whm/aAfne6Mz5aUqPAzF5OrcC+UdMqs4+3P1DSjDcWzXkVqPFCFNcgUiZglq0exn/3p5TKa6MUWCBovNLT3T1VL/akG+LeafAUMaFaTFm9ius= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=Ijk5hPiG; arc=none smtp.client-ip=209.85.128.49 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Ijk5hPiG" Received: by mail-wm1-f49.google.com with SMTP id 5b1f17b1804b1-4316f3d3c21so27745155e9.3 for ; Sun, 03 Nov 2024 13:26:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1730669188; x=1731273988; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=tM1Vc6LIKdr1UuGOL4gln8Hsis7ai+S2TMSH9A6g84A=; b=Ijk5hPiGcL8zPG6d+i79dLdYEjrdwQiZLov8QiL2MFW0/6J9r9wydg6OhKNFuN0GzA p+buh9miaIEuazZqVTMuYPqgZjQrIZsn35+qchVqeLxU6D/Y8QTzbOrLi6vvFG7Fe13m nI2hG0nDtqJx3z4fqqzYLZptRGm6b0ihOh/xUN8ymhAPVH0xoo0b4XkDDWSnBogJ7Rms 0xsjdfRZK3U8nQHtQIKhA4VFk7WYsjuuujXuHomXKQRTkRYrWOVK0yVPfSao7jjWCCOV Ix54OEFsU+0bFL+XSKR0KGt4zNRFchaL9qJbUNcMyMxoCuHWmy0Fi+jWWHO7wAAbAFeu TdbA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730669188; x=1731273988; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=tM1Vc6LIKdr1UuGOL4gln8Hsis7ai+S2TMSH9A6g84A=; b=knG5p8NK6P9fQfJxdKJg1hqB0nkzRZN9byjrosvZ2ski7OQ7xR9yGP60v80zOZuRFk JhfAckIHFK0Ka26/t0PPpprQ7Te/0DJxFzKL5NjzseyuAcjjrujcTnOpnkX7QrdJ5EVf BQ/sBrj7KCYehSvoWre17InPyn/B4Kyt4w9ED/uv3cYDPS+CZJvfWdey50QNVJkfErU0 X70Dkssq5gVyw5h/CcFOESQ6YK/gRh2NkwnPwycFZNLZ+a2ZGnaxGY0pu/qZ9vVlOktR BqEFDWbTkIMc8WrlzOdsnVGk3+iafQnhh0ko4dY8zJTZImmuOWe6NCuxhStn8cCHN1We H6wA== X-Forwarded-Encrypted: i=1; AJvYcCWSqcuwtORiXL3aCATix4Kn8zjqd640++Xer86Na8+ifYCyt+WlaCQG9260qgaB6zIikcXI0OXPKbTM2kY=@vger.kernel.org X-Gm-Message-State: AOJu0YytYFQBBfqNDfn65SRCPQqVkSCjPl87/YNq3MZWiwPAfHn61Phv 95Dre7/vxUw6Y5euxkgEzICVqfy4veV5vsLLOQ6+vhZEe1aoOU4D X-Google-Smtp-Source: AGHT+IFojVtE41iWXpVMT2O1EgAjvXjJ70TlGkI7FFNeVh9Mpf2fdD8FqQqpW+PVFuNXtKxlk02OCg== X-Received: by 2002:a05:600c:5250:b0:42f:8ac6:4f34 with SMTP id 5b1f17b1804b1-431bb9e6047mr144722865e9.35.1730669187553; Sun, 03 Nov 2024 13:26:27 -0800 (PST) Received: from localhost.localdomain (82-64-73-52.subs.proxad.net. [82.64.73.52]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-431bd910718sm166150385e9.12.2024.11.03.13.26.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 03 Nov 2024 13:26:27 -0800 (PST) From: Dave Penkler To: gregkh@linuxfoundation.org, linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org Cc: skhan@linuxfoundation.org, arnd@arndb.de, dan.carpenter@linaro.org, Dave Penkler Subject: [PATCH 01/11] staging: gpib: Fix buffer overflow in ni_usb_init Date: Sun, 3 Nov 2024 22:26:07 +0100 Message-ID: <20241103212617.13076-2-dpenkler@gmail.com> X-Mailer: git-send-email 2.46.2 In-Reply-To: <20241103212617.13076-1-dpenkler@gmail.com> References: <20241103212617.13076-1-dpenkler@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" The writes buffer size was not taking into account the number of entries in the array which was causing random oopses. Fixes: 4e127de14fa7 ("staging: gpib: Add National Instruments USB GPIB driv= er") Signed-off-by: Dave Penkler --- drivers/staging/gpib/ni_usb/ni_usb_gpib.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/gpib/ni_usb/ni_usb_gpib.c b/drivers/staging/gp= ib/ni_usb/ni_usb_gpib.c index 571f07800c9a..b7550a937f15 100644 --- a/drivers/staging/gpib/ni_usb/ni_usb_gpib.c +++ b/drivers/staging/gpib/ni_usb/ni_usb_gpib.c @@ -1726,7 +1726,7 @@ static int ni_usb_init(gpib_board_t *board) unsigned int ibsta; int writes_len; =20 - writes =3D kmalloc(sizeof(*writes), GFP_KERNEL); + writes =3D kmalloc_array(NUM_INIT_WRITES, sizeof(*writes), GFP_KERNEL); if (!writes) return -ENOMEM; =20 --=20 2.46.2 From nobody Sun Nov 24 17:00:48 2024 Received: from mail-wm1-f54.google.com (mail-wm1-f54.google.com [209.85.128.54]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 377C118BC1E for ; Sun, 3 Nov 2024 21:26:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.54 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730669194; cv=none; b=oNwR+PO2LqT/UiqZ93dtdVfXf4t1W8QHCZIXTQSAh4i1pX8aJ4yafKsd7SDFcTTtqq/q5I5R+QCGm/TYPr+dBRBaIiE3EPCvc4pvPU/B83qpv5vtg74damEJbChdV8rpaEMzH0W+38HGWBWVH75aPCYYbkJgRTNPxb3Wd8HEIiE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730669194; c=relaxed/simple; bh=JQSUOF03Bf+XpV2TQCE86ysFhOenVO6nmdo6v+b+TvA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=X3+/yYyz80F+WYd6UFjiTghXw+B7bwaIpu1Kqavp6o24xuW3r3P4UQht9ZMUkSFIcmawb3H1AuKdneKZqh4aa8SIAoi7SQAdpuOTZMg+xf8DT5Eg79Y65hPp/kQRg5t3fxZCKdeMjzQEvod4sQohSDRn2sfRSTSDWXzRSfxjJss= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=GjQyvfrN; arc=none smtp.client-ip=209.85.128.54 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="GjQyvfrN" Received: by mail-wm1-f54.google.com with SMTP id 5b1f17b1804b1-431ac30d379so29287295e9.1 for ; Sun, 03 Nov 2024 13:26:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1730669189; x=1731273989; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=tqxzw58U+LUCxJGUbB1hQgWyAT7tUGLQXVY6ydsOHiE=; b=GjQyvfrNHxFd3n5LuAHvd3Tx18GKWLFmbe9DxD15rYsfdrb+8kQhYyx5i/lMUDwwi5 FmqzYG3UDFMUBcPUTUGTAPQBqCqvKHLupcrxM3pvMmlRlx6AqqthdqYYuegNAGakNauZ uqGsbklziDI88EY7VPNk3uwyiPEwDw32riDqTwjwH79qURkuCwEhgXJ43l5IscjSlMil nHkBNwwbmyDlK1J5pF5QyyarAGW41j+Vxcllvz4Q9twls1gyUryDlBGhUaEzB7uo8V05 LDfRJYkxay6tvj+HmOdWgGi5QbMjP4GgAiHqxxLQ2f18fwb8LYvkhqfqTM1U38VRAva/ A0pg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730669189; x=1731273989; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=tqxzw58U+LUCxJGUbB1hQgWyAT7tUGLQXVY6ydsOHiE=; b=G+GixIRSMx5PwwB4RmXUh3NiPI7/Mb9Cro1VbH1DjihruyrdqPQqE/JQ6dXMYgcwLr MWaxSPFrqGI6D5e/rze7vt1GTl0EOoTU+sByGdX85+SNIEKhih2Rf/hquff7i0/xTmxA gyy/UYz0lKqoXvbiihJWLqkDyMNoDH038HoYg71+ADf2O+wR6pyz3iJZWnShS/7inB0G Q2dCTytGsK9oktJdBqwwlh+cLYdIuvS71IQyBmuP05wzerWHRT4Bqn/98N9Kl4T6H5Ln eigs4MsRshqCqH2aHV+6bu3qU4nw35oFgMbg5LMG4dp0KHlS6102Z3BwIWAvH7cPi1ie gbzQ== X-Forwarded-Encrypted: i=1; AJvYcCWV/QODxncohFNKPe+EXxUpjtSbiYemYJcpPsNq6y9laheMuVfP2VggoudC2FULWoB1jSY0q2ZdWmUaVtw=@vger.kernel.org X-Gm-Message-State: AOJu0YxCtp0M9bVjnpf3rgc9dAFueh2nzKUiuMieaRPVL6iclroSVPkx j0ZDpCRyqCr3IVmiX88iU4zJDb1MsCHRz2rBgd4mjIo6fZBn9Mmz X-Google-Smtp-Source: AGHT+IEuaRMvWlyMWBqBA64Diq7hQ6lbnXF5/XviQIGdyRk6QDIdV9ulVyoYWoXPvUzU2Ml8Efe1Ww== X-Received: by 2002:a05:600c:35cb:b0:42c:bc22:e074 with SMTP id 5b1f17b1804b1-4319ad343fbmr279931635e9.29.1730669189316; Sun, 03 Nov 2024 13:26:29 -0800 (PST) Received: from localhost.localdomain (82-64-73-52.subs.proxad.net. [82.64.73.52]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-431bd910718sm166150385e9.12.2024.11.03.13.26.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 03 Nov 2024 13:26:28 -0800 (PST) From: Dave Penkler To: gregkh@linuxfoundation.org, linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org Cc: skhan@linuxfoundation.org, arnd@arndb.de, dan.carpenter@linaro.org, Dave Penkler Subject: [PATCH 02/11] staging: gpib: Replace custom debug with dev_dbg Date: Sun, 3 Nov 2024 22:26:08 +0100 Message-ID: <20241103212617.13076-3-dpenkler@gmail.com> X-Mailer: git-send-email 2.46.2 In-Reply-To: <20241103212617.13076-1-dpenkler@gmail.com> References: <20241103212617.13076-1-dpenkler@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Remove GPIB_KERNEL_DEBUG config option Replace GPIB_DPRINTK with dev_dbg Signed-off-by: Dave Penkler --- drivers/staging/gpib/Kconfig | 10 -- drivers/staging/gpib/Makefile | 1 - drivers/staging/gpib/cb7210/cb7210.c | 2 +- drivers/staging/gpib/common/gpib_os.c | 138 +++++++++++--------- drivers/staging/gpib/common/iblib.c | 16 +-- drivers/staging/gpib/common/ibsys.h | 4 +- drivers/staging/gpib/eastwood/fluke_gpib.c | 2 +- drivers/staging/gpib/fmh_gpib/fmh_gpib.c | 4 +- drivers/staging/gpib/include/gpibP.h | 8 +- drivers/staging/gpib/ines/ines_gpib.c | 2 +- drivers/staging/gpib/nec7210/nec7210.c | 34 ++--- drivers/staging/gpib/tms9914/tms9914.c | 8 +- drivers/staging/gpib/tnt4882/tnt4882_gpib.c | 7 +- 13 files changed, 113 insertions(+), 123 deletions(-) diff --git a/drivers/staging/gpib/Kconfig b/drivers/staging/gpib/Kconfig index 999e7adacd82..0ea9a276c389 100644 --- a/drivers/staging/gpib/Kconfig +++ b/drivers/staging/gpib/Kconfig @@ -12,16 +12,6 @@ menuconfig GPIB =20 if GPIB =20 -config GPIB_KERNEL_DEBUG - bool "GPIB debugging" - depends on BROKEN - help - This is an option for use by developers; most people should - say N here. - - It enables gpib core and driver debugging - messages to be printed on the console. - config GPIB_COMMON tristate "GPIB core" help diff --git a/drivers/staging/gpib/Makefile b/drivers/staging/gpib/Makefile index a5bf32320b21..d0e88f5c0844 100644 --- a/drivers/staging/gpib/Makefile +++ b/drivers/staging/gpib/Makefile @@ -1,5 +1,4 @@ =20 -subdir-ccflags-$(CONFIG_GPIB_KERNEL_DEBUG) :=3D -DGPIB_DEBUG subdir-ccflags-y +=3D -I$(src)/include -I$(src)/uapi =20 obj-$(CONFIG_GPIB_AGILENT_82350B) +=3D agilent_82350b/ diff --git a/drivers/staging/gpib/cb7210/cb7210.c b/drivers/staging/gpib/cb= 7210/cb7210.c index c827d03dacf5..63df7f3eb3f3 100644 --- a/drivers/staging/gpib/cb7210/cb7210.c +++ b/drivers/staging/gpib/cb7210/cb7210.c @@ -479,7 +479,7 @@ irqreturn_t cb7210_internal_interrupt(gpib_board_t *boa= rd) status2 =3D read_byte(nec_priv, ISR2); nec7210_interrupt_have_status(board, nec_priv, status1, status2); =20 - GPIB_DPRINTK("cb7210: status 0x%x, mode 0x%x\n", hs_status, priv->hs_mode= _bits); + dev_dbg(board->gpib_dev, "cb7210: status 0x%x, mode 0x%x\n", hs_status, p= riv->hs_mode_bits); =20 clear_bits =3D 0; =20 diff --git a/drivers/staging/gpib/common/gpib_os.c b/drivers/staging/gpib/c= ommon/gpib_os.c index 6b12404efe7d..e84097ac8f69 100644 --- a/drivers/staging/gpib/common/gpib_os.c +++ b/drivers/staging/gpib/common/gpib_os.c @@ -69,7 +69,7 @@ static int t1_delay_ioctl(gpib_board_t *board, unsigned l= ong arg); =20 static int cleanup_open_devices(gpib_file_private_t *file_priv, gpib_board= _t *board); =20 -static int pop_gpib_event_nolock(gpib_event_queue_t *queue, short *event_t= ype); +static int pop_gpib_event_nolock(gpib_board_t *board, gpib_event_queue_t *= queue, short *event_type); =20 /* * Timer functions @@ -225,7 +225,7 @@ unsigned int num_status_bytes(const gpib_status_queue_t= *dev) } =20 // push status byte onto back of status byte fifo -int push_status_byte(gpib_status_queue_t *device, u8 poll_byte) +int push_status_byte(gpib_board_t *board, gpib_status_queue_t *device, u8 = poll_byte) { struct list_head *head =3D &device->status_bytes; status_byte_t *status; @@ -236,7 +236,7 @@ int push_status_byte(gpib_status_queue_t *device, u8 po= ll_byte) u8 lost_byte; =20 device->dropped_byte =3D 1; - retval =3D pop_status_byte(device, &lost_byte); + retval =3D pop_status_byte(board, device, &lost_byte); if (retval < 0) return retval; } @@ -252,14 +252,14 @@ int push_status_byte(gpib_status_queue_t *device, u8 = poll_byte) =20 device->num_status_bytes++; =20 - GPIB_DPRINTK("pushed status byte 0x%x, %i in queue\n", - (int)poll_byte, num_status_bytes(device)); + dev_dbg(board->gpib_dev, "pushed status byte 0x%x, %i in queue\n", + (int)poll_byte, num_status_bytes(device)); =20 return 0; } =20 // pop status byte from front of status byte fifo -int pop_status_byte(gpib_status_queue_t *device, u8 *poll_byte) +int pop_status_byte(gpib_board_t *board, gpib_status_queue_t *device, u8 *= poll_byte) { struct list_head *head =3D &device->status_bytes; struct list_head *front =3D head->next; @@ -284,8 +284,8 @@ int pop_status_byte(gpib_status_queue_t *device, u8 *po= ll_byte) =20 device->num_status_bytes--; =20 - GPIB_DPRINTK("popped status byte 0x%x, %i in queue\n", - (int)*poll_byte, num_status_bytes(device)); + dev_dbg(board->gpib_dev, "popped status byte 0x%x, %i in queue\n", + (int)*poll_byte, num_status_bytes(device)); =20 return 0; } @@ -310,11 +310,11 @@ int get_serial_poll_byte(gpib_board_t *board, unsigne= d int pad, int sad, unsigne { gpib_status_queue_t *device; =20 - GPIB_DPRINTK("%s:()\n", __func__); + dev_dbg(board->gpib_dev, "%s:()\n", __func__); =20 device =3D get_gpib_status_queue(board, pad, sad); if (num_status_bytes(device)) - return pop_status_byte(device, poll_byte); + return pop_status_byte(board, device, poll_byte); else return dvrsp(board, pad, sad, usec_timeout, poll_byte); } @@ -323,7 +323,7 @@ int autopoll_all_devices(gpib_board_t *board) { int retval; =20 - GPIB_DPRINTK("entering %s()\n", __func__); + dev_dbg(board->gpib_dev, "entering %s()\n", __func__); if (mutex_lock_interruptible(&board->user_mutex)) return -ERESTARTSYS; if (mutex_lock_interruptible(&board->big_gpib_mutex)) { @@ -331,7 +331,7 @@ int autopoll_all_devices(gpib_board_t *board) return -ERESTARTSYS; } =20 - GPIB_DPRINTK("autopoll has board lock\n"); + dev_dbg(board->gpib_dev, "autopoll has board lock\n"); =20 retval =3D serial_poll_all(board, serial_timeout); if (retval < 0) { @@ -340,7 +340,7 @@ int autopoll_all_devices(gpib_board_t *board) return retval; } =20 - GPIB_DPRINTK("%s complete\n", __func__); + dev_dbg(board->gpib_dev, "%s complete\n", __func__); /* need to wake wait queue in case someone is * waiting on RQS */ @@ -358,7 +358,7 @@ static int setup_serial_poll(gpib_board_t *board, unsig= ned int usec_timeout) size_t bytes_written; int ret; =20 - GPIB_DPRINTK("entering %s()\n", __func__); + dev_dbg(board->gpib_dev, "entering %s()\n", __func__); =20 os_start_timer(board, usec_timeout); ret =3D ibcac(board, 1, 1); @@ -394,7 +394,7 @@ static int read_serial_poll_byte(gpib_board_t *board, u= nsigned int pad, int i; size_t nbytes; =20 - GPIB_DPRINTK("entering %s(), pad=3D%i sad=3D%i\n", __func__, pad, sad); + dev_dbg(board->gpib_dev, "entering %s(), pad=3D%i sad=3D%i\n", __func__, = pad, sad); =20 os_start_timer(board, usec_timeout); ret =3D ibcac(board, 1, 1); @@ -436,7 +436,7 @@ static int cleanup_serial_poll(gpib_board_t *board, uns= igned int usec_timeout) int ret; size_t bytes_written; =20 - GPIB_DPRINTK("entering %s()\n", __func__); + dev_dbg(board->gpib_dev, "entering %s()\n", __func__); =20 os_start_timer(board, usec_timeout); ret =3D ibcac(board, 1, 1); @@ -485,7 +485,7 @@ int serial_poll_all(gpib_board_t *board, unsigned int u= sec_timeout) u8 result; unsigned int num_bytes =3D 0; =20 - GPIB_DPRINTK("entering %s()\n", __func__); + dev_dbg(board->gpib_dev, "entering %s()\n", __func__); =20 head =3D &board->device_list; if (head->next =3D=3D head) @@ -502,7 +502,7 @@ int serial_poll_all(gpib_board_t *board, unsigned int u= sec_timeout) if (retval < 0) continue; if (result & request_service_bit) { - retval =3D push_status_byte(device, result); + retval =3D push_status_byte(board, device, result); if (retval < 0) continue; num_bytes++; @@ -596,15 +596,15 @@ int ibopen(struct inode *inode, struct file *filep) priv =3D filep->private_data; init_gpib_file_private((gpib_file_private_t *)filep->private_data); =20 - GPIB_DPRINTK("pid %i, gpib: opening minor %d\n", current->pid, minor); + dev_dbg(board->gpib_dev, "pid %i, gpib: opening minor %d\n", current->pid= , minor); =20 if (board->use_count =3D=3D 0) { int retval; =20 retval =3D request_module("gpib%i", minor); if (retval) { - GPIB_DPRINTK("pid %i, gpib: request module returned %i\n", - current->pid, retval); + dev_dbg(board->gpib_dev, "pid %i, gpib: request module returned %i\n", + current->pid, retval); } } if (board->interface) { @@ -630,16 +630,16 @@ int ibclose(struct inode *inode, struct file *filep) return -ENODEV; } =20 - GPIB_DPRINTK("pid %i, gpib: closing minor %d\n", current->pid, minor); - board =3D &board_array[minor]; =20 + dev_dbg(board->gpib_dev, "pid %i, closing minor %d\n", current->pid, mino= r); + if (priv) { desc =3D handle_to_descriptor(priv, 0); if (desc) { if (desc->autopoll_enabled) { - GPIB_DPRINTK("pid %i, gpib: decrementing autospollers\n", - current->pid); + dev_dbg(board->gpib_dev, "pid %i, decrementing autospollers\n", + current->pid); if (board->autospollers > 0) board->autospollers--; else @@ -682,11 +682,11 @@ long ibioctl(struct file *filep, unsigned int cmd, un= signed long arg) if (mutex_lock_interruptible(&board->big_gpib_mutex)) return -ERESTARTSYS; =20 - GPIB_DPRINTK("pid %i, minor %i, ioctl %d, interface=3D%s, use=3D%d, onl= =3D%d\n", - current->pid, minor, cmd & 0xff, - board->interface ? board->interface->name : "", - board->use_count, - board->online); + dev_dbg(board->gpib_dev, "pid %i, ioctl %d, interface=3D%s, use=3D%d, onl= =3D%d\n", + current->pid, cmd & 0xff, + board->interface ? board->interface->name : "", + board->use_count, + board->online); =20 switch (cmd) { case CFCBOARDTYPE: @@ -870,7 +870,7 @@ long ibioctl(struct file *filep, unsigned int cmd, unsi= gned long arg) =20 done: mutex_unlock(&board->big_gpib_mutex); - GPIB_DPRINTK("ioctl done status =3D 0x%lx\n", board->status); + dev_dbg(board->gpib_dev, "ioctl done status =3D 0x%lx\n", board->status); return retval; } =20 @@ -1180,7 +1180,8 @@ static int status_bytes_ioctl(gpib_board_t *board, un= signed long arg) return 0; } =20 -static int increment_open_device_count(struct list_head *head, unsigned in= t pad, int sad) +static int increment_open_device_count(gpib_board_t *board, struct list_he= ad *head, + unsigned int pad, int sad) { struct list_head *list_ptr; gpib_status_queue_t *device; @@ -1191,8 +1192,8 @@ static int increment_open_device_count(struct list_he= ad *head, unsigned int pad, for (list_ptr =3D head->next; list_ptr !=3D head; list_ptr =3D list_ptr->= next) { device =3D list_entry(list_ptr, gpib_status_queue_t, list); if (gpib_address_equal(device->pad, device->sad, pad, sad)) { - GPIB_DPRINTK("pid %i, incrementing open count for pad %i, sad %i\n", - current->pid, device->pad, device->sad); + dev_dbg(board->gpib_dev, "pid %i, incrementing open count for pad %i, s= ad %i\n", + current->pid, device->pad, device->sad); device->reference_count++; return 0; } @@ -1209,14 +1210,14 @@ static int increment_open_device_count(struct list_= head *head, unsigned int pad, =20 list_add(&device->list, head); =20 - GPIB_DPRINTK("pid %i, opened pad %i, sad %i\n", - current->pid, device->pad, device->sad); + dev_dbg(board->gpib_dev, "pid %i, opened pad %i, sad %i\n", + current->pid, device->pad, device->sad); =20 return 0; } =20 -static int subtract_open_device_count(struct list_head *head, unsigned int= pad, int sad, - unsigned int count) +static int subtract_open_device_count(gpib_board_t *board, struct list_hea= d *head, + unsigned int pad, int sad, unsigned int count) { gpib_status_queue_t *device; struct list_head *list_ptr; @@ -1224,16 +1225,16 @@ static int subtract_open_device_count(struct list_h= ead *head, unsigned int pad, for (list_ptr =3D head->next; list_ptr !=3D head; list_ptr =3D list_ptr->= next) { device =3D list_entry(list_ptr, gpib_status_queue_t, list); if (gpib_address_equal(device->pad, device->sad, pad, sad)) { - GPIB_DPRINTK("pid %i, decrementing open count for pad %i, sad %i\n", - current->pid, device->pad, device->sad); + dev_dbg(board->gpib_dev, "pid %i, decrementing open count for pad %i, s= ad %i\n", + current->pid, device->pad, device->sad); if (count > device->reference_count) { pr_err("gpib: bug! in %s()\n", __func__); return -EINVAL; } device->reference_count -=3D count; if (device->reference_count =3D=3D 0) { - GPIB_DPRINTK("pid %i, closing pad %i, sad %i\n", - current->pid, device->pad, device->sad); + dev_dbg(board->gpib_dev, "pid %i, closing pad %i, sad %i\n", + current->pid, device->pad, device->sad); list_del(list_ptr); kfree(device); } @@ -1244,9 +1245,10 @@ static int subtract_open_device_count(struct list_he= ad *head, unsigned int pad, return -EINVAL; } =20 -static inline int decrement_open_device_count(struct list_head *head, unsi= gned int pad, int sad) +static inline int decrement_open_device_count(gpib_board_t *board, struct = list_head *head, + unsigned int pad, int sad) { - return subtract_open_device_count(head, pad, sad, 1); + return subtract_open_device_count(board, head, pad, sad, 1); } =20 static int cleanup_open_devices(gpib_file_private_t *file_priv, gpib_board= _t *board) @@ -1262,7 +1264,7 @@ static int cleanup_open_devices(gpib_file_private_t *= file_priv, gpib_board_t *bo continue; =20 if (desc->is_board =3D=3D 0) { - retval =3D decrement_open_device_count(&board->device_list, desc->pad, + retval =3D decrement_open_device_count(board, &board->device_list, desc= ->pad, desc->sad); if (retval < 0) return retval; @@ -1306,7 +1308,7 @@ static int open_dev_ioctl(struct file *filep, gpib_bo= ard_t *board, unsigned long file_priv->descriptors[i]->is_board =3D open_dev_cmd.is_board; mutex_unlock(&file_priv->descriptors_mutex); =20 - retval =3D increment_open_device_count(&board->device_list, open_dev_cmd.= pad, + retval =3D increment_open_device_count(board, &board->device_list, open_d= ev_cmd.pad, open_dev_cmd.sad); if (retval < 0) return retval; @@ -1339,7 +1341,7 @@ static int close_dev_ioctl(struct file *filep, gpib_b= oard_t *board, unsigned lon if (!file_priv->descriptors[cmd.handle]) return -EINVAL; =20 - retval =3D decrement_open_device_count(&board->device_list, + retval =3D decrement_open_device_count(board, &board->device_list, file_priv->descriptors[cmd.handle]->pad, file_priv->descriptors[cmd.handle]->sad); if (retval < 0) @@ -1356,7 +1358,7 @@ static int serial_poll_ioctl(gpib_board_t *board, uns= igned long arg) serial_poll_ioctl_t serial_cmd; int retval; =20 - GPIB_DPRINTK("pid %i, entering %s()\n", __func__, current->pid); + dev_dbg(board->gpib_dev, "pid %i, entering %s()\n", current->pid, __func_= _); =20 retval =3D copy_from_user(&serial_cmd, (void *)arg, sizeof(serial_cmd)); if (retval) @@ -1521,13 +1523,15 @@ static int pad_ioctl(gpib_board_t *board, gpib_file= _private_t *file_priv, if (retval < 0) return retval; } else { - retval =3D decrement_open_device_count(&board->device_list, desc->pad, d= esc->sad); + retval =3D decrement_open_device_count(board, &board->device_list, desc-= >pad, + desc->sad); if (retval < 0) return retval; =20 desc->pad =3D cmd.pad; =20 - retval =3D increment_open_device_count(&board->device_list, desc->pad, d= esc->sad); + retval =3D increment_open_device_count(board, &board->device_list, desc-= >pad, + desc->sad); if (retval < 0) return retval; } @@ -1555,13 +1559,15 @@ static int sad_ioctl(gpib_board_t *board, gpib_file= _private_t *file_priv, if (retval < 0) return retval; } else { - retval =3D decrement_open_device_count(&board->device_list, desc->pad, d= esc->sad); + retval =3D decrement_open_device_count(board, &board->device_list, desc-= >pad, + desc->sad); if (retval < 0) return retval; =20 desc->sad =3D cmd.sad; =20 - retval =3D increment_open_device_count(&board->device_list, desc->pad, d= esc->sad); + retval =3D increment_open_device_count(board, &board->device_list, desc-= >pad, + desc->sad); if (retval < 0) return retval; } @@ -1717,7 +1723,8 @@ static int mutex_ioctl(gpib_board_t *board, gpib_file= _private_t *file_priv, =20 atomic_set(&file_priv->holding_mutex, 1); =20 - GPIB_DPRINTK("pid %i, locked board %d mutex\n", current->pid, board->min= or); + dev_dbg(board->gpib_dev, "pid %i, locked board %d mutex\n", + current->pid, board->minor); } else { spin_lock(&board->locking_pid_spinlock); if (current->pid !=3D board->locking_pid) { @@ -1732,7 +1739,8 @@ static int mutex_ioctl(gpib_board_t *board, gpib_file= _private_t *file_priv, atomic_set(&file_priv->holding_mutex, 0); =20 mutex_unlock(&board->user_mutex); - GPIB_DPRINTK("pid %i, unlocked board %i mutex\n", current->pid, board->m= inor); + dev_dbg(board->gpib_dev, "pid %i, unlocked board %i mutex\n", + current->pid, board->minor); } return 0; } @@ -1747,7 +1755,7 @@ static int timeout_ioctl(gpib_board_t *board, unsigne= d long arg) return -EFAULT; =20 board->usec_timeout =3D timeout; - GPIB_DPRINTK("pid %i, timeout set to %i usec\n", current->pid, timeout); + dev_dbg(board->gpib_dev, "pid %i, timeout set to %i usec\n", current->pid= , timeout); =20 return 0; } @@ -1922,7 +1930,7 @@ static int push_gpib_event_nolock(gpib_board_t *board= , short event_type) short lost_event; =20 queue->dropped_event =3D 1; - retval =3D pop_gpib_event_nolock(queue, &lost_event); + retval =3D pop_gpib_event_nolock(board, queue, &lost_event); if (retval < 0) return retval; } @@ -1941,8 +1949,8 @@ static int push_gpib_event_nolock(gpib_board_t *board= , short event_type) =20 queue->num_events++; =20 - GPIB_DPRINTK("pushed event %i, %i in queue\n", - (int)event_type, num_gpib_events(queue)); + dev_dbg(board->gpib_dev, "pushed event %i, %i in queue\n", + (int)event_type, num_gpib_events(queue)); =20 return 0; } @@ -1966,7 +1974,7 @@ int push_gpib_event(gpib_board_t *board, short event_= type) } EXPORT_SYMBOL(push_gpib_event); =20 -static int pop_gpib_event_nolock(gpib_event_queue_t *queue, short *event_t= ype) +static int pop_gpib_event_nolock(gpib_board_t *board, gpib_event_queue_t *= queue, short *event_type) { struct list_head *head =3D &queue->event_head; struct list_head *front =3D head->next; @@ -1993,20 +2001,20 @@ static int pop_gpib_event_nolock(gpib_event_queue_t= *queue, short *event_type) =20 queue->num_events--; =20 - GPIB_DPRINTK("popped event %i, %i in queue\n", - (int)*event_type, num_gpib_events(queue)); + dev_dbg(board->gpib_dev, "popped event %i, %i in queue\n", + (int)*event_type, num_gpib_events(queue)); =20 return 0; } =20 // pop event from front of event queue -int pop_gpib_event(gpib_event_queue_t *queue, short *event_type) +int pop_gpib_event(gpib_board_t *board, gpib_event_queue_t *queue, short *= event_type) { unsigned long flags; int retval; =20 spin_lock_irqsave(&queue->lock, flags); - retval =3D pop_gpib_event_nolock(queue, event_type); + retval =3D pop_gpib_event_nolock(board, queue, event_type); spin_unlock_irqrestore(&queue->lock, flags); return retval; } @@ -2017,7 +2025,7 @@ static int event_ioctl(gpib_board_t *board, unsigned = long arg) int retval; short event; =20 - retval =3D pop_gpib_event(&board->event_queue, &event); + retval =3D pop_gpib_event(board, &board->event_queue, &event); if (retval < 0) return retval; =20 @@ -2199,7 +2207,7 @@ void gpib_deallocate_board(gpib_board_t *board) board->buffer_length =3D 0; } while (num_gpib_events(&board->event_queue)) - pop_gpib_event(&board->event_queue, &dummy); + pop_gpib_event(board, &board->event_queue, &dummy); } =20 static void init_board_array(gpib_board_t *board_array, unsigned int lengt= h) diff --git a/drivers/staging/gpib/common/iblib.c b/drivers/staging/gpib/com= mon/iblib.c index 83795e7f5cf1..fc57e760c144 100644 --- a/drivers/staging/gpib/common/iblib.c +++ b/drivers/staging/gpib/common/iblib.c @@ -178,13 +178,13 @@ static int autospoll_thread(void *board_void) gpib_board_t *board =3D board_void; int retval =3D 0; =20 - GPIB_DPRINTK("entering autospoll thread\n"); + dev_dbg(board->gpib_dev, "entering autospoll thread\n"); =20 while (1) { wait_event_interruptible(board->wait, kthread_should_stop() || autospoll_wait_should_wake_up(board)); - GPIB_DPRINTK("autospoll wait satisfied\n"); + dev_dbg(board->gpib_dev, "autospoll wait satisfied\n"); if (kthread_should_stop()) break; =20 @@ -247,7 +247,7 @@ int ibonline(gpib_board_t *board) } #endif board->online =3D 1; - GPIB_DPRINTK("gpib: board online\n"); + dev_dbg(board->gpib_dev, "gpib: board online\n"); =20 return 0; } @@ -272,7 +272,7 @@ int iboffline(gpib_board_t *board) board->interface->detach(board); gpib_deallocate_board(board); board->online =3D 0; - GPIB_DPRINTK("gpib: board offline\n"); + dev_dbg(board->gpib_dev, "gpib: board offline\n"); =20 return 0; } @@ -436,7 +436,7 @@ int ibsic(gpib_board_t *board, unsigned int usec_durati= on) pr_warn("gpib: warning, shortening long udelay\n"); } =20 - GPIB_DPRINTK("sending interface clear\n"); + dev_dbg(board->gpib_dev, "sending interface clear\n"); board->interface->interface_clear(board, 1); udelay(usec_duration); board->interface->interface_clear(board, 0); @@ -486,7 +486,7 @@ int ibpad(gpib_board_t *board, unsigned int addr) board->pad =3D addr; if (board->online) board->interface->primary_address(board, board->pad); - GPIB_DPRINTK("set primary addr to %i\n", board->pad); + dev_dbg(board->gpib_dev, "set primary addr to %i\n", board->pad); return 0; } =20 @@ -509,7 +509,7 @@ int ibsad(gpib_board_t *board, int addr) else board->interface->secondary_address(board, 0, 0); } - GPIB_DPRINTK("set secondary addr to %i\n", board->sad); + dev_dbg(board->gpib_dev, "set secondary addr to %i\n", board->sad); =20 return 0; } @@ -683,7 +683,7 @@ int ibwait(gpib_board_t *board, int wait_mask, int clea= r_mask, int set_mask, =20 if (wait_event_interruptible(board->wait, wait_satisfied(&winfo, status_q= ueue, wait_mask, status, desc))) { - GPIB_DPRINTK("wait interrupted\n"); + dev_dbg(board->gpib_dev, "wait interrupted\n"); retval =3D -ERESTARTSYS; } remove_wait_timer(&winfo); diff --git a/drivers/staging/gpib/common/ibsys.h b/drivers/staging/gpib/com= mon/ibsys.h index 3f53a808a9b9..b78ca5ea4da1 100644 --- a/drivers/staging/gpib/common/ibsys.h +++ b/drivers/staging/gpib/common/ibsys.h @@ -20,8 +20,8 @@ int gpib_allocate_board(gpib_board_t *board); void gpib_deallocate_board(gpib_board_t *board); =20 unsigned int num_status_bytes(const gpib_status_queue_t *dev); -int push_status_byte(gpib_status_queue_t *device, uint8_t poll_byte); -int pop_status_byte(gpib_status_queue_t *device, uint8_t *poll_byte); +int push_status_byte(gpib_board_t *board, gpib_status_queue_t *device, uin= t8_t poll_byte); +int pop_status_byte(gpib_board_t *board, gpib_status_queue_t *device, uint= 8_t *poll_byte); gpib_status_queue_t *get_gpib_status_queue(gpib_board_t *board, unsigned i= nt pad, int sad); int get_serial_poll_byte(gpib_board_t *board, unsigned int pad, int sad, unsigned int usec_timeout, uint8_t *poll_byte); diff --git a/drivers/staging/gpib/eastwood/fluke_gpib.c b/drivers/staging/g= pib/eastwood/fluke_gpib.c index b528405f33e0..3f938ab0c84d 100644 --- a/drivers/staging/gpib/eastwood/fluke_gpib.c +++ b/drivers/staging/gpib/eastwood/fluke_gpib.c @@ -430,7 +430,7 @@ static int fluke_dma_write(gpib_board_t *board, uint8_t= *buffer, size_t length, test_bit(BUS_ERROR_BN, &nec_priv->state) || test_bit(DEV_CLEAR_BN, &nec_priv->state) || test_bit(TIMO_NUM, &board->status))) { - GPIB_DPRINTK("gpib write interrupted!\n"); + dev_dbg(board->gpib_dev, "gpib write interrupted!\n"); retval =3D -ERESTARTSYS; } if (test_bit(TIMO_NUM, &board->status)) diff --git a/drivers/staging/gpib/fmh_gpib/fmh_gpib.c b/drivers/staging/gpi= b/fmh_gpib/fmh_gpib.c index 73409b066727..62791db1c34a 100644 --- a/drivers/staging/gpib/fmh_gpib/fmh_gpib.c +++ b/drivers/staging/gpib/fmh_gpib/fmh_gpib.c @@ -440,7 +440,7 @@ static int fmh_gpib_dma_write(gpib_board_t *board, uint= 8_t *buffer, size_t lengt test_bit(BUS_ERROR_BN, &nec_priv->state) || test_bit(DEV_CLEAR_BN, &nec_priv->state) || test_bit(TIMO_NUM, &board->status))) { - GPIB_DPRINTK("gpib write interrupted!\n"); + dev_dbg(board->gpib_dev, "gpib write interrupted!\n"); retval =3D -ERESTARTSYS; } if (test_bit(TIMO_NUM, &board->status)) @@ -634,7 +634,7 @@ static int fmh_gpib_fifo_write_countable(gpib_board_t *= board, uint8_t *buffer, test_bit(BUS_ERROR_BN, &nec_priv->state) || test_bit(DEV_CLEAR_BN, &nec_priv->state) || test_bit(TIMO_NUM, &board->status))) { - GPIB_DPRINTK("gpib write interrupted!\n"); + dev_dbg(board->gpib_dev, "gpib write interrupted!\n"); retval =3D -ERESTARTSYS; } if (test_bit(TIMO_NUM, &board->status)) diff --git a/drivers/staging/gpib/include/gpibP.h b/drivers/staging/gpib/in= clude/gpibP.h index 0129fd29e704..5fc42b645ab7 100644 --- a/drivers/staging/gpib/include/gpibP.h +++ b/drivers/staging/gpib/include/gpibP.h @@ -26,7 +26,7 @@ struct pci_dev *gpib_pci_get_subsys(const gpib_board_conf= ig_t *config, unsigned unsigned int ss_device, struct pci_dev *from); unsigned int num_gpib_events(const gpib_event_queue_t *queue); int push_gpib_event(gpib_board_t *board, short event_type); -int pop_gpib_event(gpib_event_queue_t *queue, short *event_type); +int pop_gpib_event(gpib_board_t *board, gpib_event_queue_t *queue, short *= event_type); int gpib_request_pseudo_irq(gpib_board_t *board, irqreturn_t (*handler)(in= t, void *)); void gpib_free_pseudo_irq(gpib_board_t *board); int gpib_match_device_path(struct device *dev, const char *device_path_in); @@ -35,12 +35,6 @@ extern gpib_board_t board_array[GPIB_MAX_NUM_BOARDS]; =20 extern struct list_head registered_drivers; =20 -#ifdef GPIB_DEBUG -#define GPIB_DPRINTK(format, args...) pr_info("gpib debug: " format, ## ar= gs) -#else -#define GPIB_DPRINTK(arg...) -#endif - #include =20 void writeb_wrapper(unsigned int value, void *address); diff --git a/drivers/staging/gpib/ines/ines_gpib.c b/drivers/staging/gpib/i= nes/ines_gpib.c index e98a114a9570..9d8387c3bf01 100644 --- a/drivers/staging/gpib/ines/ines_gpib.c +++ b/drivers/staging/gpib/ines/ines_gpib.c @@ -202,7 +202,7 @@ static int ines_write_wait(gpib_board_t *board, struct = ines_priv *ines_priv, test_bit(BUS_ERROR_BN, &nec_priv->state) || test_bit(DEV_CLEAR_BN, &nec_priv->state) || test_bit(TIMO_NUM, &board->status))) { - GPIB_DPRINTK("gpib write interrupted\n"); + dev_dbg(board->gpib_dev, "gpib write interrupted\n"); return -ERESTARTSYS; } if (test_bit(BUS_ERROR_BN, &nec_priv->state)) diff --git a/drivers/staging/gpib/nec7210/nec7210.c b/drivers/staging/gpib/= nec7210/nec7210.c index 1330743d05fd..1d9951035497 100644 --- a/drivers/staging/gpib/nec7210/nec7210.c +++ b/drivers/staging/gpib/nec7210/nec7210.c @@ -53,7 +53,7 @@ int nec7210_parallel_poll(gpib_board_t *board, struct nec= 7210_priv *priv, uint8_ // wait for result FIXME: support timeouts ret =3D wait_event_interruptible(board->wait, test_bit(COMMAND_READY_BN, = &priv->state)); if (ret) { - GPIB_DPRINTK("gpib: parallel poll interrupted\n"); + dev_dbg(board->gpib_dev, "gpib: parallel poll interrupted\n"); return -ERESTARTSYS; } *result =3D read_byte(priv, CPTR); @@ -198,7 +198,7 @@ unsigned int nec7210_update_status_nolock(gpib_board_t = *board, struct nec7210_pr priv->srq_pending =3D 0; set_bit(SPOLL_NUM, &board->status); } -// GPIB_DPRINTK("status 0x%x, state 0x%x\n", board->status, priv->state); +// dev_dbg(board->gpib_dev, "status 0x%x, state 0x%x\n", board->status, pr= iv->state); =20 /* we rely on the interrupt handler to set the * rest of the status bits @@ -430,7 +430,7 @@ int nec7210_command(gpib_board_t *board, struct nec7210= _priv *priv, uint8_t test_bit(COMMAND_READY_BN, &priv->state) || test_bit(BUS_ERROR_BN, &priv->state) || test_bit(TIMO_NUM, &board->status))) { - GPIB_DPRINTK("gpib command wait interrupted\n"); + dev_dbg(board->gpib_dev, "gpib command wait interrupted\n"); retval =3D -ERESTARTSYS; break; } @@ -455,11 +455,11 @@ int nec7210_command(gpib_board_t *board, struct nec72= 10_priv *priv, uint8_t if (wait_event_interruptible(board->wait, test_bit(COMMAND_READY_BN, &pri= v->state) || test_bit(BUS_ERROR_BN, &priv->state) || test_bit(TIMO_NUM, &board->status))) { - GPIB_DPRINTK("gpib command wait interrupted\n"); + dev_dbg(board->gpib_dev, "gpib command wait interrupted\n"); retval =3D -ERESTARTSYS; } if (test_bit(TIMO_NUM, &board->status)) { - GPIB_DPRINTK("gpib command timed out\n"); + dev_dbg(board->gpib_dev, "gpib command timed out\n"); retval =3D -ETIMEDOUT; } if (test_and_clear_bit(BUS_ERROR_BN, &priv->state)) { @@ -484,7 +484,7 @@ static int pio_read(gpib_board_t *board, struct nec7210= _priv *priv, uint8_t *buf test_bit(READ_READY_BN, &priv->state) || test_bit(DEV_CLEAR_BN, &priv->state) || test_bit(TIMO_NUM, &board->status))) { - GPIB_DPRINTK("nec7210: pio read wait interrupted\n"); + dev_dbg(board->gpib_dev, "nec7210: pio read wait interrupted\n"); retval =3D -ERESTARTSYS; break; } @@ -503,12 +503,12 @@ static int pio_read(gpib_board_t *board, struct nec72= 10_priv *priv, uint8_t *buf break; } if (test_bit(TIMO_NUM, &board->status)) { - GPIB_DPRINTK("interrupted by timeout\n"); + dev_dbg(board->gpib_dev, "interrupted by timeout\n"); retval =3D -ETIMEDOUT; break; } if (test_bit(DEV_CLEAR_BN, &priv->state)) { - GPIB_DPRINTK("interrupted by device clear\n"); + dev_dbg(board->gpib_dev, "interrupted by device clear\n"); retval =3D -EINTR; break; } @@ -558,7 +558,7 @@ static ssize_t __dma_read(gpib_board_t *board, struct n= ec7210_priv *priv, size_t test_bit(DMA_READ_IN_PROGRESS_BN, &priv->state) =3D=3D 0 || test_bit(DEV_CLEAR_BN, &priv->state) || test_bit(TIMO_NUM, &board->status))) { - GPIB_DPRINTK("nec7210: dma read wait interrupted\n"); + dev_dbg(board->gpib_dev, "nec7210: dma read wait interrupted\n"); retval =3D -ERESTARTSYS; } if (test_bit(TIMO_NUM, &board->status)) @@ -639,19 +639,19 @@ static int pio_write_wait(gpib_board_t *board, struct= nec7210_priv *priv, (wake_on_lacs && test_bit(LACS_NUM, &board->status)) || (wake_on_atn && test_bit(ATN_NUM, &board->status)) || test_bit(TIMO_NUM, &board->status))) { - GPIB_DPRINTK("gpib write interrupted\n"); + dev_dbg(board->gpib_dev, "gpib write interrupted\n"); return -ERESTARTSYS; } if (test_bit(TIMO_NUM, &board->status)) { - GPIB_DPRINTK("nec7210: write timed out\n"); + dev_dbg(board->gpib_dev, "nec7210: write timed out\n"); return -ETIMEDOUT; } if (test_bit(DEV_CLEAR_BN, &priv->state)) { - GPIB_DPRINTK("nec7210: write interrupted by clear\n"); + dev_dbg(board->gpib_dev, "nec7210: write interrupted by clear\n"); return -EINTR; } if (wake_on_bus_error && test_and_clear_bit(BUS_ERROR_BN, &priv->state)) { - GPIB_DPRINTK("nec7210: bus error on write\n"); + dev_dbg(board->gpib_dev, "nec7210: bus error on write\n"); return -EIO; } return 0; @@ -677,7 +677,7 @@ static int pio_write(gpib_board_t *board, struct nec721= 0_priv *priv, uint8_t *bu if (retval =3D=3D -EIO) { /* resend last byte on bus error */ *bytes_written =3D last_count; - GPIB_DPRINTK("resending %c\n", buffer[*bytes_written]); + dev_dbg(board->gpib_dev, "resending %c\n", buffer[*bytes_written]); /* we can get unrecoverable bus errors, * so give up after a while */ @@ -734,7 +734,7 @@ static ssize_t __dma_write(gpib_board_t *board, struct = nec7210_priv *priv, dma_a test_bit(BUS_ERROR_BN, &priv->state) || test_bit(DEV_CLEAR_BN, &priv->state) || test_bit(TIMO_NUM, &board->status))) { - GPIB_DPRINTK("gpib write interrupted!\n"); + dev_dbg(board->gpib_dev, "gpib write interrupted!\n"); retval =3D -ERESTARTSYS; } if (test_bit(TIMO_NUM, &board->status)) @@ -969,8 +969,8 @@ irqreturn_t nec7210_interrupt_have_status(gpib_board_t = *board, (status2 & (priv->reg_bits[IMR2] & IMR2_ENABLE_INTR_MASK)) || nec7210_atn_has_changed(board, priv)) { nec7210_update_status_nolock(board, priv); - GPIB_DPRINTK("minor %i, stat %lx, isr1 0x%x, imr1 0x%x, isr2 0x%x, imr2 = 0x%x\n", - board->minor, board->status, status1, priv->reg_bits[IMR1], status= 2, + dev_dbg(board->gpib_dev, "minor %i, stat %lx, isr1 0x%x, imr1 0x%x, isr2= 0x%x, imr2 0x%x\n", + board->minor, board->status, status1, priv->reg_bits[IMR1], status2, priv->reg_bits[IMR2]); wake_up_interruptible(&board->wait); /* wake up sleeping process */ retval =3D IRQ_HANDLED; diff --git a/drivers/staging/gpib/tms9914/tms9914.c b/drivers/staging/gpib/= tms9914/tms9914.c index 6452757f0a2a..152b243b845b 100644 --- a/drivers/staging/gpib/tms9914/tms9914.c +++ b/drivers/staging/gpib/tms9914/tms9914.c @@ -382,7 +382,7 @@ static unsigned int update_status_nolock(gpib_board_t *= board, struct tms9914_pri clear_bit(SRQI_NUM, &board->status); } =20 - GPIB_DPRINTK("status 0x%lx, state 0x%lx\n", board->status, priv->state); + dev_dbg(board->gpib_dev, "status 0x%lx, state 0x%lx\n", board->status, pr= iv->state); =20 return board->status; } @@ -549,7 +549,7 @@ static int pio_write_wait(gpib_board_t *board, struct t= ms9914_priv *priv) test_bit(BUS_ERROR_BN, &priv->state) || test_bit(DEV_CLEAR_BN, &priv->state) || test_bit(TIMO_NUM, &board->status))) { - GPIB_DPRINTK("gpib write interrupted!\n"); + dev_dbg(board->gpib_dev, "gpib write interrupted!\n"); return -ERESTARTSYS; } if (test_bit(TIMO_NUM, &board->status)) @@ -774,7 +774,7 @@ irqreturn_t tms9914_interrupt_have_status(gpib_board_t = *board, struct tms9914_pr } =20 if (status1 & HR_ERR) { - GPIB_DPRINTK("gpib bus error\n"); + dev_dbg(board->gpib_dev, "gpib bus error\n"); set_bit(BUS_ERROR_BN, &priv->state); } =20 @@ -807,7 +807,7 @@ irqreturn_t tms9914_interrupt_have_status(gpib_board_t = *board, struct tms9914_pr } =20 if ((status0 & priv->imr0_bits) || (status1 & priv->imr1_bits)) { -// GPIB_DPRINTK("isr0 0x%x, imr0 0x%x, isr1 0x%x, imr1 0x%x\n", +// dev_dbg(board->gpib_dev, "isr0 0x%x, imr0 0x%x, isr1 0x%x, imr1 0x%x\n= ", // status0, priv->imr0_bits, status1, priv->imr1_bits); update_status_nolock(board, priv); wake_up_interruptible(&board->wait); diff --git a/drivers/staging/gpib/tnt4882/tnt4882_gpib.c b/drivers/staging/= gpib/tnt4882/tnt4882_gpib.c index 4d702c4452e8..e49a952fa0d8 100644 --- a/drivers/staging/gpib/tnt4882/tnt4882_gpib.c +++ b/drivers/staging/gpib/tnt4882/tnt4882_gpib.c @@ -491,7 +491,7 @@ static int write_wait(gpib_board_t *board, struct tnt48= 82_priv *tnt_priv, test_bit(BUS_ERROR_BN, &nec_priv->state) || test_bit(DEV_CLEAR_BN, &nec_priv->state) || test_bit(TIMO_NUM, &board->status))) { - GPIB_DPRINTK("gpib write interrupted\n"); + dev_dbg(board->gpib_dev, "gpib write interrupted\n"); return -ERESTARTSYS; } if (test_bit(TIMO_NUM, &board->status)) { @@ -637,9 +637,8 @@ irqreturn_t tnt4882_internal_interrupt(gpib_board_t *bo= ard) if (isr3_bits & HR_DONE) priv->imr3_bits &=3D ~HR_DONE; if (isr3_bits & (HR_INTR | HR_TLCI)) { - GPIB_DPRINTK("tnt4882: minor %i isr0 0x%x imr0 0x%x isr3 0x%x imr3 0x%x\= n", - board->minor, - isr0_bits, priv->imr0_bits, isr3_bits, imr3_bits); + dev_dbg(board->gpib_dev, "tnt4882: minor %i isr0 0x%x imr0 0x%x isr3 0x%= x imr3 0x%x\n", + board->minor, isr0_bits, priv->imr0_bits, isr3_bits, imr3_bits); tnt_writeb(priv, priv->imr3_bits, IMR3); wake_up_interruptible(&board->wait); } --=20 2.46.2 From nobody Sun Nov 24 17:00:48 2024 Received: from mail-wm1-f49.google.com (mail-wm1-f49.google.com [209.85.128.49]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DBCAD18BC15 for ; Sun, 3 Nov 2024 21:26:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.49 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730669197; cv=none; b=IylCw44SgVtdqN2Y8AjIc2NnIxhe7prOqLEVAsnmbgSTmJvt5yVRPOPcSVQ19cRJmYFME16K5Uw0Qb4Js0O0iWBxDRWSprwD2HmPPo5ppztBAbe0RBqS1w2HDiFAklE0FjMeyL8IUTpqVnKFhn6SaJdoVfHVme9oz2cyAD0e9mQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730669197; c=relaxed/simple; bh=8tOooZSqjZLktK11SFQlQMuq3FUWL4flmY68otICPp0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=jUoBNeqv2y22MFi2hUvXq5uhLBRh5sG/vHcY7y5bpmW22nWi5MYlHXob5vO9FRwHbuZq0aDryqQmCpkxctxcJbG6jYpBwP6ZYvqURpViX2js3rBHL1cLXYMIvdgjMUEn8cIc95eZ3u42Ozy+OyWfjjzah8dypz9SkwZtL72FwKM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=gxbyXxD7; arc=none smtp.client-ip=209.85.128.49 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="gxbyXxD7" Received: by mail-wm1-f49.google.com with SMTP id 5b1f17b1804b1-4314c4cb752so31471875e9.2 for ; Sun, 03 Nov 2024 13:26:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1730669191; x=1731273991; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=LuHJvsgGH4bf1MV0j7IEBdB41iQSPKkdiyMMwagJFNc=; b=gxbyXxD7ZwGHNxZMV4gMAaPPNc8t7+J47rJS0dLkW8AfzpkmoxWpIY90Rweqw80j/O k1Nl+85mxNBYRtGnzs9aleJ4H0R4NqQQNZR/WyWW8DVZUNJLF7m10abglszOTRWvEOhM WdUMkyn8z85xzRbOcL9UdesR1guUTf63qPMP3ONuT0PcJ1Fy5vh1xKhk8dw5stBb+sZq NdW2BJod+mbUR10EXT8IbG7bnkkwuSiuwyAs6rNxWVTDeRWJnXuhXCHmHrVOXijhXJNN 98VF8NuH9t+tp333PFYc5m2VlwMIerePfuzVfGruCm1YmRZ13NslRNP4og9MXJZ08xO+ HxQQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730669191; x=1731273991; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=LuHJvsgGH4bf1MV0j7IEBdB41iQSPKkdiyMMwagJFNc=; b=SAyla4ppYHPwvrSDvyYWuasZ9d2EhocBEfY6d1zkX7TzmFnLPzVC6+H9fomLU8TFJE xvP9kyv5wFn/pGrE9oM67I9j/fuQRISFORN9ptkNDi5++idvw4KUmD5par7X7oxdHXYF qUiI3MjDMChlHjKmlb9qPwVBwo3HSJ6/RmT5p6NPS5ezSzHTur+yxAhEKEHy77RWMM9Q j57dcnRuybZ66uBcMLHcHNNVuZwOVT7hqOC92NE01T/Q2pZVlnEFUrX/AsX7vCjlmVI/ 0AEEUuGeSKi/QhBjwEJ6crRf4/Kze0n9z2p6TY/uR4xz/M9oG8jqttsYLQ9PQRkrMUZM MvAA== X-Forwarded-Encrypted: i=1; AJvYcCWYlaICw7UhPrSCdndTWst14AHsKEj3Hdj1ltoCIBD6sa6mdiKPY9Xhlm1tEsdpOlK5eckyknVRZTz8q5s=@vger.kernel.org X-Gm-Message-State: AOJu0YxoSugesy+itzmU+IOuOQs78/lw4RVwyrS2SzQaRzVvSUX21eXf TL6hZoome1Njwm3JVgJIgnKpwgrr8gRqrYUa8TRb5S8XD0P4CxSB X-Google-Smtp-Source: AGHT+IHkYW4ZmVsn1GpREt01QwKzE0NYJxTSHzeClAxmUqHq4hIyJSZyEVuiLvaAYQWEN9te0CejKg== X-Received: by 2002:a05:600c:35d0:b0:431:58cd:b259 with SMTP id 5b1f17b1804b1-4327b8214aemr130432125e9.31.1730669190745; Sun, 03 Nov 2024 13:26:30 -0800 (PST) Received: from localhost.localdomain (82-64-73-52.subs.proxad.net. [82.64.73.52]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-431bd910718sm166150385e9.12.2024.11.03.13.26.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 03 Nov 2024 13:26:29 -0800 (PST) From: Dave Penkler To: gregkh@linuxfoundation.org, linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org Cc: skhan@linuxfoundation.org, arnd@arndb.de, dan.carpenter@linaro.org, Dave Penkler Subject: [PATCH 03/11] staging: gpib: Update messaging and usb_device refs in ni_usb Date: Sun, 3 Nov 2024 22:26:09 +0100 Message-ID: <20241103212617.13076-4-dpenkler@gmail.com> X-Mailer: git-send-email 2.46.2 In-Reply-To: <20241103212617.13076-1-dpenkler@gmail.com> References: <20241103212617.13076-1-dpenkler@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Replace GPIB_DPRINTK with dev_dbg Replace pr_xxx with dev_xxx wherever possible Use previously initialized usb_device pointer for usb_get_dev() and usb_put_dev(). Signed-off-by: Dave Penkler --- drivers/staging/gpib/ni_usb/ni_usb_gpib.c | 376 ++++++++++++---------- 1 file changed, 204 insertions(+), 172 deletions(-) diff --git a/drivers/staging/gpib/ni_usb/ni_usb_gpib.c b/drivers/staging/gp= ib/ni_usb/ni_usb_gpib.c index b7550a937f15..b7b6fb1be379 100644 --- a/drivers/staging/gpib/ni_usb/ni_usb_gpib.c +++ b/drivers/staging/gpib/ni_usb/ni_usb_gpib.c @@ -132,13 +132,13 @@ static int ni_usb_nonblocking_send_bulk_msg(struct ni= _usb_priv *ni_priv, void *d if (timeout_msecs) mod_timer(&ni_priv->bulk_timer, jiffies + msecs_to_jiffies(timeout_msecs= )); =20 - //pr_err("%s: submitting urb\n", __func__); retval =3D usb_submit_urb(ni_priv->bulk_urb, GFP_KERNEL); if (retval) { del_timer_sync(&ni_priv->bulk_timer); usb_free_urb(ni_priv->bulk_urb); ni_priv->bulk_urb =3D NULL; - pr_err("%s: failed to submit bulk out urb, retval=3D%i\n", __func__, ret= val); + dev_err(&usb_dev->dev, "%s: failed to submit bulk out urb, retval=3D%i\n= ", + __func__, retval); mutex_unlock(&ni_priv->bulk_transfer_lock); return retval; } @@ -146,7 +146,7 @@ static int ni_usb_nonblocking_send_bulk_msg(struct ni_u= sb_priv *ni_priv, void *d down(&context->complete); // wait for ni_usb_bulk_complete if (context->timed_out) { usb_kill_urb(ni_priv->bulk_urb); - pr_err("%s: killed urb due to timeout\n", __func__); + dev_err(&usb_dev->dev, "%s: killed urb due to timeout\n", __func__); retval =3D -ETIMEDOUT; } else { retval =3D ni_priv->bulk_urb->status; @@ -224,7 +224,8 @@ static int ni_usb_nonblocking_receive_bulk_msg(struct n= i_usb_priv *ni_priv, del_timer_sync(&ni_priv->bulk_timer); usb_free_urb(ni_priv->bulk_urb); ni_priv->bulk_urb =3D NULL; - pr_err("%s: failed to submit bulk out urb, retval=3D%i\n", __func__, ret= val); + dev_err(&usb_dev->dev, "%s: failed to submit bulk out urb, retval=3D%i\n= ", + __func__, retval); mutex_unlock(&ni_priv->bulk_transfer_lock); return retval; } @@ -249,7 +250,7 @@ static int ni_usb_nonblocking_receive_bulk_msg(struct n= i_usb_priv *ni_priv, } if (context->timed_out) { usb_kill_urb(ni_priv->bulk_urb); - pr_err("%s: killed urb due to timeout\n", __func__); + dev_err(&usb_dev->dev, "%s: killed urb due to timeout\n", __func__); retval =3D -ETIMEDOUT; } else { if (ni_priv->bulk_urb->status) @@ -315,6 +316,7 @@ static void ni_usb_soft_update_status(gpib_board_t *boa= rd, unsigned int ni_usb_i static const unsigned int ni_usb_ibsta_mask =3D SRQI | ATN | CIC | REM | = LACS | TACS | LOK; =20 struct ni_usb_priv *ni_priv =3D board->private_data; + struct usb_device *usb_dev =3D interface_to_usbdev(ni_priv->bus_interface= ); unsigned int need_monitoring_bits =3D ni_usb_ibsta_monitor_mask; unsigned long flags; =20 @@ -328,15 +330,14 @@ static void ni_usb_soft_update_status(gpib_board_t *b= oard, unsigned int ni_usb_i ni_priv->monitored_ibsta_bits &=3D ~ni_usb_ibsta; need_monitoring_bits &=3D ~ni_priv->monitored_ibsta_bits; /* mm - monitor= ed set */ spin_unlock_irqrestore(&board->spinlock, flags); - - GPIB_DPRINTK("%s: need_monitoring_bits=3D0x%x\n", __func__, need_monitori= ng_bits); + dev_dbg(&usb_dev->dev, "%s: need_monitoring_bits=3D0x%x\n", __func__, nee= d_monitoring_bits); =20 if (need_monitoring_bits & ~ni_usb_ibsta) ni_usb_set_interrupt_monitor(board, ni_usb_ibsta_monitor_mask); else if (need_monitoring_bits & ni_usb_ibsta) wake_up_interruptible(&board->wait); =20 - GPIB_DPRINTK("%s: ni_usb_ibsta=3D0x%x\n", __func__, ni_usb_ibsta); + dev_dbg(&usb_dev->dev, "%s: ni_usb_ibsta=3D0x%x\n", __func__, ni_usb_ibst= a); } =20 static int ni_usb_parse_status_block(const u8 *buffer, struct ni_usb_statu= s_block *status) @@ -355,7 +356,6 @@ static int ni_usb_parse_status_block(const u8 *buffer, = struct ni_usb_status_bloc =20 static void ni_usb_dump_raw_block(const u8 *raw_data, int length) { - pr_info("hex block dump\n"); print_hex_dump(KERN_INFO, "", DUMP_PREFIX_NONE, 8, 1, raw_data, length, t= rue); } =20 @@ -516,6 +516,7 @@ static int ni_usb_write_registers(struct ni_usb_priv *n= i_priv, const struct ni_usb_register *writes, int num_writes, unsigned int *ibsta) { + struct usb_device *usb_dev =3D interface_to_usbdev(ni_priv->bus_interface= ); int retval; u8 *out_data, *in_data; int out_data_length; @@ -530,7 +531,7 @@ static int ni_usb_write_registers(struct ni_usb_priv *n= i_priv, out_data_length =3D num_writes * bytes_per_write + 0x10; out_data =3D kmalloc(out_data_length, GFP_KERNEL); if (!out_data) { - pr_err("%s: kmalloc failed\n", __func__); + dev_err(&usb_dev->dev, "%s: kmalloc failed\n", __func__); return -ENOMEM; } i +=3D ni_usb_bulk_register_write_header(&out_data[i], num_writes); @@ -540,7 +541,7 @@ static int ni_usb_write_registers(struct ni_usb_priv *n= i_priv, out_data[i++] =3D 0x00; i +=3D ni_usb_bulk_termination(&out_data[i]); if (i > out_data_length) - pr_err("%s: bug! buffer overrun\n", __func__); + dev_err(&usb_dev->dev, "%s: bug! buffer overrun\n", __func__); =20 mutex_lock(&ni_priv->addressed_transfer_lock); =20 @@ -548,22 +549,22 @@ static int ni_usb_write_registers(struct ni_usb_priv = *ni_priv, kfree(out_data); if (retval) { mutex_unlock(&ni_priv->addressed_transfer_lock); - pr_err("%s: ni_usb_send_bulk_msg returned %i, bytes_written=3D%i, i=3D%i= \n", - __func__, retval, bytes_written, i); + dev_err(&usb_dev->dev, "%s: ni_usb_send_bulk_msg returned %i, bytes_writ= ten=3D%i, i=3D%i\n", + __func__, retval, bytes_written, i); return retval; } =20 in_data =3D kmalloc(in_data_length, GFP_KERNEL); if (!in_data) { mutex_unlock(&ni_priv->addressed_transfer_lock); - pr_err("%s: kmalloc failed\n", __func__); + dev_err(&usb_dev->dev, "%s: kmalloc failed\n", __func__); return -ENOMEM; } retval =3D ni_usb_receive_bulk_msg(ni_priv, in_data, in_data_length, &byt= es_read, 1000, 0); if (retval || bytes_read !=3D 16) { mutex_unlock(&ni_priv->addressed_transfer_lock); - pr_err("%s: ni_usb_receive_bulk_msg returned %i, bytes_read=3D%i\n", - __func__, retval, bytes_read); + dev_err(&usb_dev->dev, "%s: ni_usb_receive_bulk_msg returned %i, bytes_r= ead=3D%i\n", + __func__, retval, bytes_read); ni_usb_dump_raw_block(in_data, bytes_read); kfree(in_data); return retval; @@ -575,17 +576,18 @@ static int ni_usb_write_registers(struct ni_usb_priv = *ni_priv, //FIXME parse extra 09 status bits and termination kfree(in_data); if (status.id !=3D NIUSB_REG_WRITE_ID) { - pr_err("%s: parse error, id=3D0x%x !=3D NIUSB_REG_WRITE_ID\n", - __func__, status.id); + dev_err(&usb_dev->dev, "%s: parse error, id=3D0x%x !=3D NIUSB_REG_WRITE_= ID\n", + __func__, status.id); return -EIO; } if (status.error_code) { - pr_err("%s: nonzero error code 0x%x\n", __func__, status.error_code); + dev_err(&usb_dev->dev, "%s: nonzero error code 0x%x\n", + __func__, status.error_code); return -EIO; } if (reg_writes_completed !=3D num_writes) { - pr_err("%s: reg_writes_completed=3D%i, num_writes=3D%i\n", __func__, - reg_writes_completed, num_writes); + dev_err(&usb_dev->dev, "%s: reg_writes_completed=3D%i, num_writes=3D%i\n= ", + __func__, reg_writes_completed, num_writes); return -EIO; } if (ibsta) @@ -599,6 +601,7 @@ static int ni_usb_read(gpib_board_t *board, uint8_t *bu= ffer, size_t length, { int retval, parse_retval; struct ni_usb_priv *ni_priv =3D board->private_data; + struct usb_device *usb_dev =3D interface_to_usbdev(ni_priv->bus_interface= ); u8 *out_data, *in_data; static const int out_data_length =3D 0x20; int in_data_length; @@ -613,7 +616,7 @@ static int ni_usb_read(gpib_board_t *board, uint8_t *bu= ffer, size_t length, *bytes_read =3D 0; if (length > max_read_length) { length =3D max_read_length; - pr_err("%s: read length too long\n", __func__); + dev_err(&usb_dev->dev, "%s: read length too long\n", __func__); } out_data =3D kmalloc(out_data_length, GFP_KERNEL); if (!out_data) @@ -646,8 +649,8 @@ static int ni_usb_read(gpib_board_t *board, uint8_t *bu= ffer, size_t length, if (retval || usb_bytes_written !=3D i) { if (retval =3D=3D 0) retval =3D -EIO; - pr_err("%s: ni_usb_send_bulk_msg returned %i, usb_bytes_written=3D%i, i= =3D%i\n", - __func__, retval, usb_bytes_written, i); + dev_err(&usb_dev->dev, "%s: ni_usb_send_bulk_msg returned %i, usb_bytes_= written=3D%i, i=3D%i\n", + __func__, retval, usb_bytes_written, i); mutex_unlock(&ni_priv->addressed_transfer_lock); return retval; } @@ -665,8 +668,8 @@ static int ni_usb_read(gpib_board_t *board, uint8_t *bu= ffer, size_t length, =20 if (retval =3D=3D -ERESTARTSYS) { } else if (retval) { - pr_err("%s: ni_usb_receive_bulk_msg returned %i, usb_bytes_read=3D%i\n", - __func__, retval, usb_bytes_read); + dev_err(&usb_dev->dev, "%s: ni_usb_receive_bulk_msg returned %i, usb_byt= es_read=3D%i\n", + __func__, retval, usb_bytes_read); kfree(in_data); return retval; } @@ -674,14 +677,14 @@ static int ni_usb_read(gpib_board_t *board, uint8_t *= buffer, size_t length, if (parse_retval !=3D usb_bytes_read) { if (parse_retval >=3D 0) parse_retval =3D -EIO; - pr_err("%s: retval=3D%i usb_bytes_read=3D%i\n", - __func__, parse_retval, usb_bytes_read); + dev_err(&usb_dev->dev, "%s: retval=3D%i usb_bytes_read=3D%i\n", + __func__, parse_retval, usb_bytes_read); kfree(in_data); return parse_retval; } if (actual_length !=3D length - status.count) { - pr_err("%s: actual_length=3D%i expected=3D%li\n", - __func__, actual_length, (long)(length - status.count)); + dev_err(&usb_dev->dev, "%s: actual_length=3D%i expected=3D%li\n", + __func__, actual_length, (long)(length - status.count)); ni_usb_dump_raw_block(in_data, usb_bytes_read); } kfree(in_data); @@ -696,7 +699,7 @@ static int ni_usb_read(gpib_board_t *board, uint8_t *bu= ffer, size_t length, break; case NIUSB_ATN_STATE_ERROR: retval =3D -EIO; - pr_err("%s: read when ATN set\n", __func__); + dev_err(&usb_dev->dev, "%s: read when ATN set\n", __func__); break; case NIUSB_ADDRESSING_ERROR: retval =3D -EIO; @@ -705,12 +708,12 @@ static int ni_usb_read(gpib_board_t *board, uint8_t *= buffer, size_t length, retval =3D -ETIMEDOUT; break; case NIUSB_EOSMODE_ERROR: - pr_err("%s: driver bug, we should have been able to avoid NIUSB_EOSMODE_= ERROR.\n", - __func__); + dev_err(&usb_dev->dev, "%s: driver bug, we should have been able to avoi= d NIUSB_EOSMODE_ERROR.\n", + __func__); retval =3D -EINVAL; break; default: - pr_err("%s: unknown error code=3D%i\n", __func__, status.error_code); + dev_err(&usb_dev->dev, "%s: unknown error code=3D%i\n", __func__, status= .error_code); retval =3D -EIO; break; } @@ -728,6 +731,7 @@ static int ni_usb_write(gpib_board_t *board, uint8_t *b= uffer, size_t length, { int retval; struct ni_usb_priv *ni_priv =3D board->private_data; + struct usb_device *usb_dev =3D interface_to_usbdev(ni_priv->bus_interface= ); u8 *out_data, *in_data; int out_data_length; static const int in_data_length =3D 0x10; @@ -741,7 +745,7 @@ static int ni_usb_write(gpib_board_t *board, uint8_t *b= uffer, size_t length, if (length > max_write_length) { length =3D max_write_length; send_eoi =3D 0; - pr_err("%s: write length too long\n", __func__); + dev_err(&usb_dev->dev, "%s: write length too long\n", __func__); } out_data_length =3D length + 0x10; out_data =3D kmalloc(out_data_length, GFP_KERNEL); @@ -773,8 +777,8 @@ static int ni_usb_write(gpib_board_t *board, uint8_t *b= uffer, size_t length, kfree(out_data); if (retval || usb_bytes_written !=3D i) { mutex_unlock(&ni_priv->addressed_transfer_lock); - pr_err("%s: ni_usb_send_bulk_msg returned %i, usb_bytes_written=3D%i, i= =3D%i\n", - __func__, retval, usb_bytes_written, i); + dev_err(&usb_dev->dev, "%s: ni_usb_send_bulk_msg returned %i, usb_bytes_= written=3D%i, i=3D%i\n", + __func__, retval, usb_bytes_written, i); return retval; } =20 @@ -787,8 +791,8 @@ static int ni_usb_write(gpib_board_t *board, uint8_t *b= uffer, size_t length, mutex_unlock(&ni_priv->addressed_transfer_lock); =20 if ((retval && retval !=3D -ERESTARTSYS) || usb_bytes_read !=3D 12) { - pr_err("%s: ni_usb_receive_bulk_msg returned %i, usb_bytes_read=3D%i\n", - __func__, retval, usb_bytes_read); + dev_err(&usb_dev->dev, "%s: ni_usb_receive_bulk_msg returned %i, usb_byt= es_read=3D%i\n", + __func__, retval, usb_bytes_read); kfree(in_data); return retval; } @@ -804,8 +808,8 @@ static int ni_usb_write(gpib_board_t *board, uint8_t *b= uffer, size_t length, */ break; case NIUSB_ADDRESSING_ERROR: - pr_err("%s: Addressing error retval %d error code=3D%i\n", - __func__, retval, status.error_code); + dev_err(&usb_dev->dev, "%s: Addressing error retval %d error code=3D%i\n= ", + __func__, retval, status.error_code); retval =3D -ENXIO; break; case NIUSB_NO_LISTENER_ERROR: @@ -815,8 +819,8 @@ static int ni_usb_write(gpib_board_t *board, uint8_t *b= uffer, size_t length, retval =3D -ETIMEDOUT; break; default: - pr_err("%s: unknown error code=3D%i\n", - __func__, status.error_code); + dev_err(&usb_dev->dev, "%s: unknown error code=3D%i\n", + __func__, status.error_code); retval =3D -EPIPE; break; } @@ -830,6 +834,7 @@ static int ni_usb_command_chunk(gpib_board_t *board, ui= nt8_t *buffer, size_t len { int retval; struct ni_usb_priv *ni_priv =3D board->private_data; + struct usb_device *usb_dev =3D interface_to_usbdev(ni_priv->bus_interface= ); u8 *out_data, *in_data; int out_data_length; static const int in_data_length =3D 0x10; @@ -866,8 +871,8 @@ static int ni_usb_command_chunk(gpib_board_t *board, ui= nt8_t *buffer, size_t len kfree(out_data); if (retval || bytes_written !=3D i) { mutex_unlock(&ni_priv->addressed_transfer_lock); - pr_err("%s: ni_usb_send_bulk_msg returned %i, bytes_written=3D%i, i=3D%i= \n", - __func__, retval, bytes_written, i); + dev_err(&usb_dev->dev, "%s: ni_usb_send_bulk_msg returned %i, bytes_writ= ten=3D%i, i=3D%i\n", + __func__, retval, bytes_written, i); return retval; } =20 @@ -883,8 +888,8 @@ static int ni_usb_command_chunk(gpib_board_t *board, ui= nt8_t *buffer, size_t len mutex_unlock(&ni_priv->addressed_transfer_lock); =20 if ((retval && retval !=3D -ERESTARTSYS) || bytes_read !=3D 12) { - pr_err("%s: ni_usb_receive_bulk_msg returned %i, bytes_read=3D%i\n", - __func__, retval, bytes_read); + dev_err(&usb_dev->dev, "%s: ni_usb_receive_bulk_msg returned %i, bytes_r= ead=3D%i\n", + __func__, retval, bytes_read); kfree(in_data); return retval; } @@ -902,12 +907,12 @@ static int ni_usb_command_chunk(gpib_board_t *board, = uint8_t *buffer, size_t len case NIUSB_NO_BUS_ERROR: return -ENOTCONN; case NIUSB_EOSMODE_ERROR: - pr_err("%s: got eosmode error. Driver bug?\n", __func__); + dev_err(&usb_dev->dev, "%s: got eosmode error. Driver bug?\n", __func__); return -EIO; case NIUSB_TIMEOUT_ERROR: return -ETIMEDOUT; default: - pr_err("%s: unknown error code=3D%i\n", __func__, status.error_code); + dev_err(&usb_dev->dev, "%s: unknown error code=3D%i\n", __func__, status= .error_code); return -EIO; } ni_usb_soft_update_status(board, status.ibsta, 0); @@ -935,6 +940,7 @@ static int ni_usb_take_control(gpib_board_t *board, int= synchronous) { int retval; struct ni_usb_priv *ni_priv =3D board->private_data; + struct usb_device *usb_dev =3D interface_to_usbdev(ni_priv->bus_interface= ); u8 *out_data, *in_data; static const int out_data_length =3D 0x10; static const int in_data_length =3D 0x10; @@ -960,15 +966,15 @@ static int ni_usb_take_control(gpib_board_t *board, i= nt synchronous) kfree(out_data); if (retval || bytes_written !=3D i) { mutex_unlock(&ni_priv->addressed_transfer_lock); - pr_err("%s: ni_usb_send_bulk_msg returned %i, bytes_written=3D%i, i=3D%i= \n", - __func__, retval, bytes_written, i); + dev_err(&usb_dev->dev, "%s: ni_usb_send_bulk_msg returned %i, bytes_writ= ten=3D%i, i=3D%i\n", + __func__, retval, bytes_written, i); return retval; } =20 in_data =3D kmalloc(in_data_length, GFP_KERNEL); if (!in_data) { mutex_unlock(&ni_priv->addressed_transfer_lock); - pr_err("%s: kmalloc failed\n", __func__); + dev_err(&usb_dev->dev, "%s: kmalloc failed\n", __func__); return -ENOMEM; } retval =3D ni_usb_receive_bulk_msg(ni_priv, in_data, in_data_length, &byt= es_read, 1000, 1); @@ -978,8 +984,8 @@ static int ni_usb_take_control(gpib_board_t *board, int= synchronous) if ((retval && retval !=3D -ERESTARTSYS) || bytes_read !=3D 12) { if (retval =3D=3D 0) retval =3D -EIO; - pr_err("%s: ni_usb_receive_bulk_msg returned %i, bytes_read=3D%i\n", - __func__, retval, bytes_read); + dev_err(&usb_dev->dev, "%s: ni_usb_receive_bulk_msg returned %i, bytes_r= ead=3D%i\n", + __func__, retval, bytes_read); kfree(in_data); return retval; } @@ -993,6 +999,7 @@ static int ni_usb_go_to_standby(gpib_board_t *board) { int retval; struct ni_usb_priv *ni_priv =3D board->private_data; + struct usb_device *usb_dev =3D interface_to_usbdev(ni_priv->bus_interface= ); u8 *out_data, *in_data; static const int out_data_length =3D 0x10; static const int in_data_length =3D 0x20; @@ -1016,15 +1023,15 @@ static int ni_usb_go_to_standby(gpib_board_t *board) kfree(out_data); if (retval || bytes_written !=3D i) { mutex_unlock(&ni_priv->addressed_transfer_lock); - pr_err("%s: ni_usb_send_bulk_msg returned %i, bytes_written=3D%i, i=3D%i= \n", - __func__, retval, bytes_written, i); + dev_err(&usb_dev->dev, "%s: ni_usb_send_bulk_msg returned %i, bytes_writ= ten=3D%i, i=3D%i\n", + __func__, retval, bytes_written, i); return retval; } =20 in_data =3D kmalloc(in_data_length, GFP_KERNEL); if (!in_data) { mutex_unlock(&ni_priv->addressed_transfer_lock); - pr_err("%s: kmalloc failed\n", __FILE__); + dev_err(&usb_dev->dev, "%s: kmalloc failed\n", __func__); return -ENOMEM; } retval =3D ni_usb_receive_bulk_msg(ni_priv, in_data, in_data_length, &byt= es_read, 1000, 0); @@ -1032,16 +1039,16 @@ static int ni_usb_go_to_standby(gpib_board_t *board) mutex_unlock(&ni_priv->addressed_transfer_lock); =20 if (retval || bytes_read !=3D 12) { - pr_err("%s: ni_usb_receive_bulk_msg returned %i, bytes_read=3D%i\n", - __func__, retval, bytes_read); + dev_err(&usb_dev->dev, "%s: ni_usb_receive_bulk_msg returned %i, bytes_r= ead=3D%i\n", + __func__, retval, bytes_read); kfree(in_data); return retval; } ni_usb_parse_status_block(in_data, &status); kfree(in_data); if (status.id !=3D NIUSB_IBGTS_ID) - pr_err("%s: bug: status.id 0x%x !=3D INUSB_IBGTS_ID\n", - __func__, status.id); + dev_err(&usb_dev->dev, "%s: bug: status.id 0x%x !=3D INUSB_IBGTS_ID\n", + __func__, status.id); ni_usb_soft_update_status(board, status.ibsta, 0); return 0; } @@ -1050,6 +1057,7 @@ static void ni_usb_request_system_control(gpib_board_= t *board, int request_contr { int retval; struct ni_usb_priv *ni_priv =3D board->private_data; + struct usb_device *usb_dev =3D interface_to_usbdev(ni_priv->bus_interface= ); int i =3D 0; struct ni_usb_register writes[4]; unsigned int ibsta; @@ -1083,7 +1091,7 @@ static void ni_usb_request_system_control(gpib_board_= t *board, int request_contr } retval =3D ni_usb_write_registers(ni_priv, writes, i, &ibsta); if (retval < 0) { - pr_err("%s: register write failed, retval=3D%i\n", __func__, retval); + dev_err(&usb_dev->dev, "%s: register write failed, retval=3D%i\n", __fun= c__, retval); return; // retval; } if (!request_control) @@ -1097,6 +1105,7 @@ static void ni_usb_interface_clear(gpib_board_t *boar= d, int assert) { int retval; struct ni_usb_priv *ni_priv =3D board->private_data; + struct usb_device *usb_dev =3D interface_to_usbdev(ni_priv->bus_interface= ); u8 *out_data, *in_data; static const int out_data_length =3D 0x10; static const int in_data_length =3D 0x10; @@ -1109,7 +1118,7 @@ static void ni_usb_interface_clear(gpib_board_t *boar= d, int assert) return; out_data =3D kmalloc(out_data_length, GFP_KERNEL); if (!out_data) { - pr_err("%s: kmalloc failed\n", __FILE__); + dev_err(&usb_dev->dev, "%s: kmalloc failed\n", __func__); return; } out_data[i++] =3D NIUSB_IBSIC_ID; @@ -1120,8 +1129,8 @@ static void ni_usb_interface_clear(gpib_board_t *boar= d, int assert) retval =3D ni_usb_send_bulk_msg(ni_priv, out_data, i, &bytes_written, 100= 0); kfree(out_data); if (retval || bytes_written !=3D i) { - pr_err("%s: ni_usb_send_bulk_msg returned %i, bytes_written=3D%i, i=3D%i= \n", - __func__, retval, bytes_written, i); + dev_err(&usb_dev->dev, "%s: ni_usb_send_bulk_msg returned %i, bytes_writ= ten=3D%i, i=3D%i\n", + __func__, retval, bytes_written, i); return; } in_data =3D kmalloc(in_data_length, GFP_KERNEL); @@ -1130,8 +1139,8 @@ static void ni_usb_interface_clear(gpib_board_t *boar= d, int assert) =20 retval =3D ni_usb_receive_bulk_msg(ni_priv, in_data, in_data_length, &byt= es_read, 1000, 0); if (retval || bytes_read !=3D 12) { - pr_err("%s: ni_usb_receive_bulk_msg returned %i, bytes_read=3D%i\n", - __func__, retval, bytes_read); + dev_err(&usb_dev->dev, "%s: ni_usb_receive_bulk_msg returned %i, bytes_r= ead=3D%i\n", + __func__, retval, bytes_read); kfree(in_data); return; } @@ -1144,6 +1153,7 @@ static void ni_usb_remote_enable(gpib_board_t *board,= int enable) { int retval; struct ni_usb_priv *ni_priv =3D board->private_data; + struct usb_device *usb_dev =3D interface_to_usbdev(ni_priv->bus_interface= ); struct ni_usb_register reg; unsigned int ibsta; =20 @@ -1155,7 +1165,7 @@ static void ni_usb_remote_enable(gpib_board_t *board,= int enable) reg.value =3D AUX_CREN; retval =3D ni_usb_write_registers(ni_priv, ®, 1, &ibsta); if (retval < 0) { - pr_err("%s: register write failed, retval=3D%i\n", __func__, retval); + dev_err(&usb_dev->dev, "%s: register write failed, retval=3D%i\n", __fun= c__, retval); return; //retval; } ni_priv->ren_state =3D enable; @@ -1190,11 +1200,12 @@ static unsigned int ni_usb_update_status(gpib_board= _t *board, unsigned int clear { int retval; struct ni_usb_priv *ni_priv =3D board->private_data; + struct usb_device *usb_dev =3D interface_to_usbdev(ni_priv->bus_interface= ); static const int buffer_length =3D 8; u8 *buffer; struct ni_usb_status_block status; =20 - //printk("%s: receive control pipe is %i\n", __FILE__, pipe); + //printk("%s: receive control pipe is %i\n", __func__, pipe); buffer =3D kmalloc(buffer_length, GFP_KERNEL); if (!buffer) return board->status; @@ -1203,7 +1214,7 @@ static unsigned int ni_usb_update_status(gpib_board_t= *board, unsigned int clear USB_TYPE_VENDOR | USB_RECIP_DEVICE, 0x200, 0x0, buffer, buffer_length, 1000); if (retval !=3D buffer_length) { - pr_err("%s: usb_control_msg returned %i\n", __FILE__, retval); + dev_err(&usb_dev->dev, "%s: usb_control_msg returned %i\n", __func__, re= tval); kfree(buffer); return board->status; } @@ -1216,12 +1227,13 @@ static unsigned int ni_usb_update_status(gpib_board= _t *board, unsigned int clear // tells ni-usb to immediately stop an ongoing i/o operation static void ni_usb_stop(struct ni_usb_priv *ni_priv) { + struct usb_device *usb_dev =3D interface_to_usbdev(ni_priv->bus_interface= ); int retval; static const int buffer_length =3D 8; u8 *buffer; struct ni_usb_status_block status; =20 - //printk("%s: receive control pipe is %i\n", __FILE__, pipe); + //printk("%s: receive control pipe is %i\n", __func__, pipe); buffer =3D kmalloc(buffer_length, GFP_KERNEL); if (!buffer) return; @@ -1230,7 +1242,7 @@ static void ni_usb_stop(struct ni_usb_priv *ni_priv) USB_TYPE_VENDOR | USB_RECIP_DEVICE, 0x0, 0x0, buffer, buffer_length, 1000); if (retval !=3D buffer_length) { - pr_err("%s: usb_control_msg returned %i\n", __FILE__, retval); + dev_err(&usb_dev->dev, "%s: usb_control_msg returned %i\n", __func__, re= tval); kfree(buffer); return; } @@ -1242,6 +1254,7 @@ static int ni_usb_primary_address(gpib_board_t *board= , unsigned int address) { int retval; struct ni_usb_priv *ni_priv =3D board->private_data; + struct usb_device *usb_dev =3D interface_to_usbdev(ni_priv->bus_interface= ); int i =3D 0; struct ni_usb_register writes[2]; unsigned int ibsta; @@ -1256,7 +1269,7 @@ static int ni_usb_primary_address(gpib_board_t *board= , unsigned int address) i++; retval =3D ni_usb_write_registers(ni_priv, writes, i, &ibsta); if (retval < 0) { - pr_err("%s: register write failed, retval=3D%i\n", __func__, retval); + dev_err(&usb_dev->dev, "%s: register write failed, retval=3D%i\n", __fun= c__, retval); return retval; } ni_usb_soft_update_status(board, ibsta, 0); @@ -1296,6 +1309,7 @@ static int ni_usb_secondary_address(gpib_board_t *boa= rd, unsigned int address, i { int retval; struct ni_usb_priv *ni_priv =3D board->private_data; + struct usb_device *usb_dev =3D interface_to_usbdev(ni_priv->bus_interface= ); int i =3D 0; struct ni_usb_register writes[3]; unsigned int ibsta; @@ -1303,7 +1317,7 @@ static int ni_usb_secondary_address(gpib_board_t *boa= rd, unsigned int address, i i +=3D ni_usb_write_sad(writes, address, enable); retval =3D ni_usb_write_registers(ni_priv, writes, i, &ibsta); if (retval < 0) { - pr_err("%s: register write failed, retval=3D%i\n", __func__, retval); + dev_err(&usb_dev->dev, "%s: register write failed, retval=3D%i\n", __fun= c__, retval); return retval; } ni_usb_soft_update_status(board, ibsta, 0); @@ -1314,6 +1328,7 @@ static int ni_usb_parallel_poll(gpib_board_t *board, = uint8_t *result) { int retval; struct ni_usb_priv *ni_priv =3D board->private_data; + struct usb_device *usb_dev =3D interface_to_usbdev(ni_priv->bus_interface= ); u8 *out_data, *in_data; static const int out_data_length =3D 0x10; static const int in_data_length =3D 0x20; @@ -1336,8 +1351,8 @@ static int ni_usb_parallel_poll(gpib_board_t *board, = uint8_t *result) =20 kfree(out_data); if (retval || bytes_written !=3D i) { - pr_err("%s: ni_usb_send_bulk_msg returned %i, bytes_written=3D%i, i=3D%i= \n", - __func__, retval, bytes_written, i); + dev_err(&usb_dev->dev, "%s: ni_usb_send_bulk_msg returned %i, bytes_writ= ten=3D%i, i=3D%i\n", + __func__, retval, bytes_written, i); return retval; } in_data =3D kmalloc(in_data_length, GFP_KERNEL); @@ -1349,8 +1364,8 @@ static int ni_usb_parallel_poll(gpib_board_t *board, = uint8_t *result) &bytes_read, 1000, 1); =20 if (retval && retval !=3D -ERESTARTSYS) { - pr_err("%s: ni_usb_receive_bulk_msg returned %i, bytes_read=3D%i\n", - __func__, retval, bytes_read); + dev_err(&usb_dev->dev, "%s: ni_usb_receive_bulk_msg returned %i, bytes_r= ead=3D%i\n", + __func__, retval, bytes_read); kfree(in_data); return retval; } @@ -1365,6 +1380,7 @@ static void ni_usb_parallel_poll_configure(gpib_board= _t *board, uint8_t config) { int retval; struct ni_usb_priv *ni_priv =3D board->private_data; + struct usb_device *usb_dev =3D interface_to_usbdev(ni_priv->bus_interface= ); int i =3D 0; struct ni_usb_register writes[1]; unsigned int ibsta; @@ -1375,7 +1391,7 @@ static void ni_usb_parallel_poll_configure(gpib_board= _t *board, uint8_t config) i++; retval =3D ni_usb_write_registers(ni_priv, writes, i, &ibsta); if (retval < 0) { - pr_err("%s: register write failed, retval=3D%i\n", __func__, retval); + dev_err(&usb_dev->dev, "%s: register write failed, retval=3D%i\n", __fun= c__, retval); return;// retval; } ni_usb_soft_update_status(board, ibsta, 0); @@ -1386,6 +1402,7 @@ static void ni_usb_parallel_poll_response(gpib_board_= t *board, int ist) { int retval; struct ni_usb_priv *ni_priv =3D board->private_data; + struct usb_device *usb_dev =3D interface_to_usbdev(ni_priv->bus_interface= ); int i =3D 0; struct ni_usb_register writes[1]; unsigned int ibsta; @@ -1399,7 +1416,7 @@ static void ni_usb_parallel_poll_response(gpib_board_= t *board, int ist) i++; retval =3D ni_usb_write_registers(ni_priv, writes, i, &ibsta); if (retval < 0) { - pr_err("%s: register write failed, retval=3D%i\n", __func__, retval); + dev_err(&usb_dev->dev, "%s: register write failed, retval=3D%i\n", __fun= c__, retval); return;// retval; } ni_usb_soft_update_status(board, ibsta, 0); @@ -1410,6 +1427,7 @@ static void ni_usb_serial_poll_response(gpib_board_t = *board, u8 status) { int retval; struct ni_usb_priv *ni_priv =3D board->private_data; + struct usb_device *usb_dev =3D interface_to_usbdev(ni_priv->bus_interface= ); int i =3D 0; struct ni_usb_register writes[1]; unsigned int ibsta; @@ -1420,7 +1438,7 @@ static void ni_usb_serial_poll_response(gpib_board_t = *board, u8 status) i++; retval =3D ni_usb_write_registers(ni_priv, writes, i, &ibsta); if (retval < 0) { - pr_err("%s: register write failed, retval=3D%i\n", __func__, retval); + dev_err(&usb_dev->dev, "%s: register write failed, retval=3D%i\n", __fun= c__, retval); return;// retval; } ni_usb_soft_update_status(board, ibsta, 0); @@ -1436,6 +1454,7 @@ static void ni_usb_return_to_local(gpib_board_t *boar= d) { int retval; struct ni_usb_priv *ni_priv =3D board->private_data; + struct usb_device *usb_dev =3D interface_to_usbdev(ni_priv->bus_interface= ); int i =3D 0; struct ni_usb_register writes[1]; unsigned int ibsta; @@ -1446,7 +1465,7 @@ static void ni_usb_return_to_local(gpib_board_t *boar= d) i++; retval =3D ni_usb_write_registers(ni_priv, writes, i, &ibsta); if (retval < 0) { - pr_err("%s: register write failed, retval=3D%i\n", __func__, retval); + dev_err(&usb_dev->dev, "%s: register write failed, retval=3D%i\n", __fun= c__, retval); return;// retval; } ni_usb_soft_update_status(board, ibsta, 0); @@ -1457,6 +1476,7 @@ static int ni_usb_line_status(const gpib_board_t *boa= rd) { int retval; struct ni_usb_priv *ni_priv =3D board->private_data; + struct usb_device *usb_dev =3D interface_to_usbdev(ni_priv->bus_interface= ); u8 *out_data, *in_data; static const int out_data_length =3D 0x20; static const int in_data_length =3D 0x20; @@ -1487,15 +1507,15 @@ static int ni_usb_line_status(const gpib_board_t *b= oard) if (retval || bytes_written !=3D i) { mutex_unlock(&ni_priv->addressed_transfer_lock); if (retval !=3D -EAGAIN) - pr_err("%s: ni_usb_send_bulk_msg returned %i, bytes_written=3D%i, i=3D%= i\n", - __func__, retval, bytes_written, i); + dev_err(&usb_dev->dev, "%s: ni_usb_send_bulk_msg returned %i, bytes_wri= tten=3D%i, i=3D%i\n", + __func__, retval, bytes_written, i); return retval; } =20 in_data =3D kmalloc(in_data_length, GFP_KERNEL); if (!in_data) { mutex_unlock(&ni_priv->addressed_transfer_lock); - pr_err("%s: kmalloc failed\n", __FILE__); + dev_err(&usb_dev->dev, "%s: kmalloc failed\n", __func__); return -ENOMEM; } retval =3D ni_usb_nonblocking_receive_bulk_msg(ni_priv, in_data, in_data_= length, @@ -1505,8 +1525,8 @@ static int ni_usb_line_status(const gpib_board_t *boa= rd) =20 if (retval) { if (retval !=3D -EAGAIN) - pr_err("%s: ni_usb_receive_bulk_msg returned %i, bytes_read=3D%i\n", - __func__, retval, bytes_read); + dev_err(&usb_dev->dev, "%s: ni_usb_receive_bulk_msg returned %i, bytes_= read=3D%i\n", + __func__, retval, bytes_read); kfree(in_data); return retval; } @@ -1573,6 +1593,7 @@ static unsigned int ni_usb_t1_delay(gpib_board_t *boa= rd, unsigned int nano_sec) { int retval; struct ni_usb_priv *ni_priv =3D board->private_data; + struct usb_device *usb_dev =3D interface_to_usbdev(ni_priv->bus_interface= ); struct ni_usb_register writes[3]; unsigned int ibsta; unsigned int actual_ns; @@ -1581,7 +1602,7 @@ static unsigned int ni_usb_t1_delay(gpib_board_t *boa= rd, unsigned int nano_sec) i =3D ni_usb_setup_t1_delay(writes, nano_sec, &actual_ns); retval =3D ni_usb_write_registers(ni_priv, writes, i, &ibsta); if (retval < 0) { - pr_err("%s: register write failed, retval=3D%i\n", __func__, retval); + dev_err(&usb_dev->dev, "%s: register write failed, retval=3D%i\n", __fun= c__, retval); return -1; //FIXME should change return type to int for error reporting } board->t1_nano_sec =3D actual_ns; @@ -1615,6 +1636,7 @@ static void ni_usb_free_private(struct ni_usb_priv *n= i_priv) static int ni_usb_setup_init(gpib_board_t *board, struct ni_usb_register *= writes) { struct ni_usb_priv *ni_priv =3D board->private_data; + struct usb_device *usb_dev =3D interface_to_usbdev(ni_priv->bus_interface= ); unsigned int mask, actual_ns; int i =3D 0; =20 @@ -1712,7 +1734,7 @@ static int ni_usb_setup_init(gpib_board_t *board, str= uct ni_usb_register *writes writes[i].value =3D AUX_CPPF; i++; if (i > NUM_INIT_WRITES) { - pr_err("%s: bug!, buffer overrun, i=3D%i\n", __func__, i); + dev_err(&usb_dev->dev, "%s: bug!, buffer overrun, i=3D%i\n", __func__, i= ); return 0; } return i; @@ -1722,6 +1744,7 @@ static int ni_usb_init(gpib_board_t *board) { int retval; struct ni_usb_priv *ni_priv =3D board->private_data; + struct usb_device *usb_dev =3D interface_to_usbdev(ni_priv->bus_interface= ); struct ni_usb_register *writes; unsigned int ibsta; int writes_len; @@ -1737,7 +1760,7 @@ static int ni_usb_init(gpib_board_t *board) return -EFAULT; kfree(writes); if (retval) { - pr_err("%s: register write failed, retval=3D%i\n", __func__, retval); + dev_err(&usb_dev->dev, "%s: register write failed, retval=3D%i\n", __fun= c__, retval); return retval; } ni_usb_soft_update_status(board, ibsta, 0); @@ -1748,6 +1771,7 @@ static void ni_usb_interrupt_complete(struct urb *urb) { gpib_board_t *board =3D urb->context; struct ni_usb_priv *ni_priv =3D board->private_data; + struct usb_device *usb_dev =3D interface_to_usbdev(ni_priv->bus_interface= ); int retval; struct ni_usb_status_block status; unsigned long flags; @@ -1767,7 +1791,7 @@ static void ni_usb_interrupt_complete(struct urb *urb) default: /* other error, resubmit */ retval =3D usb_submit_urb(ni_priv->interrupt_urb, GFP_ATOMIC); if (retval) - pr_err("%s: failed to resubmit interrupt urb\n", __func__); + dev_err(&usb_dev->dev, "%s: failed to resubmit interrupt urb\n", __func= __); return; } =20 @@ -1783,32 +1807,34 @@ static void ni_usb_interrupt_complete(struct urb *u= rb) =20 retval =3D usb_submit_urb(ni_priv->interrupt_urb, GFP_ATOMIC); if (retval) - pr_err("%s: failed to resubmit interrupt urb\n", __func__); + dev_err(&usb_dev->dev, "%s: failed to resubmit interrupt urb\n", __func_= _); } =20 static int ni_usb_set_interrupt_monitor(gpib_board_t *board, unsigned int = monitored_bits) { int retval; struct ni_usb_priv *ni_priv =3D board->private_data; + struct usb_device *usb_dev =3D interface_to_usbdev(ni_priv->bus_interface= ); static const int buffer_length =3D 8; u8 *buffer; struct ni_usb_status_block status; unsigned long flags; - //printk("%s: receive control pipe is %i\n", __FILE__, pipe); + //printk("%s: receive control pipe is %i\n", __func__, pipe); buffer =3D kmalloc(buffer_length, GFP_KERNEL); if (!buffer) return -ENOMEM; =20 spin_lock_irqsave(&board->spinlock, flags); ni_priv->monitored_ibsta_bits =3D ni_usb_ibsta_monitor_mask & monitored_b= its; -// pr_err("debug: %s: monitored_ibsta_bits=3D0x%x\n", __func__, ni_priv->m= onitored_ibsta_bits); +// dev_err(&usb_dev->dev, "debug: %s: monitored_ibsta_bits=3D0x%x\n", +// __func__, ni_priv->monitored_ibsta_bits); spin_unlock_irqrestore(&board->spinlock, flags); retval =3D ni_usb_receive_control_msg(ni_priv, NI_USB_WAIT_REQUEST, USB_D= IR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE, 0x300, ni_usb_ibsta_monitor_mask & monitored_bits, buffer, buffer_length, 1000); if (retval !=3D buffer_length) { - pr_err("%s: usb_control_msg returned %i\n", __FILE__, retval); + dev_err(&usb_dev->dev, "%s: usb_control_msg returned %i\n", __func__, re= tval); kfree(buffer); return -1; } @@ -1844,7 +1870,8 @@ static int ni_usb_setup_urbs(gpib_board_t *board) retval =3D usb_submit_urb(ni_priv->interrupt_urb, GFP_KERNEL); mutex_unlock(&ni_priv->interrupt_transfer_lock); if (retval) { - pr_err("%s: failed to submit first interrupt urb, retval=3D%i\n", __FILE= __, retval); + dev_err(&usb_dev->dev, "%s: failed to submit first interrupt urb, retval= =3D%i\n", + __func__, retval); return retval; } return 0; @@ -1862,6 +1889,7 @@ static void ni_usb_cleanup_urbs(struct ni_usb_priv *n= i_priv) =20 static int ni_usb_b_read_serial_number(struct ni_usb_priv *ni_priv) { + struct usb_device *usb_dev =3D interface_to_usbdev(ni_priv->bus_interface= ); int retval; u8 *out_data; u8 *in_data; @@ -1894,20 +1922,20 @@ static int ni_usb_b_read_serial_number(struct ni_us= b_priv *ni_priv) i +=3D ni_usb_bulk_termination(&out_data[i]); retval =3D ni_usb_send_bulk_msg(ni_priv, out_data, out_data_length, &byte= s_written, 1000); if (retval) { - pr_err("%s: ni_usb_send_bulk_msg returned %i, bytes_written=3D%i, i=3D%l= i\n", - __func__, - retval, bytes_written, (long)out_data_length); + dev_err(&usb_dev->dev, "%s: ni_usb_send_bulk_msg returned %i, bytes_writ= ten=3D%i, i=3D%li\n", + __func__, + retval, bytes_written, (long)out_data_length); goto serial_out; } retval =3D ni_usb_receive_bulk_msg(ni_priv, in_data, in_data_length, &byt= es_read, 1000, 0); if (retval) { - pr_err("%s: ni_usb_receive_bulk_msg returned %i, bytes_read=3D%i\n", - __func__, retval, bytes_read); + dev_err(&usb_dev->dev, "%s: ni_usb_receive_bulk_msg returned %i, bytes_r= ead=3D%i\n", + __func__, retval, bytes_read); ni_usb_dump_raw_block(in_data, bytes_read); goto serial_out; } if (ARRAY_SIZE(results) < num_reads) { - pr_err("Setup bug\n"); + dev_err(&usb_dev->dev, "Setup bug\n"); retval =3D -EINVAL; goto serial_out; } @@ -1915,7 +1943,7 @@ static int ni_usb_b_read_serial_number(struct ni_usb_= priv *ni_priv) serial_number =3D 0; for (j =3D 0; j < num_reads; ++j) serial_number |=3D (results[j] & 0xff) << (8 * j); - pr_info("%s: board serial number is 0x%x\n", __func__, serial_number); + dev_info(&usb_dev->dev, "%s: board serial number is 0x%x\n", __func__, se= rial_number); retval =3D 0; serial_out: kfree(in_data); @@ -1925,6 +1953,7 @@ static int ni_usb_b_read_serial_number(struct ni_usb_= priv *ni_priv) =20 static int ni_usb_hs_wait_for_ready(struct ni_usb_priv *ni_priv) { + struct usb_device *usb_dev =3D interface_to_usbdev(ni_priv->bus_interface= ); static const int buffer_size =3D 0x10; static const int timeout =3D 50; static const int msec_sleep_duration =3D 100; @@ -1942,22 +1971,22 @@ static int ni_usb_hs_wait_for_ready(struct ni_usb_p= riv *ni_priv) USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE, 0x0, 0x0, buffer, buffer_size, 1000); if (retval < 0) { - pr_err("%s: usb_control_msg request 0x%x returned %i\n", - __FILE__, NI_USB_SERIAL_NUMBER_REQUEST, retval); + dev_err(&usb_dev->dev, "%s: usb_control_msg request 0x%x returned %i\n", + __func__, NI_USB_SERIAL_NUMBER_REQUEST, retval); goto ready_out; } j =3D 0; if (buffer[j] !=3D NI_USB_SERIAL_NUMBER_REQUEST) { - pr_err("%s: unexpected data: buffer[%i]=3D0x%x, expected 0x%x\n", - __func__, j, (int)buffer[j], NI_USB_SERIAL_NUMBER_REQUEST); + dev_err(&usb_dev->dev, "%s: unexpected data: buffer[%i]=3D0x%x, expected= 0x%x\n", + __func__, j, (int)buffer[j], NI_USB_SERIAL_NUMBER_REQUEST); unexpected =3D 1; } if (unexpected) ni_usb_dump_raw_block(buffer, retval); // NI-USB-HS+ pads the serial with 0x0 to make 16 bytes if (retval !=3D 5 && retval !=3D 16) { - pr_err("%s: received unexpected number of bytes =3D %i, expected 5 or 16= \n", - __func__, retval); + dev_err(&usb_dev->dev, "%s: received unexpected number of bytes =3D %i, = expected 5 or 16\n", + __func__, retval); ni_usb_dump_raw_block(buffer, retval); } serial_number =3D 0; @@ -1965,7 +1994,7 @@ static int ni_usb_hs_wait_for_ready(struct ni_usb_pri= v *ni_priv) serial_number |=3D (buffer[++j] << 8); serial_number |=3D (buffer[++j] << 16); serial_number |=3D (buffer[++j] << 24); - pr_info("%s: board serial number is 0x%x\n", __func__, serial_number); + dev_info(&usb_dev->dev, "%s: board serial number is 0x%x\n", __func__, se= rial_number); for (i =3D 0; i < timeout; ++i) { int ready =3D 0; =20 @@ -1973,26 +2002,26 @@ static int ni_usb_hs_wait_for_ready(struct ni_usb_p= riv *ni_priv) USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE, 0x0, 0x0, buffer, buffer_size, 100); if (retval < 0) { - pr_err("%s: usb_control_msg request 0x%x returned %i\n", - __func__, NI_USB_POLL_READY_REQUEST, retval); + dev_err(&usb_dev->dev, "%s: usb_control_msg request 0x%x returned %i\n", + __func__, NI_USB_POLL_READY_REQUEST, retval); goto ready_out; } j =3D 0; unexpected =3D 0; if (buffer[j] !=3D NI_USB_POLL_READY_REQUEST) { // [0] - pr_err("%s: unexpected data: buffer[%i]=3D0x%x, expected 0x%x\n", - __func__, j, (int)buffer[j], NI_USB_POLL_READY_REQUEST); + dev_err(&usb_dev->dev, "%s: unexpected data: buffer[%i]=3D0x%x, expecte= d 0x%x\n", + __func__, j, (int)buffer[j], NI_USB_POLL_READY_REQUEST); unexpected =3D 1; } ++j; if (buffer[j] !=3D 0x1 && buffer[j] !=3D 0x0) { // [1] HS+ sends 0x0 - pr_err("%s: unexpected data: buffer[%i]=3D0x%x, expected 0x1 or 0x0\n", - __func__, j, (int)buffer[j]); + dev_err(&usb_dev->dev, "%s: unexpected data: buffer[%i]=3D0x%x, expecte= d 0x1 or 0x0\n", + __func__, j, (int)buffer[j]); unexpected =3D 1; } if (buffer[++j] !=3D 0x0) { // [2] - pr_err("%s: unexpected data: buffer[%i]=3D0x%x, expected 0x%x\n", - __func__, j, (int)buffer[j], 0x0); + dev_err(&usb_dev->dev, "%s: unexpected data: buffer[%i]=3D0x%x, expecte= d 0x%x\n", + __func__, j, (int)buffer[j], 0x0); unexpected =3D 1; } ++j; @@ -2000,22 +2029,22 @@ static int ni_usb_hs_wait_for_ready(struct ni_usb_p= riv *ni_priv) // NI-USB-HS+ sends 0x0 if (buffer[j] !=3D 0x1 && buffer[j] !=3D 0x8 && buffer[j] !=3D 0x7 && bu= ffer[j] !=3D 0x0) { // [3] - pr_err("%s: unexpected data: buffer[%i]=3D0x%x, expected 0x0, 0x1, 0x7 = or 0x8\n", - __func__, j, (int)buffer[j]); + dev_err(&usb_dev->dev, "%s: unexpected data: buffer[%i]=3D0x%x, expecte= d 0x0, 0x1, 0x7 or 0x8\n", + __func__, j, (int)buffer[j]); unexpected =3D 1; } ++j; // NI-USB-HS+ sends 0 here if (buffer[j] !=3D 0x30 && buffer[j] !=3D 0x0) { // [4] - pr_err("%s: unexpected data: buffer[%i]=3D0x%x, expected 0x0 or 0x30\n", - __func__, j, (int)buffer[j]); + dev_err(&usb_dev->dev, "%s: unexpected data: buffer[%i]=3D0x%x, expecte= d 0x0 or 0x30\n", + __func__, j, (int)buffer[j]); unexpected =3D 1; } ++j; // MC usb-488 (and sometimes NI-USB-HS?) and NI-USB-HS+ sends 0x0 here if (buffer[j] !=3D 0x1 && buffer[j] !=3D 0x0) { // [5] - pr_err("%s: unexpected data: buffer[%i]=3D0x%x, expected 0x1 or 0x0\n", - __func__, j, (int)buffer[j]); + dev_err(&usb_dev->dev, "%s: unexpected data: buffer[%i]=3D0x%x, expecte= d 0x1 or 0x0\n", + __func__, j, (int)buffer[j]); unexpected =3D 1; } if (buffer[++j] !=3D 0x0) { // [6] @@ -2023,8 +2052,8 @@ static int ni_usb_hs_wait_for_ready(struct ni_usb_pri= v *ni_priv) // NI-USB-HS+ sends 0xf here if (buffer[j] !=3D 0x2 && buffer[j] !=3D 0xe && buffer[j] !=3D 0xf && buffer[j] !=3D 0x16) { - pr_err("%s: unexpected data: buffer[%i]=3D0x%x, expected 0x2, 0xe, 0xf= or 0x16\n", - __func__, j, (int)buffer[j]); + dev_err(&usb_dev->dev, "%s: unexpected data: buffer[%i]=3D0x%x, expect= ed 0x2, 0xe, 0xf or 0x16\n", + __func__, j, (int)buffer[j]); unexpected =3D 1; } } @@ -2033,30 +2062,30 @@ static int ni_usb_hs_wait_for_ready(struct ni_usb_p= riv *ni_priv) // MC usb-488 sends 0x5 here; MC usb-488A sends 0x6 here if (buffer[j] !=3D 0x3 && buffer[j] !=3D 0x5 && buffer[j] !=3D 0x6 && buffer[j] !=3D 0x8) { - pr_err("%s: unexpected data: buffer[%i]=3D0x%x, expected 0x3 or 0x5, 0= x6 or 0x08\n", - __func__, j, (int)buffer[j]); + dev_err(&usb_dev->dev, "%s: unexpected data: buffer[%i]=3D0x%x, expect= ed 0x3 or 0x5, 0x6 or 0x08\n", + __func__, j, (int)buffer[j]); unexpected =3D 1; } } ++j; if (buffer[j] !=3D 0x0 && buffer[j] !=3D 0x2) { // [8] MC usb-488 sends = 0x2 here - pr_err("%s: unexpected data: buffer[%i]=3D0x%x, expected 0x0 or 0x2\n", - __func__, j, (int)buffer[j]); + dev_err(&usb_dev->dev, "%s: unexpected data: buffer[%i]=3D0x%x, expecte= d 0x0 or 0x2\n", + __func__, j, (int)buffer[j]); unexpected =3D 1; } ++j; // MC usb-488A and NI-USB-HS sends 0x3 here; NI-USB-HS+ sends 0x30 here if (buffer[j] !=3D 0x0 && buffer[j] !=3D 0x3 && buffer[j] !=3D 0x30) { /= / [9] - pr_err("%s: unexpected data: buffer[%i]=3D0x%x, expected 0x0, 0x3 or 0x= 30\n", - __func__, j, (int)buffer[j]); + dev_err(&usb_dev->dev, "%s: unexpected data: buffer[%i]=3D0x%x, expecte= d 0x0, 0x3 or 0x30\n", + __func__, j, (int)buffer[j]); unexpected =3D 1; } if (buffer[++j] !=3D 0x0) { ready =3D 1; if (buffer[j] !=3D 0x96 && buffer[j] !=3D 0x7 && buffer[j] !=3D 0x6e) { // [10] MC usb-488 sends 0x7 here - pr_err("%s: unexpected data: buffer[%i]=3D0x%x, expected 0x96, 0x07 or= 0x6e\n", - __func__, j, (int)buffer[j]); + dev_err(&usb_dev->dev, "%s: unexpected data: buffer[%i]=3D0x%x, expect= ed 0x96, 0x07 or 0x6e\n", + __func__, j, (int)buffer[j]); unexpected =3D 1; } } @@ -2066,7 +2095,7 @@ static int ni_usb_hs_wait_for_ready(struct ni_usb_pri= v *ni_priv) break; retval =3D msleep_interruptible(msec_sleep_duration); if (retval) { - pr_err("ni_usb_gpib: msleep interrupted\n"); + dev_err(&usb_dev->dev, "ni_usb_gpib: msleep interrupted\n"); retval =3D -ERESTARTSYS; goto ready_out; } @@ -2075,7 +2104,7 @@ static int ni_usb_hs_wait_for_ready(struct ni_usb_pri= v *ni_priv) =20 ready_out: kfree(buffer); - GPIB_DPRINTK("%s: %s exit retval=3D%d\n", __func__, retval); + dev_dbg(&usb_dev->dev, "%s: exit retval=3D%d\n", __func__, retval); return retval; } =20 @@ -2087,6 +2116,7 @@ static int ni_usb_hs_wait_for_ready(struct ni_usb_pri= v *ni_priv) */ static int ni_usb_hs_plus_extra_init(struct ni_usb_priv *ni_priv) { + struct usb_device *usb_dev =3D interface_to_usbdev(ni_priv->bus_interface= ); int retval; u8 *buffer; static const int buffer_size =3D 16; @@ -2102,14 +2132,14 @@ static int ni_usb_hs_plus_extra_init(struct ni_usb_= priv *ni_priv) USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE, 0x0, 0x0, buffer, transfer_size, 1000); if (retval < 0) { - pr_err("%s: usb_control_msg request 0x%x returned %i\n", - __FILE__, NI_USB_HS_PLUS_0x48_REQUEST, retval); + dev_err(&usb_dev->dev, "%s: usb_control_msg request 0x%x returned %i\n", + __func__, NI_USB_HS_PLUS_0x48_REQUEST, retval); break; } // expected response data: 48 f3 30 00 00 00 00 00 00 00 00 00 00 00 00 = 00 if (buffer[0] !=3D NI_USB_HS_PLUS_0x48_REQUEST) - pr_err("%s: unexpected data: buffer[0]=3D0x%x, expected 0x%x\n", - __func__, (int)buffer[0], NI_USB_HS_PLUS_0x48_REQUEST); + dev_err(&usb_dev->dev, "%s: unexpected data: buffer[0]=3D0x%x, expected= 0x%x\n", + __func__, (int)buffer[0], NI_USB_HS_PLUS_0x48_REQUEST); =20 transfer_size =3D 2; =20 @@ -2117,14 +2147,14 @@ static int ni_usb_hs_plus_extra_init(struct ni_usb_= priv *ni_priv) USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE, 0x1, 0x0, buffer, transfer_size, 1000); if (retval < 0) { - pr_err("%s: usb_control_msg request 0x%x returned %i\n", - __FILE__, NI_USB_HS_PLUS_LED_REQUEST, retval); + dev_err(&usb_dev->dev, "%s: usb_control_msg request 0x%x returned %i\n", + __func__, NI_USB_HS_PLUS_LED_REQUEST, retval); break; } // expected response data: 4b 00 if (buffer[0] !=3D NI_USB_HS_PLUS_LED_REQUEST) - pr_err("%s: unexpected data: buffer[0]=3D0x%x, expected 0x%x\n", - __func__, (int)buffer[0], NI_USB_HS_PLUS_LED_REQUEST); + dev_err(&usb_dev->dev, "%s: unexpected data: buffer[0]=3D0x%x, expected= 0x%x\n", + __func__, (int)buffer[0], NI_USB_HS_PLUS_LED_REQUEST); =20 transfer_size =3D 9; =20 @@ -2133,14 +2163,14 @@ static int ni_usb_hs_plus_extra_init(struct ni_usb_= priv *ni_priv) USB_RECIP_INTERFACE, 0x0, 0x1, buffer, transfer_size, 1000); if (retval < 0) { - pr_err("%s: usb_control_msg request 0x%x returned %i\n", - __func__, NI_USB_HS_PLUS_0xf8_REQUEST, retval); + dev_err(&usb_dev->dev, "%s: usb_control_msg request 0x%x returned %i\n", + __func__, NI_USB_HS_PLUS_0xf8_REQUEST, retval); break; } // expected response data: f8 01 00 00 00 01 00 00 00 if (buffer[0] !=3D NI_USB_HS_PLUS_0xf8_REQUEST) - pr_err("%s: unexpected data: buffer[0]=3D0x%x, expected 0x%x\n", - __func__, (int)buffer[0], NI_USB_HS_PLUS_0xf8_REQUEST); + dev_err(&usb_dev->dev, "%s: unexpected data: buffer[0]=3D0x%x, expected= 0x%x\n", + __func__, (int)buffer[0], NI_USB_HS_PLUS_0xf8_REQUEST); =20 } while (0); =20 @@ -2191,9 +2221,9 @@ static int ni_usb_attach(gpib_board_t *board, const g= pib_board_config_t *config) return -ENODEV; } if (usb_reset_configuration(interface_to_usbdev(ni_priv->bus_interface))) - pr_err("ni_usb_gpib: usb_reset_configuration() failed.\n"); + dev_err(&usb_dev->dev, "ni_usb_gpib: usb_reset_configuration() failed.\n= "); =20 - product_id =3D le16_to_cpu(interface_to_usbdev(ni_priv->bus_interface)->d= escriptor.idProduct); + product_id =3D le16_to_cpu(usb_dev->descriptor.idProduct); ni_priv->product_id =3D product_id; =20 timer_setup(&ni_priv->bulk_timer, ni_usb_timeout_handler, 0); @@ -2234,7 +2264,8 @@ static int ni_usb_attach(gpib_board_t *board, const g= pib_board_config_t *config) break; default: mutex_unlock(&ni_usb_hotplug_lock); - pr_err("\tDriver bug: unknown endpoints for usb device id\n"); + dev_err(&usb_dev->dev, "\tDriver bug: unknown endpoints for usb device i= d %x\n", + product_id); return -EINVAL; } =20 @@ -2263,12 +2294,13 @@ static int ni_usb_attach(gpib_board_t *board, const= gpib_board_config_t *config) } =20 mutex_unlock(&ni_usb_hotplug_lock); - pr_info("%s: attached\n", __func__); + dev_info(&usb_dev->dev, "%s: attached\n", __func__); return retval; } =20 static int ni_usb_shutdown_hardware(struct ni_usb_priv *ni_priv) { + struct usb_device *usb_dev =3D interface_to_usbdev(ni_priv->bus_interface= ); int retval; int i =3D 0; struct ni_usb_register writes[2]; @@ -2285,12 +2317,12 @@ static int ni_usb_shutdown_hardware(struct ni_usb_p= riv *ni_priv) writes[i].value =3D 0x0; i++; if (i > writes_length) { - pr_err("%s: bug!, buffer overrun, i=3D%i\n", __func__, i); + dev_err(&usb_dev->dev, "%s: bug!, buffer overrun, i=3D%i\n", __func__, i= ); return -EINVAL; } retval =3D ni_usb_write_registers(ni_priv, writes, i, &ibsta); if (retval) { - pr_err("%s: register write failed, retval=3D%i\n", __func__, retval); + dev_err(&usb_dev->dev, "%s: register write failed, retval=3D%i\n", __fun= c__, retval); return retval; } return 0; @@ -2362,35 +2394,34 @@ MODULE_DEVICE_TABLE(usb, ni_usb_driver_device_table= ); =20 static int ni_usb_driver_probe(struct usb_interface *interface, const stru= ct usb_device_id *id) { + struct usb_device *usb_dev =3D interface_to_usbdev(interface); int i; char *path; static const int path_length =3D 1024; =20 -// printk("ni_usb_driver_probe\n"); mutex_lock(&ni_usb_hotplug_lock); - usb_get_dev(interface_to_usbdev(interface)); + usb_get_dev(usb_dev); for (i =3D 0; i < MAX_NUM_NI_USB_INTERFACES; i++) { if (!ni_usb_driver_interfaces[i]) { ni_usb_driver_interfaces[i] =3D interface; usb_set_intfdata(interface, NULL); -// printk("set bus interface %i to address 0x%p\n", i, interface); break; } } if (i =3D=3D MAX_NUM_NI_USB_INTERFACES) { - usb_put_dev(interface_to_usbdev(interface)); + usb_put_dev(usb_dev); mutex_unlock(&ni_usb_hotplug_lock); - pr_err("ni_usb_gpib: out of space in ni_usb_driver_interfaces[]\n"); + dev_err(&usb_dev->dev, "%s: ni_usb_driver_interfaces[] full\n", __func__= ); return -1; } path =3D kmalloc(path_length, GFP_KERNEL); if (!path) { - usb_put_dev(interface_to_usbdev(interface)); + usb_put_dev(usb_dev); mutex_unlock(&ni_usb_hotplug_lock); return -ENOMEM; } - usb_make_path(interface_to_usbdev(interface), path, path_length); - pr_info("ni_usb_gpib: probe succeeded for path: %s\n", path); + usb_make_path(usb_dev, path, path_length); + dev_info(&usb_dev->dev, "ni_usb_gpib: probe succeeded for path: %s\n", pa= th); kfree(path); mutex_unlock(&ni_usb_hotplug_lock); return 0; @@ -2398,6 +2429,7 @@ static int ni_usb_driver_probe(struct usb_interface *= interface, const struct usb =20 static void ni_usb_driver_disconnect(struct usb_interface *interface) { + struct usb_device *usb_dev =3D interface_to_usbdev(interface); int i; =20 mutex_lock(&ni_usb_hotplug_lock); @@ -2424,14 +2456,15 @@ static void ni_usb_driver_disconnect(struct usb_int= erface *interface) } } if (i =3D=3D MAX_NUM_NI_USB_INTERFACES) - pr_err("unable to find interface in ni_usb_driver_interfaces[]? bug?\n"); - usb_put_dev(interface_to_usbdev(interface)); + dev_err(&usb_dev->dev, "%s: unable to find interface in ni_usb_driver_in= terfaces[]? bug?\n", + __func__); + usb_put_dev(usb_dev); mutex_unlock(&ni_usb_hotplug_lock); } =20 static int ni_usb_driver_suspend(struct usb_interface *interface, pm_messa= ge_t message) { - struct usb_device *usb_dev; + struct usb_device *usb_dev =3D interface_to_usbdev(interface); gpib_board_t *board; int i, retval; =20 @@ -2463,7 +2496,6 @@ static int ni_usb_driver_suspend(struct usb_interface= *interface, pm_message_t m ni_usb_cleanup_urbs(ni_priv); mutex_unlock(&ni_priv->interrupt_transfer_lock); } - usb_dev =3D interface_to_usbdev(ni_priv->bus_interface); dev_info(&usb_dev->dev, "bus %d dev num %d gpib minor %d, ni usb interface %i suspended\n", usb_dev->bus->busnum, usb_dev->devnum, board->minor, i); @@ -2475,7 +2507,8 @@ static int ni_usb_driver_suspend(struct usb_interface= *interface, pm_message_t m =20 static int ni_usb_driver_resume(struct usb_interface *interface) { - struct usb_device *usb_dev; + struct usb_device *usb_dev =3D interface_to_usbdev(interface); + gpib_board_t *board; int i, retval; =20 @@ -2500,15 +2533,15 @@ static int ni_usb_driver_resume(struct usb_interfac= e *interface) mutex_lock(&ni_priv->interrupt_transfer_lock); retval =3D usb_submit_urb(ni_priv->interrupt_urb, GFP_KERNEL); if (retval) { - pr_err("%s: failed to resubmit interrupt urb, retval=3D%i\n", - __func__, retval); + dev_err(&usb_dev->dev, "%s: failed to resubmit interrupt urb, retval= =3D%i\n", + __func__, retval); mutex_unlock(&ni_priv->interrupt_transfer_lock); mutex_unlock(&ni_usb_hotplug_lock); return retval; } mutex_unlock(&ni_priv->interrupt_transfer_lock); } else { - pr_err("%s: bug! int urb not set up\n", __func__); + dev_err(&usb_dev->dev, "%s: bug! int urb not set up\n", __func__); mutex_unlock(&ni_usb_hotplug_lock); return -EINVAL; } @@ -2540,7 +2573,7 @@ static int ni_usb_driver_resume(struct usb_interface = *interface) break; default: mutex_unlock(&ni_usb_hotplug_lock); - pr_err("\tDriver bug: unknown endpoints for usb device id\n"); + dev_err(&usb_dev->dev, "\tDriver bug: unknown endpoints for usb device = id\n"); return -EINVAL; } =20 @@ -2565,7 +2598,6 @@ static int ni_usb_driver_resume(struct usb_interface = *interface) if (ni_priv->ren_state) ni_usb_remote_enable(board, 1); =20 - usb_dev =3D interface_to_usbdev(ni_priv->bus_interface); dev_info(&usb_dev->dev, "bus %d dev num %d gpib minor %d, ni usb interface %i resumed\n", usb_dev->bus->busnum, usb_dev->devnum, board->minor, i); --=20 2.46.2 From nobody Sun Nov 24 17:00:48 2024 Received: from mail-wr1-f54.google.com (mail-wr1-f54.google.com [209.85.221.54]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9BAB018C009 for ; Sun, 3 Nov 2024 21:26:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.54 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730669198; cv=none; b=PB6PfuIkVjw92rEywO/1D0EH9pqDMNLnKOik4n30i4x3dB+6HTcCcZYGVADxoOPfYolhs546KXy0Qgno67TwKLjv7CW2rt2PU0iCgaCHO9s6qqb/97HvCUhvI5QcY33hu6b/BFJ2mOc5BkMarCWajIN2ZtqbNJdX91cbJgtPJ28= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730669198; c=relaxed/simple; bh=tyF/tkkq0ode+3XoBmHOVLqZeaUsXsr5YNVhW5ykwt8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=f/e1j22qaotiwEyPed2PougKS4EJwD/TTqz+RDL9GAUD/WE/i5wtYVBUyUKEmQxaaBTtvwDRpVAhI0n/T3nWdVODcFRgveq3B9pTV1QOrLDUXYFQ1TzdB4O582ljXa4db/AtDe2fmaJtJQWxfZU5DzTRC4yOUTfOfJzq+l3LCQs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=e770Dnga; arc=none smtp.client-ip=209.85.221.54 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="e770Dnga" Received: by mail-wr1-f54.google.com with SMTP id ffacd0b85a97d-37d533b5412so2066110f8f.2 for ; Sun, 03 Nov 2024 13:26:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1730669193; x=1731273993; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=CUy0R3eXiLa29ETn6DgdOhIEEP6/w5DcQyqQiU4TqzM=; b=e770Dnga2QoMzUPeEoAiQT4KyM7n/QD9kbk1so4homlOvZzhLjmDFY5oOd/VXYzmtd NYDXMitlbT16KqRL0Aca5G2A1hokrBNZN2tTnnjTWVEaYnXZjX1eV7N7vq14c6+dywfX RlKMPyWDaWSqUhNxukUtGzHL4AQUdk4fd8f+8/uCJlS0zbnbK18LKtLSGbsoESpimigq U/Rt7H7ogG+33r9Zj/tsPJJJHnNVJWfK+epEIFqwWO/v6s1Who2ILqaCPEHR5wz3t5rW ZrvNKys1O45vRD9DGN9V/CDKlzQCrrjRBtGYElIJVvLJraXJR1H17W29EnGNVpmZKSyM Q7ow== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730669193; x=1731273993; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=CUy0R3eXiLa29ETn6DgdOhIEEP6/w5DcQyqQiU4TqzM=; b=G2AItRoUXhnzNtsc16vvQXfNMzkbLrrw+kxyUDoIBr+MoYBX62LRgKZ/MMxVlcM3ee Te3VCTwoq7HzXwsBegP3oQopyktv3iA+jA7f8Jd8/7HmmYhxVw7hICksqrZQAK0dvSVV Jy1Yt4pEh4mMNCCw+DnXHBlyTki7xJIoki9uH/jmvq/1R0iSH7ctDvRFFHOFo1h00toq wOYFtwOY7vjyF5vk0Kj+mLZxn28YBw6nT/3V6Ly5j8ey/htcbQ245qxcpuyznBH6lS+8 lg3Gys/3kHY6ZT98flEnljkHQF3ECqSe5GuJDqORTu7NEcRfOi81b/yVWa/6AEn+e9nw F/5w== X-Forwarded-Encrypted: i=1; AJvYcCV1DDBs7RjnYdOIdcTYPsPgpg30fpfRTDY4hsRt5vLcduLu3DnWrPsbw6Qa9alvyREdIavEjwEHyPr2rSs=@vger.kernel.org X-Gm-Message-State: AOJu0YzRi5rynWlgyUzmHc3HIfNVUHmbeIjLzOBlEtxwd5vxTDUgMrPY a2Kjr3+E/a4uaeojnYdaELSeSmPrH5gFffFB3KIzOTRLL7DUNgd+80OBfwpy X-Google-Smtp-Source: AGHT+IFQslb6Bn98BfmuhVKLodIuyCBIF8rVY3m+Y857egZcrLtoeViImIVsiyL1z/BgJQiGoIiuQw== X-Received: by 2002:a5d:55c4:0:b0:37d:47fe:7c59 with SMTP id ffacd0b85a97d-3806100cecemr21934406f8f.0.1730669192668; Sun, 03 Nov 2024 13:26:32 -0800 (PST) Received: from localhost.localdomain (82-64-73-52.subs.proxad.net. [82.64.73.52]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-431bd910718sm166150385e9.12.2024.11.03.13.26.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 03 Nov 2024 13:26:31 -0800 (PST) From: Dave Penkler To: gregkh@linuxfoundation.org, linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org Cc: skhan@linuxfoundation.org, arnd@arndb.de, dan.carpenter@linaro.org, Dave Penkler Subject: [PATCH 04/11] staging: gpib: Update messaging and usb_device refs in agilent_usb Date: Sun, 3 Nov 2024 22:26:10 +0100 Message-ID: <20241103212617.13076-5-dpenkler@gmail.com> X-Mailer: git-send-email 2.46.2 In-Reply-To: <20241103212617.13076-1-dpenkler@gmail.com> References: <20241103212617.13076-1-dpenkler@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Replace GPIB_DPRINTK with dev_dbg Replace pr_xxx with dev_xxx wherever possible Use previously initialized usb_device pointer for usb_put_dev() Signed-off-by: Dave Penkler --- .../gpib/agilent_82357a/agilent_82357a.c | 266 ++++++++++-------- 1 file changed, 156 insertions(+), 110 deletions(-) diff --git a/drivers/staging/gpib/agilent_82357a/agilent_82357a.c b/drivers= /staging/gpib/agilent_82357a/agilent_82357a.c index 748aadc5cebc..68b40831b9ad 100644 --- a/drivers/staging/gpib/agilent_82357a/agilent_82357a.c +++ b/drivers/staging/gpib/agilent_82357a/agilent_82357a.c @@ -15,11 +15,11 @@ #include "tms9914.h" =20 MODULE_LICENSE("GPL"); -MODULE_DESCRIPTION("GPIB driver for Agilent 82357A/B usb adapter"); +MODULE_DESCRIPTION("GPIB driver for Agilent 82357A/B usb adapters"); =20 #define MAX_NUM_82357A_INTERFACES 128 static struct usb_interface *agilent_82357a_driver_interfaces[MAX_NUM_8235= 7A_INTERFACES]; -DEFINE_MUTEX(agilent_82357a_hotplug_lock); +DEFINE_MUTEX(agilent_82357a_hotplug_lock); // protect board insertion and = removal =20 static unsigned int agilent_82357a_update_status(gpib_board_t *board, unsi= gned int clear_mask); =20 @@ -29,9 +29,6 @@ static void agilent_82357a_bulk_complete(struct urb *urb) { struct agilent_82357a_urb_ctx *context =3D urb->context; =20 -// printk("debug: %s: status=3D0x%x, error_count=3D%i, actual_length=3D%i\= n", __func__, -// urb->status, urb->error_count, urb->actual_length); - up(&context->complete); } =20 @@ -80,16 +77,17 @@ static int agilent_82357a_send_bulk_msg(struct agilent_= 82357a_priv *a_priv, void if (timeout_msecs) mod_timer(&a_priv->bulk_timer, jiffies + msecs_to_jiffies(timeout_msecs)= ); =20 - //printk("%s: submitting urb\n", __func__); + //dev_dbg(&usb_dev->dev, "%s: submitting urb\n", __func__); retval =3D usb_submit_urb(a_priv->bulk_urb, GFP_KERNEL); if (retval) { - pr_err("%s: failed to submit bulk out urb, retval=3D%i\n", __func__, ret= val); + dev_err(&usb_dev->dev, "%s: failed to submit bulk out urb, retval=3D%i\n= ", + __func__, retval); mutex_unlock(&a_priv->bulk_alloc_lock); goto cleanup; } mutex_unlock(&a_priv->bulk_alloc_lock); if (down_interruptible(&context->complete)) { - pr_err("%s: interrupted\n", __func__); + dev_err(&usb_dev->dev, "%s: interrupted\n", __func__); retval =3D -ERESTARTSYS; goto cleanup; } @@ -150,16 +148,17 @@ static int agilent_82357a_receive_bulk_msg(struct agi= lent_82357a_priv *a_priv, v if (timeout_msecs) mod_timer(&a_priv->bulk_timer, jiffies + msecs_to_jiffies(timeout_msecs)= ); =20 - //printk("%s: submitting urb\n", __func__); + //dev_dbg(&usb_dev->dev, "%s: submitting urb\n", __func__); retval =3D usb_submit_urb(a_priv->bulk_urb, GFP_KERNEL); if (retval) { - pr_err("%s: failed to submit bulk out urb, retval=3D%i\n", __func__, ret= val); + dev_err(&usb_dev->dev, "%s: failed to submit bulk out urb, retval=3D%i\n= ", + __func__, retval); mutex_unlock(&a_priv->bulk_alloc_lock); goto cleanup; } mutex_unlock(&a_priv->bulk_alloc_lock); if (down_interruptible(&context->complete)) { - pr_err("%s: interrupted\n", __func__); + dev_err(&usb_dev->dev, "%s: interrupted\n", __func__); retval =3D -ERESTARTSYS; goto cleanup; } @@ -216,6 +215,7 @@ static int agilent_82357a_write_registers(struct agilen= t_82357a_priv *a_priv, const struct agilent_82357a_register_pairlet *writes, int num_writes) { + struct usb_device *usb_dev =3D interface_to_usbdev(a_priv->bus_interface); int retval; u8 *out_data, *in_data; int out_data_length, in_data_length; @@ -227,13 +227,13 @@ static int agilent_82357a_write_registers(struct agil= ent_82357a_priv *a_priv, static const int max_writes =3D 31; =20 if (num_writes > max_writes) { - pr_err("%s: bug! num_writes=3D%i too large\n", __func__, num_writes); + dev_err(&usb_dev->dev, "%s: bug! num_writes=3D%i too large\n", __func__,= num_writes); return -EIO; } out_data_length =3D num_writes * bytes_per_write + header_length; out_data =3D kmalloc(out_data_length, GFP_KERNEL); if (!out_data) { - pr_err("%s: kmalloc failed\n", __func__); + dev_err(&usb_dev->dev, "%s: kmalloc failed\n", __func__); return -ENOMEM; } out_data[i++] =3D DATA_PIPE_CMD_WR_REGS; @@ -243,7 +243,7 @@ static int agilent_82357a_write_registers(struct agilen= t_82357a_priv *a_priv, out_data[i++] =3D writes[j].value; } if (i > out_data_length) - pr_err("%s: bug! buffer overrun\n", __func__); + dev_err(&usb_dev->dev, "%s: bug! buffer overrun\n", __func__); retval =3D mutex_lock_interruptible(&a_priv->bulk_transfer_lock); if (retval) { kfree(out_data); @@ -252,15 +252,15 @@ static int agilent_82357a_write_registers(struct agil= ent_82357a_priv *a_priv, retval =3D agilent_82357a_send_bulk_msg(a_priv, out_data, i, &bytes_writt= en, 1000); kfree(out_data); if (retval) { - pr_err("%s: agilent_82357a_send_bulk_msg returned %i, bytes_written=3D%i= , i=3D%i\n", - __func__, retval, bytes_written, i); + dev_err(&usb_dev->dev, "%s: agilent_82357a_send_bulk_msg returned %i, by= tes_written=3D%i, i=3D%i\n", + __func__, retval, bytes_written, i); mutex_unlock(&a_priv->bulk_transfer_lock); return retval; } in_data_length =3D 0x20; in_data =3D kmalloc(in_data_length, GFP_KERNEL); if (!in_data) { - pr_err("%s: kmalloc failed\n", __func__); + dev_err(&usb_dev->dev, "%s: kmalloc failed\n", __func__); mutex_unlock(&a_priv->bulk_transfer_lock); return -ENOMEM; } @@ -269,20 +269,20 @@ static int agilent_82357a_write_registers(struct agil= ent_82357a_priv *a_priv, mutex_unlock(&a_priv->bulk_transfer_lock); =20 if (retval) { - pr_err("%s: agilent_82357a_receive_bulk_msg returned %i, bytes_read=3D%i= \n", - __func__, retval, bytes_read); + dev_err(&usb_dev->dev, "%s: agilent_82357a_receive_bulk_msg returned %i,= bytes_read=3D%i\n", + __func__, retval, bytes_read); agilent_82357a_dump_raw_block(in_data, bytes_read); kfree(in_data); return -EIO; } if (in_data[0] !=3D (0xff & ~DATA_PIPE_CMD_WR_REGS)) { - pr_err("%s: error, bulk command=3D0x%x !=3D ~DATA_PIPE_CMD_WR_REGS\n", - __func__, in_data[0]); + dev_err(&usb_dev->dev, "%s: error, bulk command=3D0x%x !=3D ~DATA_PIPE_C= MD_WR_REGS\n", + __func__, in_data[0]); return -EIO; } if (in_data[1]) { - pr_err("%s: nonzero error code 0x%x in DATA_PIPE_CMD_WR_REGS response\n", - __func__, in_data[1]); + dev_err(&usb_dev->dev, "%s: nonzero error code 0x%x in DATA_PIPE_CMD_WR_= REGS response\n", + __func__, in_data[1]); return -EIO; } kfree(in_data); @@ -293,6 +293,7 @@ static int agilent_82357a_read_registers(struct agilent= _82357a_priv *a_priv, struct agilent_82357a_register_pairlet *reads, int num_reads, int blocking) { + struct usb_device *usb_dev =3D interface_to_usbdev(a_priv->bus_interface); int retval; u8 *out_data, *in_data; int out_data_length, in_data_length; @@ -303,12 +304,12 @@ static int agilent_82357a_read_registers(struct agile= nt_82357a_priv *a_priv, static const int max_reads =3D 62; =20 if (num_reads > max_reads) - pr_err("%s: bug! num_reads=3D%i too large\n", __func__, num_reads); + dev_err(&usb_dev->dev, "%s: bug! num_reads=3D%i too large\n", __func__, = num_reads); =20 out_data_length =3D num_reads + header_length; out_data =3D kmalloc(out_data_length, GFP_KERNEL); if (!out_data) { - pr_err("%s: kmalloc failed\n", __func__); + dev_err(&usb_dev->dev, "%s: kmalloc failed\n", __func__); return -ENOMEM; } out_data[i++] =3D DATA_PIPE_CMD_RD_REGS; @@ -316,7 +317,7 @@ static int agilent_82357a_read_registers(struct agilent= _82357a_priv *a_priv, for (j =3D 0; j < num_reads; j++) out_data[i++] =3D reads[j].address; if (i > out_data_length) - pr_err("%s: bug! buffer overrun\n", __func__); + dev_err(&usb_dev->dev, "%s: bug! buffer overrun\n", __func__); if (blocking) { retval =3D mutex_lock_interruptible(&a_priv->bulk_transfer_lock); if (retval) { @@ -333,15 +334,15 @@ static int agilent_82357a_read_registers(struct agile= nt_82357a_priv *a_priv, retval =3D agilent_82357a_send_bulk_msg(a_priv, out_data, i, &bytes_writt= en, 1000); kfree(out_data); if (retval) { - pr_err("%s: agilent_82357a_send_bulk_msg returned %i, bytes_written=3D%i= , i=3D%i\n", - __func__, retval, bytes_written, i); + dev_err(&usb_dev->dev, "%s: agilent_82357a_send_bulk_msg returned %i, by= tes_written=3D%i, i=3D%i\n", + __func__, retval, bytes_written, i); mutex_unlock(&a_priv->bulk_transfer_lock); return retval; } in_data_length =3D 0x20; in_data =3D kmalloc(in_data_length, GFP_KERNEL); if (!in_data) { - pr_err("%s: kmalloc failed\n", __func__); + dev_err(&usb_dev->dev, "%s: kmalloc failed\n", __func__); mutex_unlock(&a_priv->bulk_transfer_lock); return -ENOMEM; } @@ -350,21 +351,21 @@ static int agilent_82357a_read_registers(struct agile= nt_82357a_priv *a_priv, mutex_unlock(&a_priv->bulk_transfer_lock); =20 if (retval) { - pr_err("%s: agilent_82357a_receive_bulk_msg returned %i, bytes_read=3D%i= \n", - __func__, retval, bytes_read); + dev_err(&usb_dev->dev, "%s: agilent_82357a_receive_bulk_msg returned %i,= bytes_read=3D%i\n", + __func__, retval, bytes_read); agilent_82357a_dump_raw_block(in_data, bytes_read); kfree(in_data); return -EIO; } i =3D 0; if (in_data[i++] !=3D (0xff & ~DATA_PIPE_CMD_RD_REGS)) { - pr_err("%s: error, bulk command=3D0x%x !=3D ~DATA_PIPE_CMD_RD_REGS\n", - __func__, in_data[0]); + dev_err(&usb_dev->dev, "%s: error, bulk command=3D0x%x !=3D ~DATA_PIPE_C= MD_RD_REGS\n", + __func__, in_data[0]); return -EIO; } if (in_data[i++]) { - pr_err("%s: nonzero error code 0x%x in DATA_PIPE_CMD_RD_REGS response\n", - __func__, in_data[1]); + dev_err(&usb_dev->dev, "%s: nonzero error code 0x%x in DATA_PIPE_CMD_RD_= REGS response\n", + __func__, in_data[1]); return -EIO; } for (j =3D 0; j < num_reads; j++) @@ -375,6 +376,7 @@ static int agilent_82357a_read_registers(struct agilent= _82357a_priv *a_priv, =20 static int agilent_82357a_abort(struct agilent_82357a_priv *a_priv, int fl= ush) { + struct usb_device *usb_dev =3D interface_to_usbdev(a_priv->bus_interface); int retval =3D 0; int receive_control_retval; u16 wIndex =3D 0; @@ -394,13 +396,14 @@ static int agilent_82357a_abort(struct agilent_82357a= _priv *a_priv, int flush) wIndex, status_data, status_data_len, 100); if (receive_control_retval < 0) { - pr_err("%s: agilent_82357a_receive_control_msg() returned %i\n", - __func__, receive_control_retval); + dev_err(&usb_dev->dev, "%s: agilent_82357a_receive_control_msg() returne= d %i\n", + __func__, receive_control_retval); retval =3D -EIO; goto cleanup; } if (status_data[0] !=3D (~XFER_ABORT & 0xff)) { - pr_err("%s: error, major code=3D0x%x !=3D ~XFER_ABORT\n", __func__, stat= us_data[0]); + dev_err(&usb_dev->dev, "%s: error, major code=3D0x%x !=3D ~XFER_ABORT\n", + __func__, status_data[0]); retval =3D -EIO; goto cleanup; } @@ -416,7 +419,8 @@ static int agilent_82357a_abort(struct agilent_82357a_p= riv *a_priv, int flush) fallthrough; case UGP_ERR_FLUSHING_ALREADY: default: - pr_err("%s: abort returned error code=3D0x%x\n", __func__, status_data[1= ]); + dev_err(&usb_dev->dev, "%s: abort returned error code=3D0x%x\n", + __func__, status_data[1]); retval =3D -EIO; break; } @@ -435,6 +439,7 @@ static int agilent_82357a_read(gpib_board_t *board, uin= t8_t *buffer, size_t leng { int retval; struct agilent_82357a_priv *a_priv =3D board->private_data; + struct usb_device *usb_dev =3D interface_to_usbdev(a_priv->bus_interface); u8 *out_data, *in_data; int out_data_length, in_data_length; int bytes_written, bytes_read; @@ -470,8 +475,8 @@ static int agilent_82357a_read(gpib_board_t *board, uin= t8_t *buffer, size_t leng retval =3D agilent_82357a_send_bulk_msg(a_priv, out_data, i, &bytes_writt= en, msec_timeout); kfree(out_data); if (retval || bytes_written !=3D i) { - pr_err("%s: agilent_82357a_send_bulk_msg returned %i, bytes_written=3D%i= , i=3D%i\n", - __func__, retval, bytes_written, i); + dev_err(&usb_dev->dev, "%s: agilent_82357a_send_bulk_msg returned %i, by= tes_written=3D%i, i=3D%i\n", + __func__, retval, bytes_written, i); mutex_unlock(&a_priv->bulk_transfer_lock); if (retval < 0) return retval; @@ -500,18 +505,18 @@ static int agilent_82357a_read(gpib_board_t *board, u= int8_t *buffer, size_t leng extra_bytes_retval =3D agilent_82357a_receive_bulk_msg(a_priv, in_data += bytes_read, in_data_length - bytes_read, &extra_bytes_read, 100); - //printk("%s: agilent_82357a_receive_bulk_msg timed out, bytes_read=3D%i, - // extra_bytes_read=3D%i\n", - // __func__, bytes_read, extra_bytes_read); + //dev_err(&usb_dev->dev, "%s: agilent_82357a_receive_bulk_msg timed out, + // bytes_read=3D%i, extra_bytes_read=3D%i\n", + // __func__, bytes_read, extra_bytes_read); bytes_read +=3D extra_bytes_read; if (extra_bytes_retval) { - pr_err("%s: extra_bytes_retval=3D%i, bytes_read=3D%i\n", __func__, - extra_bytes_retval, bytes_read); + dev_err(&usb_dev->dev, "%s: extra_bytes_retval=3D%i, bytes_read=3D%i\n", + __func__, extra_bytes_retval, bytes_read); agilent_82357a_abort(a_priv, 0); } } else if (retval) { - pr_err("%s: agilent_82357a_receive_bulk_msg returned %i, bytes_read=3D%i= \n", - __func__, retval, bytes_read); + dev_err(&usb_dev->dev, "%s: agilent_82357a_receive_bulk_msg returned %i,= bytes_read=3D%i\n", + __func__, retval, bytes_read); agilent_82357a_abort(a_priv, 0); } mutex_unlock(&a_priv->bulk_transfer_lock); @@ -519,7 +524,7 @@ static int agilent_82357a_read(gpib_board_t *board, uin= t8_t *buffer, size_t leng bytes_read =3D length + 1; pr_warn("%s: bytes_read > length? truncating", __func__); } - //printk("%s: received response:\n", __func__); + //dev_dbg(&usb_dev->dev, "%s: received response:\n", __func__); // agilent_82357a_dump_raw_block(in_data, bytes_read); if (bytes_read >=3D 1) { memcpy(buffer, in_data, bytes_read - 1); @@ -545,6 +550,7 @@ static ssize_t agilent_82357a_generic_write(gpib_board_= t *board, uint8_t *buffer { int retval; struct agilent_82357a_priv *a_priv =3D board->private_data; + struct usb_device *usb_dev =3D interface_to_usbdev(a_priv->bus_interface); u8 *out_data =3D NULL; u8 *status_data =3D NULL; int out_data_length; @@ -574,7 +580,8 @@ static ssize_t agilent_82357a_generic_write(gpib_board_= t *board, uint8_t *buffer out_data[i++] =3D (length >> 24) & 0xff; for (j =3D 0; j < length; j++) out_data[i++] =3D buffer[j]; - //printk("%s: sending bulk msg(), send_commands=3D%i\n", __func__, send_c= ommands); + //dev_dbg(&usb_dev->dev, "%s: sending bulk msg(), send_commands=3D%i\n", + //__func__, send_commands); =20 clear_bit(AIF_WRITE_COMPLETE_BN, &a_priv->interrupt_flags); =20 @@ -589,28 +596,28 @@ static ssize_t agilent_82357a_generic_write(gpib_boar= d_t *board, uint8_t *buffer kfree(out_data); if (retval || raw_bytes_written !=3D i) { agilent_82357a_abort(a_priv, 0); - pr_err("%s: agilent_82357a_send_bulk_msg returned %i, raw_bytes_written= =3D%i, i=3D%i\n", - __func__, retval, raw_bytes_written, i); + dev_err(&usb_dev->dev, "%s: agilent_82357a_send_bulk_msg returned %i, ra= w_bytes_written=3D%i, i=3D%i\n", + __func__, retval, raw_bytes_written, i); mutex_unlock(&a_priv->bulk_transfer_lock); if (retval < 0) return retval; return -EIO; } - //printk("%s: waiting for write complete\n", __func__); + //dev_dbg(&usb_dev->dev, "%s: waiting for write complete\n", __func__); retval =3D wait_event_interruptible(board->wait, test_bit(AIF_WRITE_COMPLETE_BN, &a_priv->interrupt_flags) || test_bit(TIMO_NUM, &board->status)); if (retval) { - pr_err("%s: wait write complete interrupted\n", __func__); + dev_err(&usb_dev->dev, "%s: wait write complete interrupted\n", __func__= ); agilent_82357a_abort(a_priv, 0); mutex_unlock(&a_priv->bulk_transfer_lock); return -ERESTARTSYS; } =20 if (test_bit(AIF_WRITE_COMPLETE_BN, &a_priv->interrupt_flags) =3D=3D 0) { - GPIB_DPRINTK("%s: write timed out ibs %i, tmo %i\n", __func__, - test_bit(TIMO_NUM, &board->status), msec_timeout); + dev_dbg(&usb_dev->dev, "write timed out ibs %i, tmo %i\n", + test_bit(TIMO_NUM, &board->status), msec_timeout); =20 agilent_82357a_abort(a_priv, 0); =20 @@ -619,16 +626,17 @@ static ssize_t agilent_82357a_generic_write(gpib_boar= d_t *board, uint8_t *buffer read_reg.address =3D BSR; retval =3D agilent_82357a_read_registers(a_priv, &read_reg, 1, 1); if (retval) { - pr_err("%s: agilent_82357a_read_registers() returned error\n", __func__= ); + dev_err(&usb_dev->dev, "%s: agilent_82357a_read_registers() returned er= ror\n", + __func__); return -ETIMEDOUT; } =20 bsr =3D read_reg.value; - GPIB_DPRINTK("%s: write aborted bsr 0x%hx\n", __func__, bsr); + dev_dbg(&usb_dev->dev, "write aborted bsr 0x%x\n", bsr); =20 if (send_commands) {/* check for no listeners */ if ((bsr & BSR_ATN_BIT) && !(bsr & (BSR_NDAC_BIT | BSR_NRFD_BIT))) { - GPIB_DPRINTK("%s: No listener on command\n", __func__); + dev_dbg(&usb_dev->dev, "No listener on command\n"); clear_bit(TIMO_NUM, &board->status); return -ENOTCONN; // no listener on bus } @@ -636,13 +644,13 @@ static ssize_t agilent_82357a_generic_write(gpib_boar= d_t *board, uint8_t *buffer read_reg.address =3D ADSR; retval =3D agilent_82357a_read_registers(a_priv, &read_reg, 1, 1); if (retval) { - pr_err("%s: agilent_82357a_read_registers() returned error\n", - __func__); + dev_err(&usb_dev->dev, "%s: agilent_82357a_read_registers() returned e= rror\n", + __func__); return -ETIMEDOUT; } adsr =3D read_reg.value; if ((adsr & HR_TA) && !(bsr & (BSR_NDAC_BIT | BSR_NRFD_BIT))) { - GPIB_DPRINTK("%s: No listener on write\n", __func__); + dev_dbg(&usb_dev->dev, "No listener on write\n"); clear_bit(TIMO_NUM, &board->status); return -ECOMM; } @@ -657,14 +665,15 @@ static ssize_t agilent_82357a_generic_write(gpib_boar= d_t *board, uint8_t *buffer return -ENOMEM; } =20 - // printk("%s: receiving control msg\n", __func__); + // dev_dbg(&usb_dev->dev, "%s: receiving control msg\n", __func__); retval =3D agilent_82357a_receive_control_msg(a_priv, agilent_82357a_cont= rol_request, USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE, XFER_STATUS, 0, status_data, STATUS_DATA_LEN, 100); mutex_unlock(&a_priv->bulk_transfer_lock); if (retval < 0) { - pr_err("%s: agilent_82357a_receive_control_msg() returned %i\n", __func_= _, retval); + dev_err(&usb_dev->dev, "%s: agilent_82357a_receive_control_msg() returne= d %i\n", + __func__, retval); kfree(status_data); return -EIO; } @@ -674,7 +683,8 @@ static ssize_t agilent_82357a_generic_write(gpib_board_= t *board, uint8_t *buffer *bytes_written |=3D status_data[5] << 24; =20 kfree(status_data); - //printk("%s: write completed, bytes_written=3D%i\n", __func__, (int)*byt= es_written); + //dev_dbg(&usb_dev->dev, "%s: write completed, bytes_written=3D%i\n", + //__func__, (int)*bytes_written); return 0; } =20 @@ -693,6 +703,7 @@ int agilent_82357a_command(gpib_board_t *board, uint8_t= *buffer, size_t length, int agilent_82357a_take_control_internal(gpib_board_t *board, int synchron= ous) { struct agilent_82357a_priv *a_priv =3D board->private_data; + struct usb_device *usb_dev =3D interface_to_usbdev(a_priv->bus_interface); struct agilent_82357a_register_pairlet write; int retval; =20 @@ -703,7 +714,8 @@ int agilent_82357a_take_control_internal(gpib_board_t *= board, int synchronous) write.value =3D AUX_TCA; retval =3D agilent_82357a_write_registers(a_priv, &write, 1); if (retval) - pr_err("%s: agilent_82357a_write_registers() returned error\n", __func__= ); + dev_err(&usb_dev->dev, "%s: agilent_82357a_write_registers() returned er= ror\n", + __func__); =20 return retval; } @@ -736,6 +748,7 @@ static int agilent_82357a_take_control(gpib_board_t *bo= ard, int synchronous) static int agilent_82357a_go_to_standby(gpib_board_t *board) { struct agilent_82357a_priv *a_priv =3D board->private_data; + struct usb_device *usb_dev =3D interface_to_usbdev(a_priv->bus_interface); struct agilent_82357a_register_pairlet write; int retval; =20 @@ -743,7 +756,8 @@ static int agilent_82357a_go_to_standby(gpib_board_t *b= oard) write.value =3D AUX_GTS; retval =3D agilent_82357a_write_registers(a_priv, &write, 1); if (retval) - pr_err("%s: agilent_82357a_write_registers() returned error\n", __func__= ); + dev_err(&usb_dev->dev, "%s: agilent_82357a_write_registers() returned er= ror\n", + __func__); return 0; } =20 @@ -751,6 +765,7 @@ static int agilent_82357a_go_to_standby(gpib_board_t *b= oard) static void agilent_82357a_request_system_control(gpib_board_t *board, int= request_control) { struct agilent_82357a_priv *a_priv =3D board->private_data; + struct usb_device *usb_dev =3D interface_to_usbdev(a_priv->bus_interface); struct agilent_82357a_register_pairlet writes[2]; int retval; int i =3D 0; @@ -771,13 +786,15 @@ static void agilent_82357a_request_system_control(gpi= b_board_t *board, int reque ++i; retval =3D agilent_82357a_write_registers(a_priv, writes, i); if (retval) - pr_err("%s: agilent_82357a_write_registers() returned error\n", __func__= ); + dev_err(&usb_dev->dev, "%s: agilent_82357a_write_registers() returned er= ror\n", + __func__); return;// retval; } =20 static void agilent_82357a_interface_clear(gpib_board_t *board, int assert) { struct agilent_82357a_priv *a_priv =3D board->private_data; + struct usb_device *usb_dev =3D interface_to_usbdev(a_priv->bus_interface); struct agilent_82357a_register_pairlet write; int retval; =20 @@ -789,12 +806,14 @@ static void agilent_82357a_interface_clear(gpib_board= _t *board, int assert) } retval =3D agilent_82357a_write_registers(a_priv, &write, 1); if (retval) - pr_err("%s: agilent_82357a_write_registers() returned error\n", __func__= ); + dev_err(&usb_dev->dev, "%s: agilent_82357a_write_registers() returned er= ror\n", + __func__); } =20 static void agilent_82357a_remote_enable(gpib_board_t *board, int enable) { struct agilent_82357a_priv *a_priv =3D board->private_data; + struct usb_device *usb_dev =3D interface_to_usbdev(a_priv->bus_interface); struct agilent_82357a_register_pairlet write; int retval; =20 @@ -804,7 +823,8 @@ static void agilent_82357a_remote_enable(gpib_board_t *= board, int enable) write.value |=3D AUX_CS; retval =3D agilent_82357a_write_registers(a_priv, &write, 1); if (retval) - pr_err("%s: agilent_82357a_write_registers() returned error\n", __func__= ); + dev_err(&usb_dev->dev, "%s: agilent_82357a_write_registers() returned er= ror\n", + __func__); a_priv->ren_state =3D enable; return;// 0; } @@ -832,6 +852,7 @@ static void agilent_82357a_disable_eos(gpib_board_t *bo= ard) static unsigned int agilent_82357a_update_status(gpib_board_t *board, unsi= gned int clear_mask) { struct agilent_82357a_priv *a_priv =3D board->private_data; + struct usb_device *usb_dev =3D interface_to_usbdev(a_priv->bus_interface); struct agilent_82357a_register_pairlet address_status, bus_status; int retval; =20 @@ -844,7 +865,8 @@ static unsigned int agilent_82357a_update_status(gpib_b= oard_t *board, unsigned i retval =3D agilent_82357a_read_registers(a_priv, &address_status, 1, 0); if (retval) { if (retval !=3D -EAGAIN) - pr_err("%s: agilent_82357a_read_registers() returned error\n", __func__= ); + dev_err(&usb_dev->dev, "%s: agilent_82357a_read_registers() returned er= ror\n", + __func__); return board->status; } // check for remote/local @@ -876,7 +898,8 @@ static unsigned int agilent_82357a_update_status(gpib_b= oard_t *board, unsigned i retval =3D agilent_82357a_read_registers(a_priv, &bus_status, 1, 0); if (retval) { if (retval !=3D -EAGAIN) - pr_err("%s: agilent_82357a_read_registers() returned error\n", __func__= ); + dev_err(&usb_dev->dev, "%s: agilent_82357a_read_registers() returned er= ror\n", + __func__); return board->status; } if (bus_status.value & BSR_SRQ_BIT) @@ -890,6 +913,7 @@ static unsigned int agilent_82357a_update_status(gpib_b= oard_t *board, unsigned i static int agilent_82357a_primary_address(gpib_board_t *board, unsigned in= t address) { struct agilent_82357a_priv *a_priv =3D board->private_data; + struct usb_device *usb_dev =3D interface_to_usbdev(a_priv->bus_interface); struct agilent_82357a_register_pairlet write; int retval; =20 @@ -898,7 +922,8 @@ static int agilent_82357a_primary_address(gpib_board_t = *board, unsigned int addr write.value =3D address & ADDRESS_MASK; retval =3D agilent_82357a_write_registers(a_priv, &write, 1); if (retval) { - pr_err("%s: agilent_82357a_write_registers() returned error\n", __func__= ); + dev_err(&usb_dev->dev, "%s: agilent_82357a_write_registers() returned er= ror\n", + __func__); return retval; } return retval; @@ -914,6 +939,7 @@ static int agilent_82357a_secondary_address(gpib_board_= t *board, unsigned int ad static int agilent_82357a_parallel_poll(gpib_board_t *board, uint8_t *resu= lt) { struct agilent_82357a_priv *a_priv =3D board->private_data; + struct usb_device *usb_dev =3D interface_to_usbdev(a_priv->bus_interface); struct agilent_82357a_register_pairlet writes[2]; struct agilent_82357a_register_pairlet read; int retval; @@ -925,14 +951,16 @@ static int agilent_82357a_parallel_poll(gpib_board_t = *board, uint8_t *result) writes[1].value =3D a_priv->hw_control_bits & ~NOT_PARALLEL_POLL; retval =3D agilent_82357a_write_registers(a_priv, writes, 2); if (retval) { - pr_err("%s: agilent_82357a_write_registers() returned error\n", __func__= ); + dev_err(&usb_dev->dev, "%s: agilent_82357a_write_registers() returned er= ror\n", + __func__); return retval; } udelay(2); //silly, since usb write will take way longer read.address =3D CPTR; retval =3D agilent_82357a_read_registers(a_priv, &read, 1, 1); if (retval) { - pr_err("%s: agilent_82357a_read_registers() returned error\n", __func__); + dev_err(&usb_dev->dev, "%s: agilent_82357a_read_registers() returned err= or\n", + __func__); return retval; } *result =3D read.value; @@ -943,7 +971,8 @@ static int agilent_82357a_parallel_poll(gpib_board_t *b= oard, uint8_t *result) writes[1].value =3D AUX_RPP; retval =3D agilent_82357a_write_registers(a_priv, writes, 2); if (retval) { - pr_err("%s: agilent_82357a_write_registers() returned error\n", __func_= _); + dev_err(&usb_dev->dev, "%s: agilent_82357a_write_registers() returned er= ror\n", + __func__); return retval; } return 0; @@ -982,6 +1011,7 @@ static void agilent_82357a_return_to_local(gpib_board_= t *board) static int agilent_82357a_line_status(const gpib_board_t *board) { struct agilent_82357a_priv *a_priv =3D board->private_data; + struct usb_device *usb_dev =3D interface_to_usbdev(a_priv->bus_interface); struct agilent_82357a_register_pairlet bus_status; int retval; int status =3D ValidALL; @@ -990,7 +1020,8 @@ static int agilent_82357a_line_status(const gpib_board= _t *board) retval =3D agilent_82357a_read_registers(a_priv, &bus_status, 1, 0); if (retval) { if (retval !=3D -EAGAIN) - pr_err("%s: agilent_82357a_read_registers() returned error\n", __func__= ); + dev_err(&usb_dev->dev, "%s: agilent_82357a_read_registers() returned er= ror\n", + __func__); return retval; } if (bus_status.value & BSR_REN_BIT) @@ -1031,6 +1062,7 @@ static unsigned short nanosec_to_fast_talker_bits(uns= igned int *nanosec) static unsigned int agilent_82357a_t1_delay(gpib_board_t *board, unsigned = int nanosec) { struct agilent_82357a_priv *a_priv =3D board->private_data; + struct usb_device *usb_dev =3D interface_to_usbdev(a_priv->bus_interface); struct agilent_82357a_register_pairlet write; int retval; =20 @@ -1038,7 +1070,8 @@ static unsigned int agilent_82357a_t1_delay(gpib_boar= d_t *board, unsigned int na write.value =3D nanosec_to_fast_talker_bits(&nanosec); retval =3D agilent_82357a_write_registers(a_priv, &write, 1); if (retval) - pr_err("%s: agilent_82357a_write_registers() returned error\n", __func__= ); + dev_err(&usb_dev->dev, "%s: agilent_82357a_write_registers() returned er= ror\n", + __func__); return nanosec; } =20 @@ -1046,6 +1079,7 @@ static void agilent_82357a_interrupt_complete(struct = urb *urb) { gpib_board_t *board =3D urb->context; struct agilent_82357a_priv *a_priv =3D board->private_data; + struct usb_device *usb_dev =3D interface_to_usbdev(a_priv->bus_interface); int retval; u8 *transfer_buffer =3D urb->transfer_buffer; unsigned long interrupt_flags; @@ -1062,7 +1096,7 @@ static void agilent_82357a_interrupt_complete(struct = urb *urb) default: /* other error, resubmit */ retval =3D usb_submit_urb(a_priv->interrupt_urb, GFP_ATOMIC); if (retval) - pr_err("%s: failed to resubmit interrupt urb\n", __func__); + dev_err(&usb_dev->dev, "%s: failed to resubmit interrupt urb\n", __func= __); return; } =20 @@ -1078,7 +1112,7 @@ static void agilent_82357a_interrupt_complete(struct = urb *urb) =20 retval =3D usb_submit_urb(a_priv->interrupt_urb, GFP_ATOMIC); if (retval) - pr_err("%s: failed to resubmit interrupt urb\n", __func__); + dev_err(&usb_dev->dev, "%s: failed to resubmit interrupt urb\n", __func_= _); } =20 static int agilent_82357a_setup_urbs(gpib_board_t *board) @@ -1114,7 +1148,8 @@ static int agilent_82357a_setup_urbs(gpib_board_t *bo= ard) if (retval) { usb_free_urb(a_priv->interrupt_urb); a_priv->interrupt_urb =3D NULL; - pr_err("%s: failed to submit first interrupt urb, retval=3D%i\n", __func= __, retval); + dev_err(&usb_dev->dev, "%s: failed to submit first interrupt urb, retval= =3D%i\n", + __func__, retval); goto setup_exit; } mutex_unlock(&a_priv->interrupt_alloc_lock); @@ -1130,6 +1165,7 @@ static int agilent_82357a_setup_urbs(gpib_board_t *bo= ard) static int agilent_82357a_reset_usb_configuration(gpib_board_t *board) { struct agilent_82357a_priv *a_priv =3D board->private_data; + struct usb_device *usb_dev =3D interface_to_usbdev(a_priv->bus_interface); struct usb_device *usb_dev; int retval; =20 @@ -1138,7 +1174,8 @@ static int agilent_82357a_reset_usb_configuration(gpi= b_board_t *board) usb_dev =3D interface_to_usbdev(a_priv->bus_interface); retval =3D usb_reset_configuration(usb_dev); if (retval) - pr_err("%s: usb_reset_configuration() returned %i\n", __func__, retval); + dev_err(&usb_dev->dev, "%s: usb_reset_configuration() returned %i\n", + __func__, retval); return retval; } #endif @@ -1179,6 +1216,7 @@ static void agilent_82357a_free_private(struct agilen= t_82357a_priv *a_priv) static int agilent_82357a_init(gpib_board_t *board) { struct agilent_82357a_priv *a_priv =3D board->private_data; + struct usb_device *usb_dev =3D interface_to_usbdev(a_priv->bus_interface); struct agilent_82357a_register_pairlet hw_control; struct agilent_82357a_register_pairlet writes[0x20]; int retval; @@ -1194,7 +1232,8 @@ static int agilent_82357a_init(gpib_board_t *board) ++i; retval =3D agilent_82357a_write_registers(a_priv, writes, i); if (retval) { - pr_err("%s: agilent_82357a_write_registers() returned error\n", __func__= ); + dev_err(&usb_dev->dev, "%s: agilent_82357a_write_registers() returned er= ror\n", + __func__); return -EIO; } set_current_state(TASK_INTERRUPTIBLE); @@ -1259,18 +1298,20 @@ static int agilent_82357a_init(gpib_board_t *board) writes[i].value =3D FIRMWARE_LED_CONTROL; ++i; if (i > ARRAY_SIZE(writes)) { - pr_err("%s: bug! writes[] overflow\n", __func__); + dev_err(&usb_dev->dev, "%s: bug! writes[] overflow\n", __func__); return -EFAULT; } retval =3D agilent_82357a_write_registers(a_priv, writes, i); if (retval) { - pr_err("%s: agilent_82357a_write_registers() returned error\n", __func__= ); + dev_err(&usb_dev->dev, "%s: agilent_82357a_write_registers() returned er= ror\n", + __func__); return -EIO; } hw_control.address =3D HW_CONTROL; retval =3D agilent_82357a_read_registers(a_priv, &hw_control, 1, 1); if (retval) { - pr_err("%s: agilent_82357a_read_registers() returned error\n", __func__); + dev_err(&usb_dev->dev, "%s: agilent_82357a_read_registers() returned err= or\n", + __func__); return -EIO; } a_priv->hw_control_bits =3D (hw_control.value & ~0x7) | NOT_TI_RESET | NO= T_PARALLEL_POLL; @@ -1338,7 +1379,7 @@ static int agilent_82357a_attach(gpib_board_t *board,= const gpib_board_config_t a_priv->interrupt_in_endpoint =3D AGILENT_82357B_INTERRUPT_IN_ENDPOINT; break; default: - pr_err("bug, unhandled product_id in switch?\n"); + dev_err(&usb_dev->dev, "bug, unhandled product_id in switch?\n"); return -EIO; } #ifdef RESET_USB_CONFIG @@ -1365,7 +1406,7 @@ static int agilent_82357a_attach(gpib_board_t *board,= const gpib_board_config_t return retval; } =20 - pr_info("%s: attached\n", __func__); + dev_info(&usb_dev->dev, "%s: attached\n", __func__); mutex_unlock(&agilent_82357a_hotplug_lock); return retval; } @@ -1373,6 +1414,7 @@ static int agilent_82357a_attach(gpib_board_t *board,= const gpib_board_config_t static int agilent_82357a_go_idle(gpib_board_t *board) { struct agilent_82357a_priv *a_priv =3D board->private_data; + struct usb_device *usb_dev =3D interface_to_usbdev(a_priv->bus_interface); struct agilent_82357a_register_pairlet writes[0x20]; int retval; int i; @@ -1399,12 +1441,13 @@ static int agilent_82357a_go_idle(gpib_board_t *boa= rd) writes[i].value =3D 0; ++i; if (i > ARRAY_SIZE(writes)) { - pr_err("%s: bug! writes[] overflow\n", __func__); + dev_err(&usb_dev->dev, "%s: bug! writes[] overflow\n", __func__); return -EFAULT; } retval =3D agilent_82357a_write_registers(a_priv, writes, i); if (retval) { - pr_err("%s: agilent_82357a_write_registers() returned error\n", __func__= ); + dev_err(&usb_dev->dev, "%s: agilent_82357a_write_registers() returned er= ror\n", + __func__); return -EIO; } return 0; @@ -1413,10 +1456,12 @@ static int agilent_82357a_go_idle(gpib_board_t *boa= rd) static void agilent_82357a_detach(gpib_board_t *board) { struct agilent_82357a_priv *a_priv; + struct usb_device *usb_dev; =20 mutex_lock(&agilent_82357a_hotplug_lock); =20 a_priv =3D board->private_data; + usb_dev =3D interface_to_usbdev(a_priv->bus_interface); if (a_priv) { if (a_priv->bus_interface) { agilent_82357a_go_idle(board); @@ -1428,7 +1473,7 @@ static void agilent_82357a_detach(gpib_board_t *board) agilent_82357a_cleanup_urbs(a_priv); agilent_82357a_free_private(a_priv); } - pr_info("%s: detached\n", __func__); + dev_info(&usb_dev->dev, "%s: detached\n", __func__); mutex_unlock(&agilent_82357a_hotplug_lock); } =20 @@ -1476,32 +1521,35 @@ static int agilent_82357a_driver_probe(struct usb_i= nterface *interface, int i; char *path; static const int path_length =3D 1024; + struct usb_device *usb_dev; =20 if (mutex_lock_interruptible(&agilent_82357a_hotplug_lock)) return -ERESTARTSYS; - usb_get_dev(interface_to_usbdev(interface)); + usb_dev =3D usb_get_dev(interface_to_usbdev(interface)); for (i =3D 0; i < MAX_NUM_82357A_INTERFACES; ++i) { if (!agilent_82357a_driver_interfaces[i]) { agilent_82357a_driver_interfaces[i] =3D interface; usb_set_intfdata(interface, NULL); - GPIB_DPRINTK("set bus interface %i to address 0x%p\n", i, interface); + dev_dbg(&usb_dev->dev, "set bus interface %i to address 0x%p\n", + i, interface); break; } } if (i =3D=3D MAX_NUM_82357A_INTERFACES) { - usb_put_dev(interface_to_usbdev(interface)); + usb_put_dev(usb_dev); mutex_unlock(&agilent_82357a_hotplug_lock); - pr_err("%s: out of space in agilent_82357a_driver_interfaces[]\n", __fun= c__); + dev_err(&usb_dev->dev, "%s: out of space in agilent_82357a_driver_interf= aces[]\n", + __func__); return -1; } path =3D kmalloc(path_length, GFP_KERNEL); if (!path) { - usb_put_dev(interface_to_usbdev(interface)); + usb_put_dev(usb_dev); mutex_unlock(&agilent_82357a_hotplug_lock); return -ENOMEM; } - usb_make_path(interface_to_usbdev(interface), path, path_length); - pr_info("probe succeeded for path: %s\n", path); + usb_make_path(usb_dev, path, path_length); + dev_info(&usb_dev->dev, "probe succeeded for path: %s\n", path); kfree(path); mutex_unlock(&agilent_82357a_hotplug_lock); return 0; @@ -1510,6 +1558,7 @@ static int agilent_82357a_driver_probe(struct usb_int= erface *interface, static void agilent_82357a_driver_disconnect(struct usb_interface *interfa= ce) { int i; + struct usb_device *usb_dev =3D interface_to_usbdev(interface); =20 mutex_lock(&agilent_82357a_hotplug_lock); =20 @@ -1531,22 +1580,22 @@ static void agilent_82357a_driver_disconnect(struct= usb_interface *interface) mutex_unlock(&a_priv->control_alloc_lock); } } - GPIB_DPRINTK("nulled agilent_82357a_driver_interfaces[%i]\n", i); + dev_dbg(&usb_dev->dev, "nulled agilent_82357a_driver_interfaces[%i]\n",= i); agilent_82357a_driver_interfaces[i] =3D NULL; break; } } if (i =3D=3D MAX_NUM_82357A_INTERFACES) - pr_err("unable to find interface in agilent_82357a_driver_interfaces[]? = bug?\n"); - usb_put_dev(interface_to_usbdev(interface)); + dev_err(&usb_dev->dev, "unable to find interface in agilent_82357a_drive= r_interfaces[]? bug?\n"); + usb_put_dev(usb_dev); =20 mutex_unlock(&agilent_82357a_hotplug_lock); } =20 static int agilent_82357a_driver_suspend(struct usb_interface *interface, = pm_message_t message) { - struct usb_device *usb_dev; int i, retval; + struct usb_device *usb_dev =3D interface_to_usbdev(interface); =20 mutex_lock(&agilent_82357a_hotplug_lock); =20 @@ -1562,15 +1611,14 @@ static int agilent_82357a_driver_suspend(struct usb= _interface *interface, pm_mes agilent_82357a_abort(a_priv, 0); retval =3D agilent_82357a_go_idle(board); if (retval) { - pr_err("%s: failed to go idle, retval=3D%i\n", - __func__, retval); + dev_err(&usb_dev->dev, "%s: failed to go idle, retval=3D%i\n", + __func__, retval); mutex_unlock(&agilent_82357a_hotplug_lock); return retval; } mutex_lock(&a_priv->interrupt_alloc_lock); agilent_82357a_cleanup_urbs(a_priv); mutex_unlock(&a_priv->interrupt_alloc_lock); - usb_dev =3D interface_to_usbdev(a_priv->bus_interface); dev_info(&usb_dev->dev, "bus %d dev num %d gpib minor %d, agilent usb interface %i suspend= ed\n", usb_dev->bus->busnum, usb_dev->devnum, @@ -1588,7 +1636,7 @@ static int agilent_82357a_driver_suspend(struct usb_i= nterface *interface, pm_mes =20 static int agilent_82357a_driver_resume(struct usb_interface *interface) { - struct usb_device *usb_dev; + struct usb_device *usb_dev =3D interface_to_usbdev(interface); gpib_board_t *board; int i, retval; =20 @@ -1611,8 +1659,8 @@ static int agilent_82357a_driver_resume(struct usb_in= terface *interface) mutex_lock(&a_priv->interrupt_alloc_lock); retval =3D usb_submit_urb(a_priv->interrupt_urb, GFP_KERNEL); if (retval) { - pr_err("%s: failed to resubmit interrupt urb, retval=3D%i\n", - __func__, retval); + dev_err(&usb_dev->dev, "%s: failed to resubmit interrupt urb, retval= =3D%i\n", + __func__, retval); mutex_unlock(&a_priv->interrupt_alloc_lock); mutex_unlock(&agilent_82357a_hotplug_lock); return retval; @@ -1635,7 +1683,6 @@ static int agilent_82357a_driver_resume(struct usb_in= terface *interface) // assert/unassert REN agilent_82357a_remote_enable(board, a_priv->ren_state); =20 - usb_dev =3D interface_to_usbdev(a_priv->bus_interface); dev_info(&usb_dev->dev, "bus %d dev num %d gpib minor %d, agilent usb interface %i resumed\n", usb_dev->bus->busnum, usb_dev->devnum, board->minor, i); @@ -1678,4 +1725,3 @@ static void __exit agilent_82357a_exit_module(void) =20 module_init(agilent_82357a_init_module); module_exit(agilent_82357a_exit_module); - --=20 2.46.2 From nobody Sun Nov 24 17:00:48 2024 Received: from mail-wm1-f47.google.com (mail-wm1-f47.google.com [209.85.128.47]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id F22BE18CBF8 for ; Sun, 3 Nov 2024 21:26:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.47 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730669198; cv=none; b=r+QKW4dn21fChILyi8kGYdAmKTnnhUz6JVp1CC1KPEiRXkQ/uwj/+UjnxiRxTSEzjv8Eb2ZrVt9VZN+nbY1yNO36l4+vKqf2bBVc97uy0FzyJIky0miBMlAimoyvG2wumc2I9pnNSk284A7hXIBJ2hAoyvaFkT2inGwrrzxSLlM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730669198; c=relaxed/simple; bh=GnOIAECmVwiT8+ZXSM9/4gaR3PBUUO7ucq0L/jGUvhw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=CRLy4xy85CzQE6NenREaUPFY2w9ipxQ8udboB93uECSDtWcyLUszE3zzuR2v+xRnHlk7tNxWSoXHFzMU2w3Mj3m/9i+0+4Hhbk5Uye/3sTS9c83enuP2afTPo3udeZ6yToYSSxEVsGR/bVDrZtkDxWX0Qn1TvuCG1M6KmIottRw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=MSLlFG9z; arc=none smtp.client-ip=209.85.128.47 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="MSLlFG9z" Received: by mail-wm1-f47.google.com with SMTP id 5b1f17b1804b1-431548bd1b4so29026925e9.3 for ; Sun, 03 Nov 2024 13:26:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1730669194; x=1731273994; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=jed53pgUVzCUOul7yhZEbquQmhu+DNb2Fp6Ww01czCY=; b=MSLlFG9z36Nqo8/2p7LRmG2zqNa4e+F+Kq98ufyQknUxfBkAAwnMWlHS4vqaMNzLlf C3TNAces89Q98yWuxM8GOnjo3xk1i+FOjwjEHehWIJ3x3+R4QfH6RjyYKGtLDr3mJHID 9RW6supp8W+GS7emxgBztPE1+U2Act5wlMs8dzJL4Oj0YCPOhW2a32nivUN/g31ldE0p 9NlCMdd24nkgDqeHGo7fZqd+7DOE+PegdOd6YJWrhqiY3hL8VZ6ue4xQZqS7gZFoKljj QtwPgvo1a7m2K2R0+cLVZ2cpaTQOew6D62fq2tDJJ4QkmcVsbqfA8JlAXv9vkP0snawN 6ypg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730669194; x=1731273994; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=jed53pgUVzCUOul7yhZEbquQmhu+DNb2Fp6Ww01czCY=; b=vd4qntDXuIUMqQui99jEmBDM8thLKnkvNpxsvl+C5mcXnvecIn631s6hlcIBSJ8l2Q +dmeHeTVNxhbpz2VRkYv3QnN1vWr15QYuaIOrQtUxhVYnhZnZiko2as2xOtf4YOEDCGU 9dWJr0Brl1NWsbyqjkCdhusxxGnIHsK0qyRmAzGTytrJNEPBiW9Aa3PYqRax2Z11HPe8 cDjeS6sT2chxeeiiUQOhjm8Pu3z8iQOqZw+7rCL4+cyVT3Anv2Fh5P4XRxV+GLcl+fyg rbWBfqrEuhdML3Rf4lOljBnB9FDTvhyseJCOMcPVYMKpykdSK2eT852EGhXZtmIQ+4Jr ZOUg== X-Forwarded-Encrypted: i=1; AJvYcCUE/GdT/4aYp9Zb+smCK6JivdgdKGwNNBGhVRF5MuwnhuPWIttW8eKphGwzWCBC4aooH1ikB8ff5Dupfzc=@vger.kernel.org X-Gm-Message-State: AOJu0Yyo4CNiSrrdLaN5wWrEfy+IMeeyv8SarkCOhgBxSueIEI7yaleC EGSC0A4HCt0mlipKUDQDr/aX96uQGf2MmDxuJpjt3cPeGUMz5Ewh X-Google-Smtp-Source: AGHT+IEfNq5tYWaFk8cJkbi6Qdpav8ARRd+uBLPxYzWYy3g8I0SKf2qM2YjYARIIoNsGlRFWGo203g== X-Received: by 2002:a05:6000:1a8a:b0:37d:4a7b:eeb2 with SMTP id ffacd0b85a97d-381c7a6d600mr7981934f8f.35.1730669194110; Sun, 03 Nov 2024 13:26:34 -0800 (PST) Received: from localhost.localdomain (82-64-73-52.subs.proxad.net. [82.64.73.52]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-431bd910718sm166150385e9.12.2024.11.03.13.26.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 03 Nov 2024 13:26:33 -0800 (PST) From: Dave Penkler To: gregkh@linuxfoundation.org, linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org Cc: skhan@linuxfoundation.org, arnd@arndb.de, dan.carpenter@linaro.org, Dave Penkler Subject: [PATCH 05/11] staging: gpib: Remove GPIB_DEBUG reference and update messaging Date: Sun, 3 Nov 2024 22:26:11 +0100 Message-ID: <20241103212617.13076-6-dpenkler@gmail.com> X-Mailer: git-send-email 2.46.2 In-Reply-To: <20241103212617.13076-1-dpenkler@gmail.com> References: <20241103212617.13076-1-dpenkler@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Change pr_alert to dev_alert Signed-off-by: Dave Penkler --- .../gpib/lpvo_usb_gpib/lpvo_usb_gpib.c | 69 +++++++++---------- 1 file changed, 34 insertions(+), 35 deletions(-) diff --git a/drivers/staging/gpib/lpvo_usb_gpib/lpvo_usb_gpib.c b/drivers/s= taging/gpib/lpvo_usb_gpib/lpvo_usb_gpib.c index 4c580137043f..796c3a5be545 100644 --- a/drivers/staging/gpib/lpvo_usb_gpib/lpvo_usb_gpib.c +++ b/drivers/staging/gpib/lpvo_usb_gpib/lpvo_usb_gpib.c @@ -68,11 +68,8 @@ MODULE_DEVICE_TABLE(usb, skel_table); * At module loading: modprobe lpvo_usb_gpib debug=3D{0,1,2} * On the fly: echo {0,1,2} > /sys/modules/lpvo_usb_gpib/parameters/= debug */ -#ifdef GPIB_DEBUG -static int debug =3D 1; -#else + static int debug; -#endif module_param(debug, int, 0644); =20 #define DIA_LOG(level, format, ...) \ @@ -366,10 +363,10 @@ static int one_char(gpib_board_t *board, struct char_= buf *b) DIA_LOG(2, "--> %x\n", b->inbuf[b->last - b->nchar]); return b->inbuf[b->last - b->nchar--]; } else if (b->nchar =3D=3D 0) { - pr_alert("%s:%s - read returned EOF\n", NAME, __func__); + dev_alert(board->gpib_dev, "%s:%s - read returned EOF\n", NAME, __func__= ); return -EIO; } - pr_alert("%s:%s - read error %d\n", NAME, __func__, b->nchar); + dev_alert(board->gpib_dev, "%s:%s - read error %d\n", NAME, __func__, b->= nchar); TTY_LOG("\n *** %s *** Read Error - %s\n", NAME, "Reset the adapter with 'gpib_config'\n"); return -EIO; @@ -412,8 +409,8 @@ static void set_timeout(gpib_board_t *board) } =20 if (val !=3D ACK) { - pr_alert("%s:%s - error in timeout set: <%s>\n", - NAME, __func__, command); + dev_alert(board->gpib_dev, "%s:%s - error in timeout set: <%s>\n", + NAME, __func__, command); } else { data->timeout =3D board->usec_timeout; } @@ -456,8 +453,8 @@ static int usb_gpib_attach(gpib_board_t *board, const g= pib_board_config_t *confi =20 if (config->device_path) { /* if config->device_path given, try that first */ - pr_alert("%s:%s - Looking for device_path: %s\n", - NAME, __func__, config->device_path); + dev_alert(board->gpib_dev, "%s:%s - Looking for device_path: %s\n", + NAME, __func__, config->device_path); for (j =3D 0 ; j < MAX_DEV ; j++) { if ((assigned_usb_minors & 1 << j) =3D=3D 0) continue; @@ -492,7 +489,8 @@ static int usb_gpib_attach(gpib_board_t *board, const g= pib_board_config_t *confi mutex_unlock(&minors_lock); =20 if (j =3D=3D MAX_DEV) { - pr_alert("%s:%s - Requested device is not registered.\n", NAME, __func__= ); + dev_alert(board->gpib_dev, "%s:%s - Requested device is not registered.\= n", + NAME, __func__); return -EIO; } =20 @@ -737,7 +735,8 @@ static int usb_gpib_line_status(const gpib_board_t *boa= rd) buffer =3D send_command((gpib_board_t *)board, USB_GPIB_STATUS, 0); =20 if (buffer < 0) { - pr_alert("%s:%s - line status read failed with %d\n", NAME, __func__, bu= ffer); + dev_alert(board->gpib_dev, "%s:%s - line status read failed with %d\n", + NAME, __func__, buffer); return -1; } =20 @@ -777,7 +776,7 @@ static int usb_gpib_parallel_poll(gpib_board_t *board, = uint8_t *result) =20 retval =3D set_control_line(board, IB_BUS_EOI, 1); if (retval !=3D ACK) { - pr_alert("%s:%s - assert EOI failed\n", NAME, __func__); + dev_alert(board->gpib_dev, "%s:%s - assert EOI failed\n", NAME, __func__= ); return -EIO; } =20 @@ -787,7 +786,7 @@ static int usb_gpib_parallel_poll(gpib_board_t *board, = uint8_t *result) =20 retval =3D set_control_line(board, IB_BUS_EOI, 0); if (retval !=3D 0x06) { - pr_alert("%s:%s - unassert EOI failed\n", NAME, __func__); + dev_alert(board->gpib_dev, "%s:%s - unassert EOI failed\n", NAME, __func= __); return -EIO; } =20 @@ -869,8 +868,8 @@ static int usb_gpib_read(gpib_board_t *board, goto read_return; =20 if (one_char(board, &b) !=3D DLE || one_char(board, &b) !=3D STX) { - pr_alert("%s:%s - wrong sequence\n", - NAME, __func__); + dev_alert(board->gpib_dev, "%s:%s - wrong sequence\n", + NAME, __func__); retval =3D -EIO; goto read_return; } @@ -910,15 +909,15 @@ static int usb_gpib_read(gpib_board_t *board, retval =3D 0; goto read_return; } else { - pr_alert("%s:%s - %s %x\n", - NAME, __func__, - "Wrong end of message", c); + dev_alert(board->gpib_dev, "%s:%s - %s %x\n", + NAME, __func__, + "Wrong end of message", c); retval =3D -ETIME; goto read_return; } } else { - pr_alert("%s:%s - %s\n", NAME, __func__, - "lone in stream"); + dev_alert(board->gpib_dev, "%s:%s - %s\n", NAME, __func__, + "lone in stream"); retval =3D -EIO; goto read_return; } @@ -937,8 +936,8 @@ static int usb_gpib_read(gpib_board_t *board, c =3D one_char(board, &b); if (c =3D=3D ACK) { if (MAX_READ_EXCESS - read_count > 1) - pr_alert("%s:%s - %s\n", NAME, __func__, - "small buffer - maybe some data lost"); + dev_alert(board->gpib_dev, "%s:%s - %s\n", NAME, __func__, + "small buffer - maybe some data lost"); retval =3D 0; goto read_return; } @@ -946,8 +945,8 @@ static int usb_gpib_read(gpib_board_t *board, } } =20 - pr_alert("%s:%s - no input end - GPIB board in odd state\n", - NAME, __func__); + dev_alert(board->gpib_dev, "%s:%s - no input end - GPIB board in odd stat= e\n", + NAME, __func__); retval =3D -EIO; =20 read_return: @@ -973,8 +972,8 @@ static void usb_gpib_remote_enable(gpib_board_t *board,= int enable) =20 retval =3D set_control_line(board, IB_BUS_REN, enable ? 1 : 0); if (retval !=3D ACK) - pr_alert("%s:%s - could not set REN line: %x\n", - NAME, __func__, retval); + dev_alert(board->gpib_dev, "%s:%s - could not set REN line: %x\n", + NAME, __func__, retval); =20 DIA_LOG(1, "done with %x\n", retval); } @@ -1072,21 +1071,21 @@ static int usb_gpib_write(gpib_board_t *board, static void usb_gpib_parallel_poll_configure(gpib_board_t *board, uint8_t configuration) { - pr_alert("%s:%s - currently a NOP\n", NAME, __func__); + dev_alert(board->gpib_dev, "%s:%s - currently a NOP\n", NAME, __func__); } =20 /* parallel_poll_response */ =20 static void usb_gpib_parallel_poll_response(gpib_board_t *board, int ist) { - pr_alert("%s:%s - currently a NOP\n", NAME, __func__); + dev_alert(board->gpib_dev, "%s:%s - currently a NOP\n", NAME, __func__); } =20 /* primary_address */ =20 static int usb_gpib_primary_address(gpib_board_t *board, unsigned int add= ress) { - pr_alert("%s:%s - currently a NOP\n", NAME, __func__); + dev_alert(board->gpib_dev, "%s:%s - currently a NOP\n", NAME, __func__); return 0; } =20 @@ -1094,7 +1093,7 @@ static int usb_gpib_primary_address(gpib_board_t *bo= ard, unsigned int address) =20 static void usb_gpib_return_to_local(gpib_board_t *board) { - pr_alert("%s:%s - currently a NOP\n", NAME, __func__); + dev_alert(board->gpib_dev, "%s:%s - currently a NOP\n", NAME, __func__); } =20 /* secondary_address */ @@ -1103,7 +1102,7 @@ static int usb_gpib_secondary_address(gpib_board_t *b= oard, unsigned int address, int enable) { - pr_alert("%s:%s - currently a NOP\n", NAME, __func__); + dev_alert(board->gpib_dev, "%s:%s - currently a NOP\n", NAME, __func__); return 0; } =20 @@ -1111,14 +1110,14 @@ static int usb_gpib_secondary_address(gpib_board_t = *board, =20 static void usb_gpib_serial_poll_response(gpib_board_t *board, uint8_t sta= tus) { - pr_alert("%s:%s - currently a NOP\n", NAME, __func__); + dev_alert(board->gpib_dev, "%s:%s - currently a NOP\n", NAME, __func__); } =20 /* serial_poll_status */ =20 static uint8_t usb_gpib_serial_poll_status(gpib_board_t *board) { - pr_alert("%s:%s - currently a NOP\n", NAME, __func__); + dev_alert(board->gpib_dev, "%s:%s - currently a NOP\n", NAME, __func__); return 0; } =20 @@ -1126,7 +1125,7 @@ static uint8_t usb_gpib_serial_poll_status(gpib_board= _t *board) =20 static unsigned int usb_gpib_t1_delay(gpib_board_t *board, unsigned int na= no_sec) { - pr_alert("%s:%s - currently a NOP\n", NAME, __func__); + dev_alert(board->gpib_dev, "%s:%s - currently a NOP\n", NAME, __func__); return 0; } =20 --=20 2.46.2 From nobody Sun Nov 24 17:00:48 2024 Received: from mail-wm1-f42.google.com (mail-wm1-f42.google.com [209.85.128.42]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 613F518CC04 for ; Sun, 3 Nov 2024 21:26:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.42 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730669199; cv=none; b=lzcI+j/4n2vMHFpo9IVofMj9EuLX5kzifC/8kJXOqNQF2oavgwtS7yrE/mZjJEOBtRNHs0Lt+vT9nv63CyOr9iJFa0bKOHYGwWR6+k8g2cgTSWttZPYPDeu6QN/nRjf/65HhzICvnlPPt+8oIVXAFo01/nExMnfvesp6XAwvaNs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730669199; c=relaxed/simple; bh=lVjBIPmAWAxvwFpAqjKCBvNzEMuvfZvqfx6EZrhXWBg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Xokj7HmQXEYg7qZ/tS8KjWMiTMq/Kvau2o8Du5Fhd/hGyiwftXBsVu65ZfDiiZTDJGO+0JxVZyfiPPGTt9JOy8aTXdtT2okwxd5wZ9wK7c1tC72KXDgUy65OBbqP8okS7cMf8/RcEDLunZlSVpUr9NYstkse2rAQQ/jQf5hiFzI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=MumCLSa8; arc=none smtp.client-ip=209.85.128.42 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="MumCLSa8" Received: by mail-wm1-f42.google.com with SMTP id 5b1f17b1804b1-4315eac969aso20537395e9.1 for ; Sun, 03 Nov 2024 13:26:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1730669196; x=1731273996; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=PMiOenlcN+NEHEm2VnBri2kDf2u06cLWkpnyRcrJPNU=; b=MumCLSa8snmR4qUXSOivC2O5viSU93DcwSzkt/H4Jn23G2yIzY8089VwAIXpKCLs8b 1o2mQzG7/hSNOgasr9VaUkP2rRcPkfN+Oy+Z0PPnQ5lZh9E+UDizpYp6aRDAdvSJvyNd KD+J+bgmb5P/DWoMpFCpwTvUrNm4g2X3XbwVNPCBtUHG78rz1pL2cymGDphtq+/o2RGu eNh3xNMgm+rO6XIj3s8YKCxHfdgBPOUy+LSd+S6V1eesjd/zQxr4sa7PIFlw9BX5f4fn IYUdMDBIbMw1qQZggkhtIN+uTL5sSLl5r/vl6UYgsV/3p5811b+nmfYt61N6c9X2Thph u6pg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730669196; x=1731273996; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=PMiOenlcN+NEHEm2VnBri2kDf2u06cLWkpnyRcrJPNU=; b=tfrLBscpV51RE+28wsVjWEVyfIA4A0LkpQe5x3wqmoBx6w0kdCoTDa/a+7af22KRrz VKN8K2fsq66f+GIRNqk+QxqvmmpISkwy9wYK9iYAkuKhnqUDbHCrKoDQw3w/14e0wJeH R97sSCpE/PeRLk/joYZEwAsX9oto5iSgG9EA9CmxeN+MeeCP0wsG4p6y4O3xQ2bStCZB PbXfMIh4Jxa2i8te7KoGz14c1JFjVirepyYZW610wvjCBRGDqscNRSHe8j5HpP/pGoM6 ULpicWHfkJJEBIsmLnih2A8de1lPtkdsuVEOzP9/c0tYqiUA77bbxzes31Hyf+O+92Cz QJRA== X-Forwarded-Encrypted: i=1; AJvYcCVPPg8PzgS1d4m3hKDIlD3galPlH/iZGvfAOdscoFI6LqvP6BrRz1K0Ls+J65loTWsHTNpuoBR1ywe4B7I=@vger.kernel.org X-Gm-Message-State: AOJu0YyFFrr6CzOxCSRg+ABX8EkWW7ZYJ1pjZ8JHx3osszEVk6RvBwfl lk+4DOjbqT/nxji0sHrXOiQ/mUVb81gptZWQj7qi5HZ3b6epU86dFvAMa0TC X-Google-Smtp-Source: AGHT+IGPr+FjP96HEKHg8ORW9XPcLWKsm1va+S89dWi8FluqAecp1ebilh7t1Y9SeI110J8oi9YUxA== X-Received: by 2002:a05:600c:3b83:b0:424:895c:b84b with SMTP id 5b1f17b1804b1-4327da6b93emr97406355e9.4.1730669195445; Sun, 03 Nov 2024 13:26:35 -0800 (PST) Received: from localhost.localdomain (82-64-73-52.subs.proxad.net. [82.64.73.52]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-431bd910718sm166150385e9.12.2024.11.03.13.26.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 03 Nov 2024 13:26:34 -0800 (PST) From: Dave Penkler To: gregkh@linuxfoundation.org, linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org Cc: skhan@linuxfoundation.org, arnd@arndb.de, dan.carpenter@linaro.org, Dave Penkler Subject: [PATCH 06/11] staging: gpib: Use dev_xxx for messaging Date: Sun, 3 Nov 2024 22:26:12 +0100 Message-ID: <20241103212617.13076-7-dpenkler@gmail.com> X-Mailer: git-send-email 2.46.2 In-Reply-To: <20241103212617.13076-1-dpenkler@gmail.com> References: <20241103212617.13076-1-dpenkler@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Change pr_xxx to dev_xxx Signed-off-by: Dave Penkler --- .../gpib/agilent_82350b/agilent_82350b.c | 70 +++++++++++-------- 1 file changed, 42 insertions(+), 28 deletions(-) diff --git a/drivers/staging/gpib/agilent_82350b/agilent_82350b.c b/drivers= /staging/gpib/agilent_82350b/agilent_82350b.c index 3aa624486c0f..53006d0cc79c 100644 --- a/drivers/staging/gpib/agilent_82350b/agilent_82350b.c +++ b/drivers/staging/gpib/agilent_82350b/agilent_82350b.c @@ -52,7 +52,8 @@ int agilent_82350b_accel_read(gpib_board_t *board, uint8_= t *buffer, size_t lengt retval =3D tms9914_read(board, tms_priv, buffer, 1, end, &num_bytes); *bytes_read +=3D num_bytes; if (retval < 0) - pr_err("%s: tms9914_read failed retval=3D%i\n", driver_name, retval); + dev_err(board->gpib_dev, "%s: tms9914_read failed retval=3D%i\n", + driver_name, retval); if (retval < 0 || *end) return retval; ++buffer; @@ -88,7 +89,7 @@ int agilent_82350b_accel_read(gpib_board_t *board, uint8_= t *buffer, size_t lengt test_bit(DEV_CLEAR_BN, &tms_priv->state) || test_bit(TIMO_NUM, &board->status)); if (retval) { - pr_err("%s: read wait interrupted\n", driver_name); + dev_dbg(board->gpib_dev, "%s: read wait interrupted\n", driver_name); retval =3D -ERESTARTSYS; break; } @@ -102,12 +103,13 @@ int agilent_82350b_accel_read(gpib_board_t *board, ui= nt8_t *buffer, size_t lengt *end =3D 1; } if (test_bit(TIMO_NUM, &board->status)) { - pr_err("%s: minor %i: read timed out\n", driver_name, board->minor); + dev_err(board->gpib_dev, "%s: read timed out\n", driver_name); retval =3D -ETIMEDOUT; break; } if (test_bit(DEV_CLEAR_BN, &tms_priv->state)) { - pr_err("%s: device clear interrupted read\n", driver_name); + dev_err(board->gpib_dev, "%s: device clear interrupted read\n", + driver_name); retval =3D -EINTR; break; } @@ -138,15 +140,15 @@ static int translate_wait_return_value(gpib_board_t *= board, int retval) struct tms9914_priv *tms_priv =3D &a_priv->tms9914_priv; =20 if (retval) { - pr_err("%s: write wait interrupted\n", driver_name); + dev_err(board->gpib_dev, "%s: write wait interrupted\n", driver_name); return -ERESTARTSYS; } if (test_bit(TIMO_NUM, &board->status)) { - pr_err("%s: minor %i: write timed out\n", driver_name, board->minor); + dev_err(board->gpib_dev, "%s: write timed out\n", driver_name); return -ETIMEDOUT; } if (test_bit(DEV_CLEAR_BN, &tms_priv->state)) { - pr_err("%s: device clear interrupted write\n", driver_name); + dev_err(board->gpib_dev, "%s: device clear interrupted write\n", driver_= name); return -EINTR; } return 0; @@ -558,10 +560,11 @@ static int init_82350a_hardware(gpib_board_t *board, = const gpib_board_config_t * return 0; // need to programme borg if (!config->init_data || config->init_data_length !=3D firmware_length) { - pr_err("%s: the 82350A board requires firmware after powering on.\n", dr= iver_name); + dev_err(board->gpib_dev, "%s: the 82350A board requires firmware after p= owering on.\n", + driver_name); return -EIO; } - pr_info("%s: Loading firmware...\n", driver_name); + dev_info(board->gpib_dev, "%s: Loading firmware...\n", driver_name); =20 // tickle the borg writel(plx_cntrl_static_bits | PLX9050_USER3_DATA_BIT, @@ -580,7 +583,7 @@ static int init_82350a_hardware(gpib_board_t *board, co= nst gpib_board_config_t * usleep_range(10, 20); } if (j =3D=3D timeout) { - pr_err("%s: timed out loading firmware.\n", driver_name); + dev_err(board->gpib_dev, "%s: timed out loading firmware.\n", driver_na= me); return -ETIMEDOUT; } writeb(firmware_data[i], a_priv->gpib_base + CONFIG_DATA_REG); @@ -591,10 +594,11 @@ static int init_82350a_hardware(gpib_board_t *board, = const gpib_board_config_t * usleep_range(10, 20); } if (j =3D=3D timeout) { - pr_err("%s: timed out waiting for firmware load to complete.\n", driver_= name); + dev_err(board->gpib_dev, "%s: timed out waiting for firmware load to com= plete.\n", + driver_name); return -ETIMEDOUT; } - pr_info("%s: ...done.\n", driver_name); + dev_info(board->gpib_dev, "%s: ...done.\n", driver_name); return 0; } =20 @@ -616,14 +620,15 @@ static int test_sram(gpib_board_t *board) unsigned int read_value =3D readb(a_priv->sram_base + i); =20 if ((i & byte_mask) !=3D read_value) { - pr_err("%s: SRAM test failed at %d wanted %d got %d\n", - driver_name, i, (i & byte_mask), read_value); + dev_err(board->gpib_dev, "%s: SRAM test failed at %d wanted %d got %d\n= ", + driver_name, i, (i & byte_mask), read_value); return -EIO; } if (need_resched()) schedule(); } - pr_info("%s: SRAM test passed 0x%x bytes checked\n", driver_name, sram_le= ngth); + dev_info(board->gpib_dev, "%s: SRAM test passed 0x%x bytes checked\n", + driver_name, sram_length); return 0; } =20 @@ -651,14 +656,14 @@ static int agilent_82350b_generic_attach(gpib_board_t= *board, const gpib_board_c PCI_DEVICE_ID_82350B, NULL); if (a_priv->pci_device) { a_priv->model =3D MODEL_82350B; - pr_info("%s: Agilent 82350B board found\n", driver_name); + dev_info(board->gpib_dev, "%s: Agilent 82350B board found\n", driver_nam= e); =20 } else { a_priv->pci_device =3D gpib_pci_get_device(config, PCI_VENDOR_ID_AGILENT, PCI_DEVICE_ID_82351A, NULL); if (a_priv->pci_device) { a_priv->model =3D MODEL_82351A; - pr_info("%s: Agilent 82351B board found\n", driver_name); + dev_info(board->gpib_dev, "%s: Agilent 82351B board found\n", driver_na= me); =20 } else { a_priv->pci_device =3D gpib_pci_get_subsys(config, PCI_VENDOR_ID_PLX, @@ -668,15 +673,17 @@ static int agilent_82350b_generic_attach(gpib_board_t= *board, const gpib_board_c a_priv->pci_device); if (a_priv->pci_device) { a_priv->model =3D MODEL_82350A; - pr_info("%s: HP/Agilent 82350A board found\n", driver_name); + dev_info(board->gpib_dev, "%s: HP/Agilent 82350A board found\n", + driver_name); } else { - pr_err("%s: no 82350/82351 board found\n", driver_name); + dev_err(board->gpib_dev, "%s: no 82350/82351 board found\n", + driver_name); return -ENODEV; } } } if (pci_enable_device(a_priv->pci_device)) { - pr_err("%s: error enabling pci device\n", driver_name); + dev_err(board->gpib_dev, "%s: error enabling pci device\n", driver_name); return -EIO; } if (pci_request_regions(a_priv->pci_device, driver_name)) @@ -685,23 +692,27 @@ static int agilent_82350b_generic_attach(gpib_board_t= *board, const gpib_board_c case MODEL_82350A: a_priv->plx_base =3D ioremap(pci_resource_start(a_priv->pci_device, PLX_= MEM_REGION), pci_resource_len(a_priv->pci_device, PLX_MEM_REGION)); - pr_info("%s: plx base address remapped to 0x%p\n", driver_name, a_priv->= plx_base); + dev_dbg(board->gpib_dev, "%s: plx base address remapped to 0x%p\n", + driver_name, a_priv->plx_base); a_priv->gpib_base =3D ioremap(pci_resource_start(a_priv->pci_device, GPIB_82350A_REGION), pci_resource_len(a_priv->pci_device, GPIB_82350A_REGION)); - pr_info("%s: gpib base address remapped to 0x%p\n", driver_name, a_priv-= >gpib_base); + dev_dbg(board->gpib_dev, "%s: gpib base address remapped to 0x%p\n", + driver_name, a_priv->gpib_base); tms_priv->iobase =3D a_priv->gpib_base + TMS9914_BASE_REG; a_priv->sram_base =3D ioremap(pci_resource_start(a_priv->pci_device, SRAM_82350A_REGION), pci_resource_len(a_priv->pci_device, SRAM_82350A_REGION)); - pr_info("%s: sram base address remapped to 0x%p\n", driver_name, a_priv-= >sram_base); + dev_dbg(board->gpib_dev, "%s: sram base address remapped to 0x%p\n", + driver_name, a_priv->sram_base); a_priv->borg_base =3D ioremap(pci_resource_start(a_priv->pci_device, BORG_82350A_REGION), pci_resource_len(a_priv->pci_device, BORG_82350A_REGION)); - pr_info("%s: borg base address remapped to 0x%p\n", driver_name, a_priv-= >borg_base); + dev_dbg(board->gpib_dev, "%s: borg base address remapped to 0x%p\n", + driver_name, a_priv->borg_base); =20 retval =3D init_82350a_hardware(board, config); if (retval < 0) @@ -711,14 +722,17 @@ static int agilent_82350b_generic_attach(gpib_board_t= *board, const gpib_board_c case MODEL_82351A: a_priv->gpib_base =3D ioremap(pci_resource_start(a_priv->pci_device, GPI= B_REGION), pci_resource_len(a_priv->pci_device, GPIB_REGION)); - pr_info("%s: gpib base address remapped to 0x%p\n", driver_name, a_priv-= >gpib_base); + dev_dbg(board->gpib_dev, "%s: gpib base address remapped to 0x%p\n", + driver_name, a_priv->gpib_base); tms_priv->iobase =3D a_priv->gpib_base + TMS9914_BASE_REG; a_priv->sram_base =3D ioremap(pci_resource_start(a_priv->pci_device, SRA= M_REGION), pci_resource_len(a_priv->pci_device, SRAM_REGION)); - pr_info("%s: sram base address remapped to 0x%p\n", driver_name, a_priv-= >sram_base); + dev_dbg(board->gpib_dev, "%s: sram base address remapped to 0x%p\n", + driver_name, a_priv->sram_base); a_priv->misc_base =3D ioremap(pci_resource_start(a_priv->pci_device, MIS= C_REGION), pci_resource_len(a_priv->pci_device, MISC_REGION)); - pr_info("%s: misc base address remapped to 0x%p\n", driver_name, a_priv-= >misc_base); + dev_dbg(board->gpib_dev, "%s: misc base address remapped to 0x%p\n", + driver_name, a_priv->misc_base); break; default: pr_err("%s: invalid board\n", driver_name); @@ -735,7 +749,7 @@ static int agilent_82350b_generic_attach(gpib_board_t *= board, const gpib_board_c return -EIO; } a_priv->irq =3D a_priv->pci_device->irq; - pr_info("%s: IRQ %d\n", driver_name, a_priv->irq); + dev_dbg(board->gpib_dev, "%s: IRQ %d\n", driver_name, a_priv->irq); =20 writeb(0, a_priv->gpib_base + SRAM_ACCESS_CONTROL_REG); a_priv->card_mode_bits =3D ENABLE_PCI_IRQ_BIT; --=20 2.46.2 From nobody Sun Nov 24 17:00:48 2024 Received: from mail-wm1-f51.google.com (mail-wm1-f51.google.com [209.85.128.51]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5B4A318D647 for ; Sun, 3 Nov 2024 21:26:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.51 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730669202; cv=none; b=tURwribnsTvGS5GRk8hGzL39duXOXZ8ecbKgGb8WzB6Qn/4GEvE63Qd9bdB8Q/12yYEdTnClsAo96kPE8cj6c0b7tuMQ02pkzmZz14ew8O7fVoIpWvP/oRAkQap5MuZyyRX03VVSARNb8NIucynVA1oR+XZZ9a8ETEAeUwbtwSQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730669202; c=relaxed/simple; bh=tBW3esnZSM+5l0zHXX9xuAZ8mT7/nVdsRIt94p77xvI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=eQSRTzYeGak6h3avoFppINZb++OU/cUrgiwjjwtMLkQw5tg84c0TyxT1uXjad78/vdfVTOjhC4ftEJf0iv1TefV/uM2Fbv9UJcJENg1rz1wWTi4EyGlUNLbxnXLhrzQFqsJH8zM2l9eBbEyjpTjZQ3CCeCtKIvBJHu2oprDnhck= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=gnoUU7/N; arc=none smtp.client-ip=209.85.128.51 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="gnoUU7/N" Received: by mail-wm1-f51.google.com with SMTP id 5b1f17b1804b1-43167ff0f91so31540925e9.1 for ; Sun, 03 Nov 2024 13:26:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1730669198; x=1731273998; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Hpb+hfuRWtk7Neut2FstHxoBo04AGr1EjSHYezAftH8=; b=gnoUU7/NfbT/4AHB9QqKOHOrOlMSVDYJSMxKI+UjM1RP7IPhA3oTCBX3BxeHYZqO9M E8nvO4RdchbOD9e+uuVeSFJcT0Y2icpXImLovDB2KfITSozLR9lpoCYVRJ4KGc30lrXd 32hzzg03otQZZkrehxyA7i4NrPNUFDWRUfaQGZYW7njdPxRDxSSmvpiTnlJwDpbGVTd1 xMRvBCpUzucvghWvCji1ay5udBQWoZD1jhQy3oC2hed+5nv16ZVhzW1vVbrtLBytkTd1 aEmi4N1N3DJ8w9b1MyIcGzvOUEvZgGxYtW/YzJUL3sHotnuUqpgfA4E56c5EnDcx1WWH twfw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730669198; x=1731273998; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Hpb+hfuRWtk7Neut2FstHxoBo04AGr1EjSHYezAftH8=; b=BAfPX0adsylxFnhLctcAkcbMYvZ1C6SumgK3+54xOYT/HBL1ag7fwEOMyah+zVvwGs CmnerknD6Run62LGQN7r8G/Glvg2RjWqDPqA0RlBNhcKzlCA5ITbSHqt0HcIS6SRqYRv xah3tyo3OlNbol1BSnTR2rxggFk6wJdcblSYheeEY8mai9IpnofnLkvrPu8rSZr+XVAi q5PsFoBiIygWZbpRsZX1lvGcIaUYhkp4C9Ufa08jXkeLZfzT5oFMIowiNie/ZVS6vwzG kdNwCXk79CmofWh4xPG9iMmAveJfvs0q98WCzG0i1zJaGFmcBv0IKvlQvhYQcVwl6whM UmtQ== X-Forwarded-Encrypted: i=1; AJvYcCW/2zPjeKeH2m9CPLwaxynD9vYAZcIQoDLNLZ4Bzq5+6NJ8zSt/Lrcua4P+XecQICIHogB0BdLU8U6T7CQ=@vger.kernel.org X-Gm-Message-State: AOJu0YzNejSPbZ8ccjAmPXGUcfm9l71Z5/P9k0kmNsw/GrjM0ltO1nbm Sp4RuZ3YqkCppT6CX2UJ1vEqf/CsqdfzGTZ2IonmNNhXfM12+I9bJ6S0XMdH X-Google-Smtp-Source: AGHT+IGy1u7BxCdxtmIXoJggKM8bEb/ymRcUNlSCICeYKE//ibdTFgU8yKXD//l/uwT+jh0+jmccWg== X-Received: by 2002:a5d:6d84:0:b0:37d:5129:f45e with SMTP id ffacd0b85a97d-381be7c8137mr12211534f8f.20.1730669197569; Sun, 03 Nov 2024 13:26:37 -0800 (PST) Received: from localhost.localdomain (82-64-73-52.subs.proxad.net. [82.64.73.52]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-431bd910718sm166150385e9.12.2024.11.03.13.26.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 03 Nov 2024 13:26:35 -0800 (PST) From: Dave Penkler To: gregkh@linuxfoundation.org, linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org Cc: skhan@linuxfoundation.org, arnd@arndb.de, dan.carpenter@linaro.org, Dave Penkler Subject: [PATCH 07/11] staging: gpib: Fix Kconfig Date: Sun, 3 Nov 2024 22:26:13 +0100 Message-ID: <20241103212617.13076-8-dpenkler@gmail.com> X-Mailer: git-send-email 2.46.2 In-Reply-To: <20241103212617.13076-1-dpenkler@gmail.com> References: <20241103212617.13076-1-dpenkler@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" The NI_PCI_ISA driver also supports PCI and PCMCIA Correct spelling error COMPIlE_TEST Fixes: 2c9f5d8c6ece ("staging: gpib: add bus specific Kconfig dependencies") Signed-off-by: Dave Penkler --- drivers/staging/gpib/Kconfig | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/gpib/Kconfig b/drivers/staging/gpib/Kconfig index 0ea9a276c389..95308d15a555 100644 --- a/drivers/staging/gpib/Kconfig +++ b/drivers/staging/gpib/Kconfig @@ -61,7 +61,7 @@ config GPIB_CEC_PCI =20 config GPIB_NI_PCI_ISA tristate "NI PCI/ISA compatible boards" - depends on ISA_BUS + depends on ISA_BUS || PCI || PCMCIA select GPIB_COMMON select GPIB_NEC7210 help @@ -138,7 +138,7 @@ config GPIB_FMH =20 config GPIB_GPIO tristate "RPi GPIO bitbang" - depends on ARCH_BCM2835 || COMPIlE_TEST + depends on ARCH_BCM2835 || COMPILE_TEST select GPIB_COMMON help GPIB bitbang driver Raspberry Pi GPIO adapters --=20 2.46.2 From nobody Sun Nov 24 17:00:48 2024 Received: from mail-wm1-f44.google.com (mail-wm1-f44.google.com [209.85.128.44]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5BC7B18E356 for ; Sun, 3 Nov 2024 21:26:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.44 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730669203; cv=none; b=rHXWLTYTTGe4nS8wDIca0jMpNE1lh5pWShs6cio/KSsLOubLFtRPatIpmwiTL+AsT2u5MAs1+CTuMYN6g9SVmfb0z+Tl6L8ZN1WMe6ifbbAu3cpMLEoo+X5Pmk7bKF/3AdreExzVHyalPAF5fch15V4LQZJsXASzj67xD/VOdvw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730669203; c=relaxed/simple; bh=pLnkhpeYKMc1lxFV3xV4m3dNh7n0yiuHjAX660xk0n8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=JuXxcJ82a/l+slBkcqgAxUmBM/XTT903GNUuA4Kcx1KedmtEthdAFXGxUyYeFNzJTth5B5sSjkJQYfRtK1JSZqRD3qnoc6M8zcPHctAU41kFgo5iZdf/QBGulBm3bZ+Mtp8sriIKxJHRdPdD3IjLeNxClTMvmWVuqnTKrwnEooQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=JoHKvCxX; arc=none smtp.client-ip=209.85.128.44 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="JoHKvCxX" Received: by mail-wm1-f44.google.com with SMTP id 5b1f17b1804b1-4314c452180so26962435e9.0 for ; Sun, 03 Nov 2024 13:26:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1730669200; x=1731274000; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=U4LeEghsieJmKHP01xof54mT4MI7YKin+O0LeMS7tsE=; b=JoHKvCxXoUZz8306YO0008iwlwVt5dXWOZi8fge9uXHhrW7ZpqDL6IbhatzrUhS1XG v3MJMNgLV4OA6D8J0aRIak81etLVB3SdfxJxd5z9xFCNMxPR9avLRPfr5IuGzu/fFN+9 nt8HHrxcx3GmqQZWaapU3FOUxiIZGzRv7zmxO4pDMrP3oFLw1vLAYHfOdYyZHkX4yee/ kM2qta+FRCosEXVLT0Qjug2FCfegp4NlpnqKM/TICFiOedN+u4DanWd5s6tbUqdmrij4 PEydd2ehHv8xdnuHdQ9lH6cklk2P6yDwmoD+n9vvgqClEOlFolIwV6gDUkiizRpCPq5T uTGA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730669200; x=1731274000; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=U4LeEghsieJmKHP01xof54mT4MI7YKin+O0LeMS7tsE=; b=rOXvAFxUX5CA9H/rtmKnITuKFRBUe1S620uzks9lNWn88TH07/E3ugZAzkj9nWN/bI eLK/Ihpa/7lUo0M4Tgsdk0w2CvOXJ8+QmLZcTJRLq6OYIuVcej6QTsOt2nlbMHcAc7/J EeYmBt8kl5ukaWo0t8Av/GMUCHLIM4OHb/Yd72Sd//NYiospHHKhkLK7SQcZYpG/8hM/ UpYIs/qobfstBQuQiUpATyyDt35A5V+s00wV1qeQHPQ42iZO1rmRdpIX9eNJj6wMX6Mn 1J8qQTTyLVKRhxo/MJzTq8ft9FsO6C0A1dd58miR5ujvfs510ye40B+vKlIVI0w51Pi2 Cr2g== X-Forwarded-Encrypted: i=1; AJvYcCX7xb8AyLI5ICVCIxDrFNyp8TgspqZR/a6VnNhx/9HtVkMEIWvuP3aPJKdA0sh67mpS2p8NOXHtMGWLPYc=@vger.kernel.org X-Gm-Message-State: AOJu0YzrDBwRdVXHN+KRzZH/rGSQvwDPLv2KpdOqYTbR2MtzkIXBx3Ma dYaOQAj6uKLfnDiI8ennRJBk/unpGOZoJEVRPGbFBHcKklB4hnYP X-Google-Smtp-Source: AGHT+IGCfoYcl/WTaMgKFNtbr1A1yYIsaop2G+srrkYcg7Rm1TPsNrDpmn2KsdRG4SdPzS+P/PuuhQ== X-Received: by 2002:a05:600c:3549:b0:431:416e:2603 with SMTP id 5b1f17b1804b1-43282fe1df2mr79967675e9.3.1730669199664; Sun, 03 Nov 2024 13:26:39 -0800 (PST) Received: from localhost.localdomain (82-64-73-52.subs.proxad.net. [82.64.73.52]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-431bd910718sm166150385e9.12.2024.11.03.13.26.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 03 Nov 2024 13:26:38 -0800 (PST) From: Dave Penkler To: gregkh@linuxfoundation.org, linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org Cc: skhan@linuxfoundation.org, arnd@arndb.de, dan.carpenter@linaro.org, Dave Penkler Subject: [PATCH 08/11] staging: gpib: Remove unneeded lookup table Date: Sun, 3 Nov 2024 22:26:14 +0100 Message-ID: <20241103212617.13076-9-dpenkler@gmail.com> X-Mailer: git-send-email 2.46.2 In-Reply-To: <20241103212617.13076-1-dpenkler@gmail.com> References: <20241103212617.13076-1-dpenkler@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Remove bcm2837 table as the only difference is GPIO14 and GPIO15 which are not used with the current pin maps. Signed-off-by: Dave Penkler --- drivers/staging/gpib/gpio/gpib_bitbang.c | 33 ------------------------ 1 file changed, 33 deletions(-) diff --git a/drivers/staging/gpib/gpio/gpib_bitbang.c b/drivers/staging/gpi= b/gpio/gpib_bitbang.c index 8c03e91c01dc..fc8502379c28 100644 --- a/drivers/staging/gpib/gpio/gpib_bitbang.c +++ b/drivers/staging/gpib/gpio/gpib_bitbang.c @@ -234,38 +234,6 @@ static struct gpiod_lookup_table gpib_gpio_table_0 =3D= { }, }; =20 -static struct gpiod_lookup_table gpib_gpio_table_1 =3D { - .dev_id =3D "", // device id of board device - .table =3D { - // for bcm2837 based pis (3a+ 3b 3b+ ) - GPIO_LOOKUP_IDX("GPIO_GCLK", U16_MAX, NULL, 4, GPIO_ACTIVE_HIGH), - GPIO_LOOKUP_IDX("GPIO5", U16_MAX, NULL, 5, GPIO_ACTIVE_HIGH), - GPIO_LOOKUP_IDX("GPIO6", U16_MAX, NULL, 6, GPIO_ACTIVE_HIGH), - GPIO_LOOKUP_IDX("SPI_CE1_N", U16_MAX, NULL, 7, GPIO_ACTIVE_HIGH), - GPIO_LOOKUP_IDX("SPI_CE0_N", U16_MAX, NULL, 8, GPIO_ACTIVE_HIGH), - GPIO_LOOKUP_IDX("SPI_MISO", U16_MAX, NULL, 9, GPIO_ACTIVE_HIGH), - GPIO_LOOKUP_IDX("SPI_MOSI", U16_MAX, NULL, 10, GPIO_ACTIVE_HIGH), - GPIO_LOOKUP_IDX("SPI_SCLK", U16_MAX, NULL, 11, GPIO_ACTIVE_HIGH), - GPIO_LOOKUP_IDX("GPIO12", U16_MAX, NULL, 12, GPIO_ACTIVE_HIGH), - GPIO_LOOKUP_IDX("GPIO13", U16_MAX, NULL, 13, GPIO_ACTIVE_HIGH), - GPIO_LOOKUP_IDX("TXD1", U16_MAX, NULL, 14, GPIO_ACTIVE_HIGH), - GPIO_LOOKUP_IDX("RXD1", U16_MAX, NULL, 15, GPIO_ACTIVE_HIGH), - GPIO_LOOKUP_IDX("GPIO16", U16_MAX, NULL, 16, GPIO_ACTIVE_HIGH), - GPIO_LOOKUP_IDX("GPIO17", U16_MAX, NULL, 17, GPIO_ACTIVE_HIGH), - GPIO_LOOKUP_IDX("GPIO18", U16_MAX, NULL, 18, GPIO_ACTIVE_HIGH), - GPIO_LOOKUP_IDX("GPIO19", U16_MAX, NULL, 19, GPIO_ACTIVE_HIGH), - GPIO_LOOKUP_IDX("GPIO20", U16_MAX, NULL, 20, GPIO_ACTIVE_HIGH), - GPIO_LOOKUP_IDX("GPIO21", U16_MAX, NULL, 21, GPIO_ACTIVE_HIGH), - GPIO_LOOKUP_IDX("GPIO22", U16_MAX, NULL, 22, GPIO_ACTIVE_HIGH), - GPIO_LOOKUP_IDX("GPIO23", U16_MAX, NULL, 23, GPIO_ACTIVE_HIGH), - GPIO_LOOKUP_IDX("GPIO24", U16_MAX, NULL, 24, GPIO_ACTIVE_HIGH), - GPIO_LOOKUP_IDX("GPIO25", U16_MAX, NULL, 25, GPIO_ACTIVE_HIGH), - GPIO_LOOKUP_IDX("GPIO26", U16_MAX, NULL, 26, GPIO_ACTIVE_HIGH), - GPIO_LOOKUP_IDX("GPIO27", U16_MAX, NULL, 27, GPIO_ACTIVE_HIGH), - { } - }, -}; - static struct gpiod_lookup_table gpib_gpio_table_2 =3D { .dev_id =3D "", // device id of board device .table =3D { @@ -300,7 +268,6 @@ static struct gpiod_lookup_table gpib_gpio_table_2 =3D { =20 static struct gpiod_lookup_table *lookup_tables[] =3D { &gpib_gpio_table_0, - &gpib_gpio_table_1, &gpib_gpio_table_2, 0 }; --=20 2.46.2 From nobody Sun Nov 24 17:00:48 2024 Received: from mail-wm1-f54.google.com (mail-wm1-f54.google.com [209.85.128.54]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C10E0192595 for ; Sun, 3 Nov 2024 21:26:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.54 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730669204; cv=none; b=EsNqXHpbbS8T6x9sYvwiUM9crInuC4zEuypv+Z+VCqaqL966LHM2L7wNgt56joWYGFvnF57cCRp2Gzb5zUXlGg7U1/6FOI5d9OXGxx9XlvMDT3OdOgSW3SZH3GCCiM5n5bsZCs7q/G2cPe3bwVjJHdfsqpzt0Z2WneUOM1hC19E= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730669204; c=relaxed/simple; bh=8gIEE5erXu36bvNvc+z4d5bEU5WInaaHUZh7cwyNQlM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=E0ELiWVZ8mYclDBoX6XRZm93TDEHDK7W+vOgcugIspj0UjDf9041md04Ig3w+lKbwAHF/jJ0sHHgQ6abEjUCuhExMPL38d+2qYgdXb99XjKthzA/9PLFIFPgRBGbUqUV4eUS20qYAFFKE4+jjutYOVIgFWp+OwyFm/XDTAOuJF8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=W4SrgUmj; arc=none smtp.client-ip=209.85.128.54 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="W4SrgUmj" Received: by mail-wm1-f54.google.com with SMTP id 5b1f17b1804b1-43168d9c6c9so29213745e9.3 for ; Sun, 03 Nov 2024 13:26:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1730669201; x=1731274001; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=wYNa6oziVbKvDXACDgmoC/if6wLv2o++lD6SKYvehsE=; b=W4SrgUmjsaNc3syAbV9BSWUt4haKtPC/YgTD2lhPEfQRQ1B3By+lbXJJcUKVlhQW6j pI026k52zdnw1gfXemxBooQ70QKePXTL4Hps5+pOVODwZEQLv4V7pun34X/oA/J4fGhg Gttarhw/wiYuU53JZWcVsXyGHWIovvxjfgkqJHUhxE+bTovujeajQHTutZyEJjLTfDJG 6Dxieez9NeipqoOkOSa3zogd79b56TKIXNjNcdQZvTqZSW++ROsBuzET56Nw2nHUh+R2 iAnVyeNsWHc/dyEpWfzOW1VcurH51tk44u4znW/DSo6OUcL+r1mWwKTb2Qkdz7uZ65WY 7Y4Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730669201; x=1731274001; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=wYNa6oziVbKvDXACDgmoC/if6wLv2o++lD6SKYvehsE=; b=pvlk7PlgJIADbM8WwTd7BOHlP23wgksuZl87/XfFCRl/fJsfPsnMlYAuOi4nZQzDkd PtEko1Pzhdt1x27LKSXJohps3dIihXMyjEWuigfGU9qvBBH362oJuDIXstiyQYHTbgVi nKKhdolEPtZ9Y7l/UV3hPPnzqcHaXrX3xKL5gaE/oymXcNEyyAQE32Azuf/pLlG0Lg4V PQHqvxJ0YEowhIj9bGMcCaULMw/zB0cecZgOkB88XyRxZX/13G6T6zO40Xq2Z+WllffJ d37eESzHzDfeFmGraIdcZyLVNiVI8unSpk+QOiAVZXW7pESbQMeaTxJ074pwRHcEg9W2 Z/3Q== X-Forwarded-Encrypted: i=1; AJvYcCU31OQhi/sGRrWeqXMZ31OP/6+J2kMTVAbJNHQQxnf0Yd5sWxw6c/8mcLYH08p8dWuX5usPg/v4c/TQTnU=@vger.kernel.org X-Gm-Message-State: AOJu0Yy/W+IBoFXB2VZ0jNbxqmpAclzYpctxXjTNA7EOFuQPMmPHriTE mFZhKvPDwTz0XNoFkFIz/yDMJhSfYCOS+wZr/6IU127CDCxud1p5 X-Google-Smtp-Source: AGHT+IHb3YtEMHY1k6tmQKANEvYPRbKK2yHTsy4WyjwdvdVI0PZbmxznTKoqhcHA21dXqtRaUQHOrA== X-Received: by 2002:a05:600c:4e8e:b0:42c:b45d:4a7b with SMTP id 5b1f17b1804b1-4319ad146ebmr272532335e9.25.1730669201064; Sun, 03 Nov 2024 13:26:41 -0800 (PST) Received: from localhost.localdomain (82-64-73-52.subs.proxad.net. [82.64.73.52]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-431bd910718sm166150385e9.12.2024.11.03.13.26.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 03 Nov 2024 13:26:40 -0800 (PST) From: Dave Penkler To: gregkh@linuxfoundation.org, linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org Cc: skhan@linuxfoundation.org, arnd@arndb.de, dan.carpenter@linaro.org, Dave Penkler Subject: [PATCH 09/11] staging: gpib: Remove GPIO14 and GPIO15 lines in lookup tables Date: Sun, 3 Nov 2024 22:26:15 +0100 Message-ID: <20241103212617.13076-10-dpenkler@gmail.com> X-Mailer: git-send-email 2.46.2 In-Reply-To: <20241103212617.13076-1-dpenkler@gmail.com> References: <20241103212617.13076-1-dpenkler@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" GPIO14 and GPIO15 are not used in the current pin maps Signed-off-by: Dave Penkler --- drivers/staging/gpib/gpio/gpib_bitbang.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/drivers/staging/gpib/gpio/gpib_bitbang.c b/drivers/staging/gpi= b/gpio/gpib_bitbang.c index fc8502379c28..78032af5061c 100644 --- a/drivers/staging/gpib/gpio/gpib_bitbang.c +++ b/drivers/staging/gpib/gpio/gpib_bitbang.c @@ -216,8 +216,6 @@ static struct gpiod_lookup_table gpib_gpio_table_0 =3D { GPIO_LOOKUP_IDX("SPI_SCLK", U16_MAX, NULL, 11, GPIO_ACTIVE_HIGH), GPIO_LOOKUP_IDX("GPIO12", U16_MAX, NULL, 12, GPIO_ACTIVE_HIGH), GPIO_LOOKUP_IDX("GPIO13", U16_MAX, NULL, 13, GPIO_ACTIVE_HIGH), - GPIO_LOOKUP_IDX("TXD0", U16_MAX, NULL, 14, GPIO_ACTIVE_HIGH), - GPIO_LOOKUP_IDX("RXD0", U16_MAX, NULL, 15, GPIO_ACTIVE_HIGH), GPIO_LOOKUP_IDX("GPIO16", U16_MAX, NULL, 16, GPIO_ACTIVE_HIGH), GPIO_LOOKUP_IDX("GPIO17", U16_MAX, NULL, 17, GPIO_ACTIVE_HIGH), GPIO_LOOKUP_IDX("GPIO18", U16_MAX, NULL, 18, GPIO_ACTIVE_HIGH), @@ -248,8 +246,6 @@ static struct gpiod_lookup_table gpib_gpio_table_2 =3D { GPIO_LOOKUP_IDX("GPIO11", U16_MAX, NULL, 11, GPIO_ACTIVE_HIGH), GPIO_LOOKUP_IDX("GPIO12", U16_MAX, NULL, 12, GPIO_ACTIVE_HIGH), GPIO_LOOKUP_IDX("GPIO13", U16_MAX, NULL, 13, GPIO_ACTIVE_HIGH), - GPIO_LOOKUP_IDX("GPIO14", U16_MAX, NULL, 14, GPIO_ACTIVE_HIGH), - GPIO_LOOKUP_IDX("GPIO15", U16_MAX, NULL, 15, GPIO_ACTIVE_HIGH), GPIO_LOOKUP_IDX("GPIO16", U16_MAX, NULL, 16, GPIO_ACTIVE_HIGH), GPIO_LOOKUP_IDX("GPIO17", U16_MAX, NULL, 17, GPIO_ACTIVE_HIGH), GPIO_LOOKUP_IDX("GPIO18", U16_MAX, NULL, 18, GPIO_ACTIVE_HIGH), --=20 2.46.2 From nobody Sun Nov 24 17:00:48 2024 Received: from mail-wm1-f44.google.com (mail-wm1-f44.google.com [209.85.128.44]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2A913199948 for ; Sun, 3 Nov 2024 21:26:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.44 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730669206; cv=none; b=AkChAlN2FTyzuurWN6xwd/iWgPQxK52lpp5ZB/hfkCeOhaPRRWym7p75HSG6wI6O6TpmviX8xKLYUjZa3qtnhvq3cF/M3nUAIGw37HOLYbZMfvd3DI38lsH681bLnry5s+L0ldI4wQO7wYveqjFlsbBvNZja/UHR9qgi/iXbYS8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730669206; c=relaxed/simple; bh=V4P0B2EgUQLw86NKiUCzY+oZ2ZLOhwnaId7lph2qPcM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=PlWwkXWgQBc7c2ZrIkfYnurzFwLXwIzOOmnC+jkTC3OQO0HsIOkeDWkVzu2UCm4loQVeoginFlayS1jOunpqIokfDJhTOVmQPMU3b/Jzg98AU+P1/9NPNrNkWg9e/26QtD4dqcs2vURhyemBV1QzHnhvWCybNHJ987Jlnsw6iAU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=m/R3ZgZ4; arc=none smtp.client-ip=209.85.128.44 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="m/R3ZgZ4" Received: by mail-wm1-f44.google.com with SMTP id 5b1f17b1804b1-4316e9f4a40so29228585e9.2 for ; Sun, 03 Nov 2024 13:26:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1730669203; x=1731274003; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=jHXAdcTsvT4B5g/S/kETasZjOIWl5qfipOtLsGqLhtk=; b=m/R3ZgZ453mkVctGoqHHS4UE7o6LQDbBzqSq7Cr+m4QcAg3SzI53t9WAsk45Ptk1hW YP4rJtwEu5lT00JXxfD2yqwMwxQ8Q4zALiTBnv3ku6qfk2SutTlQZd1ptKhrwe1XDI88 0HmdPecQiieDHn1pseC9lYkLsE/+MIUMq7laCwlmQaXdLyJoj2zz+Bw28kyvLXtMDyHH +ZVZSeXQG4CLwarqACcLP4CNy0MUi1nmRKG/2lXbiGbCW0WDlHpLn8Gmf+ez1CCJrwGq Ba3eoMcziYzXlu7X9TNE1mDpncJC0+3ws6trnFgTNtovrOTR9n0yZhqNsmZV5j7/9aRJ 9ZHw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730669203; x=1731274003; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=jHXAdcTsvT4B5g/S/kETasZjOIWl5qfipOtLsGqLhtk=; b=lWQww+2jQI2N0KhjeKkrdohk4tzrKPfnxAbzneAvXSR7NV+9v0kw0ELDoNaeMQ7RfZ PHQRB6AxwhI6lpv+tTbvkXzalnQWgZgIEl30ZPnivNnlHX30ivxeJNZvKGHw4sPdvj++ UnCA82xBdQ5PU9Ieo2n17LUbrvnWDPp8lA060Hzd9abfz9Nsyzk6E/d7E4CV2NA0+jdo B3UF8ZN4xTt4QrA4f0SNDAzftfOdqSnBYV1PDRKSUiwByH7ZPoI4XaSixj/zI/qRUHxa 3GEA3PgfGlggTLD8QgxbwWuOt2GrpXC15fusDfgAZoRVB1T5E8ghBisXcxz1+FRY7+8S 9lag== X-Forwarded-Encrypted: i=1; AJvYcCW74HMmaUSYa+4j26YmAM2oF15jw41kOiKSkc60sJFerVX5by1h9lLpqu1I24T/Hv/EFaqWgp+lzcyLRjQ=@vger.kernel.org X-Gm-Message-State: AOJu0YwKe1pLdTC3VezJ8NwNk70Y3CjPsJrWkkB/6dEsaOGtbW2skUP5 8VJ9rTxw58Fl6KqOnTcd5rW4zercR4QglWchGLD8byYp8Ha/oUJ0ho+FiQaV X-Google-Smtp-Source: AGHT+IFMGDx9DOAYBdrUFd8VOS4PJJ1EbDKfLHz3JNBUH9jucFE0Ec58+yoNuW2fUZV+sMk/RYEniA== X-Received: by 2002:a05:600c:3c8c:b0:431:4fa0:2e0b with SMTP id 5b1f17b1804b1-4319ad146b1mr241501305e9.28.1730669203384; Sun, 03 Nov 2024 13:26:43 -0800 (PST) Received: from localhost.localdomain (82-64-73-52.subs.proxad.net. [82.64.73.52]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-431bd910718sm166150385e9.12.2024.11.03.13.26.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 03 Nov 2024 13:26:42 -0800 (PST) From: Dave Penkler To: gregkh@linuxfoundation.org, linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org Cc: skhan@linuxfoundation.org, arnd@arndb.de, dan.carpenter@linaro.org, Dave Penkler Subject: [PATCH 10/11] staging: gpib: Re-order the lookup tables Date: Sun, 3 Nov 2024 22:26:16 +0100 Message-ID: <20241103212617.13076-11-dpenkler@gmail.com> X-Mailer: git-send-email 2.46.2 In-Reply-To: <20241103212617.13076-1-dpenkler@gmail.com> References: <20241103212617.13076-1-dpenkler@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Re-order the tables so that the bcm27xx table is used first as these devices are more popular and numerous than the older ones. Signed-off-by: Dave Penkler --- drivers/staging/gpib/gpio/gpib_bitbang.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/staging/gpib/gpio/gpib_bitbang.c b/drivers/staging/gpi= b/gpio/gpib_bitbang.c index 78032af5061c..a2d562cbd65b 100644 --- a/drivers/staging/gpib/gpio/gpib_bitbang.c +++ b/drivers/staging/gpib/gpio/gpib_bitbang.c @@ -202,7 +202,7 @@ int gpios_vector[] =3D { =20 /* Lookup table for general GPIOs */ =20 -static struct gpiod_lookup_table gpib_gpio_table_0 =3D { +static struct gpiod_lookup_table gpib_gpio_table_1 =3D { // for bcm2835/6 .dev_id =3D "", // device id of board device .table =3D { @@ -232,7 +232,7 @@ static struct gpiod_lookup_table gpib_gpio_table_0 =3D { }, }; =20 -static struct gpiod_lookup_table gpib_gpio_table_2 =3D { +static struct gpiod_lookup_table gpib_gpio_table_0 =3D { .dev_id =3D "", // device id of board device .table =3D { // for bcm27xx based pis (b b+ 2b 3b 3b+ 4 5) @@ -264,7 +264,7 @@ static struct gpiod_lookup_table gpib_gpio_table_2 =3D { =20 static struct gpiod_lookup_table *lookup_tables[] =3D { &gpib_gpio_table_0, - &gpib_gpio_table_2, + &gpib_gpio_table_1, 0 }; =20 --=20 2.46.2 From nobody Sun Nov 24 17:00:48 2024 Received: from mail-wm1-f47.google.com (mail-wm1-f47.google.com [209.85.128.47]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6E0E41A7AE3 for ; Sun, 3 Nov 2024 21:26:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.47 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730669209; cv=none; b=ZWmNeQ9lcwsfnanCo0TjvXdFWbK/yO2crUhKoA2dy35ueoOKk4T+Jr+Nw9n/ouk7g0M/R8jalqK3JlmfM1Excl3mUFhVqqIsftQVDBmWpDiGxRBt5xa7CCceCfIADmeIMz9ufpEZm9bdghXmIc4k3wm7L7HrPUd1lRpVVqeaFEU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730669209; c=relaxed/simple; bh=30iOY8pk90Mkg1P3Owc8Rv0t3FI95lCg1fjDGL8TU0Y=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=cfpQGni35q8pCA0bAvdNiseuUzV//dMd0FQY7Wh/r6QfsTBic5b8P1gc3/UbZnN5yjlBdab/ZHwr/5Cf9r12VuRlcMsPSef/Me8Jla6dt6S/NaPceLKRJ7b/R4bExYHncp55+O3LRrzg434xAJjNYdRNyuBbQaErku7iYUnNCXY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=QMBh6YRl; arc=none smtp.client-ip=209.85.128.47 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="QMBh6YRl" Received: by mail-wm1-f47.google.com with SMTP id 5b1f17b1804b1-43167ff0f91so31541495e9.1 for ; Sun, 03 Nov 2024 13:26:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1730669206; x=1731274006; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=FqBXKF1R/xvCMIz/yq7u82w7wzd3NP6sTl+H7HvVaBA=; b=QMBh6YRlw5yH9EiW8hYRgsz8HQSrzbWMI85tkRWzqHOQYCjorSu3ufKTRff4I5XIvU +hgB3Huu3grbp46U1Qa8eX/9w+wf++D0jcn3JU1fI3Fat65B6xg1XD3obOBELoH4SjOm Rdmtdf0FwiYU6soF2EG1oNynrIn9YHSjEe81ThVkaiurVQWs2Vz3I7sYrCeAu6Pvtm7X 4PGJA5zQSxrR4PjEHMbLsYbxEwhDRtJgOHPhYPp2oBl/rQhrdGVXf802Mt50bwwKXb+G N01locBT/r3mC8WEk/UKtngi3Fxx+fTK7nFU4xlWyMN8eN6+Q7lhuJBxOHHVvXm6DhLo 6hDw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730669206; x=1731274006; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=FqBXKF1R/xvCMIz/yq7u82w7wzd3NP6sTl+H7HvVaBA=; b=m31EtuLjbyvoWpmfG1YZpx4Dh3NwKVH19/xA3Kr8hY7ORsOWhRZCFzCkWXgHz3fuzO KWAbzxuH93cdDP+SAcjFi+0pGDBo2rxnXnuG8e1V9ebHJZolld+04RDkfbSJA5sHwxlE AoLhbqt2a0xkHgPe9AJm23cbpDCPXUHfWG3HD2CclIyT03fB26cbleOiisoqDAViN3RN wgabTioxGm322acsb5LtUrDZqfaLEFgwGcvQWu3gU8deRK6z2vzJeiWYWsdu1wKjWYK3 ACsGZKYyKJSGaJJ46Wv2OZxfedHMJddElSh0EO/g8/xtmD13Y+Cz/Spx8zOYrAXjAM6p VaMQ== X-Forwarded-Encrypted: i=1; AJvYcCWcB7J1wM6qwvMJ2hl0g9UHJTkSmAVsEVyhYc2mVq9rvnl1qJwsC9S+SunTIrZVWhISa0uc394CHf3BtEk=@vger.kernel.org X-Gm-Message-State: AOJu0Yzei3zIxUMdvOX7rcD95+zo/DVTRLvuOpjQQKRbp1bvCGrAoRDL X2Y7htxSm6/OaTz2OMwWbki0Ke3V7yvm7CFhGR98cXZySB/N5CHU X-Google-Smtp-Source: AGHT+IHC3CcsBdgIYL8zNBp6LoDVitIvPZK1ghXQGkZE9j+h2UaZlRuaPPhxVjULi/irhMkxC0ZVHw== X-Received: by 2002:a05:6000:1867:b0:37d:4d80:34ae with SMTP id ffacd0b85a97d-381be7adff4mr11841424f8f.4.1730669205634; Sun, 03 Nov 2024 13:26:45 -0800 (PST) Received: from localhost.localdomain (82-64-73-52.subs.proxad.net. [82.64.73.52]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-431bd910718sm166150385e9.12.2024.11.03.13.26.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 03 Nov 2024 13:26:43 -0800 (PST) From: Dave Penkler To: gregkh@linuxfoundation.org, linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org Cc: skhan@linuxfoundation.org, arnd@arndb.de, dan.carpenter@linaro.org, Dave Penkler Subject: [PATCH 11/11] staging: gpib: Correct check for max secondary address Date: Sun, 3 Nov 2024 22:26:17 +0100 Message-ID: <20241103212617.13076-12-dpenkler@gmail.com> X-Mailer: git-send-email 2.46.2 In-Reply-To: <20241103212617.13076-1-dpenkler@gmail.com> References: <20241103212617.13076-1-dpenkler@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" GPIB secondary addresses can be between 0 and 31 inclusive unlike primary addresses where address 31 is not a valid device address. When 31 is used as a primary talk address it forms the UNT (Untalk) command and when used as a listener address it forms the UNL (Unlisten) commmand. The library was incorrectly not allowing a secondary address with a value of 31 to be used. Signed-off-by: Dave Penkler --- drivers/staging/gpib/common/gpib_os.c | 4 +--- drivers/staging/gpib/common/iblib.c | 6 +++--- drivers/staging/gpib/common/ibsys.h | 3 +++ 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/drivers/staging/gpib/common/gpib_os.c b/drivers/staging/gpib/c= ommon/gpib_os.c index e84097ac8f69..0285180ae1f0 100644 --- a/drivers/staging/gpib/common/gpib_os.c +++ b/drivers/staging/gpib/common/gpib_os.c @@ -525,8 +525,6 @@ int serial_poll_all(gpib_board_t *board, unsigned int u= sec_timeout) * SPD and UNT are sent at the completion of the poll. */ =20 -static const int gpib_addr_max =3D 30; /* max address for primary/secondar= y gpib addresses */ - int dvrsp(gpib_board_t *board, unsigned int pad, int sad, unsigned int usec_timeout, uint8_t *result) { @@ -538,7 +536,7 @@ int dvrsp(gpib_board_t *board, unsigned int pad, int sa= d, return -1; } =20 - if (pad > gpib_addr_max || sad > gpib_addr_max) { + if (pad > MAX_GPIB_PRIMARY_ADDRESS || sad > MAX_GPIB_SECONDARY_ADDRESS) { pr_err("gpib: bad address for serial poll"); return -1; } diff --git a/drivers/staging/gpib/common/iblib.c b/drivers/staging/gpib/com= mon/iblib.c index fc57e760c144..db1911cc1b26 100644 --- a/drivers/staging/gpib/common/iblib.c +++ b/drivers/staging/gpib/common/iblib.c @@ -479,7 +479,7 @@ int ibsre(gpib_board_t *board, int enable) */ int ibpad(gpib_board_t *board, unsigned int addr) { - if (addr > 30) { + if (addr > MAX_GPIB_PRIMARY_ADDRESS) { pr_err("gpib: invalid primary address %u\n", addr); return -1; } @@ -498,8 +498,8 @@ int ibpad(gpib_board_t *board, unsigned int addr) */ int ibsad(gpib_board_t *board, int addr) { - if (addr > 30) { - pr_err("gpib: invalid secondary address %i, must be 0-30\n", addr); + if (addr > MAX_GPIB_SECONDARY_ADDRESS) { + pr_err("gpib: invalid secondary address %i\n", addr); return -1; } board->sad =3D addr; diff --git a/drivers/staging/gpib/common/ibsys.h b/drivers/staging/gpib/com= mon/ibsys.h index b78ca5ea4da1..da20971e9c7e 100644 --- a/drivers/staging/gpib/common/ibsys.h +++ b/drivers/staging/gpib/common/ibsys.h @@ -16,6 +16,9 @@ #include #include =20 +#define MAX_GPIB_PRIMARY_ADDRESS 30 +#define MAX_GPIB_SECONDARY_ADDRESS 31 + int gpib_allocate_board(gpib_board_t *board); void gpib_deallocate_board(gpib_board_t *board); =20 --=20 2.46.2