From nobody Sun Nov 24 20:32:09 2024 Received: from mail-wm1-f41.google.com (mail-wm1-f41.google.com [209.85.128.41]) (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 9D80E1CB321 for ; Fri, 1 Nov 2024 17:47:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.41 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730483265; cv=none; b=f4IOItmkONTDk37H2EADyib1slVX2ocRWgpTmEfEm3zYKB6Y89c1LTno4iY9GNkc+6csY1d3TtlhRLvZ4LKERcUUn0Z7i2LTB1XU5rXrZb70Q6OGKallFa6zH7qUjEXbD61gNrhL09UeQpfAGxF5zVrnZJjCQ7PHqlYYLxk8xrQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730483265; c=relaxed/simple; bh=KxFLCYeLJza2wbtJq3ncvPACnBNOfSsUAesffJ457fo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=E5CUubEMTCSnfw6zf4b/fZzuFkvAw+dB2xCIlCIn0idqpkH8sMnKMiDfDZJPSt5poUVWcQuvtG+KEaNLeSxbPudrgBEV15sRL4FTjwegJtcAEp5MLQ4axipx2kBtm5nK4m6MBYKs7+EYvprPhbxr/0yGCmykwLWEs7B4qgx0nAo= 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=eEF6wGc5; arc=none smtp.client-ip=209.85.128.41 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="eEF6wGc5" Received: by mail-wm1-f41.google.com with SMTP id 5b1f17b1804b1-4319399a411so18881915e9.2 for ; Fri, 01 Nov 2024 10:47:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1730483262; x=1731088062; 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=GaiHnwo8DRW+cYed7a1HEMqLUzjFX++R0qMPfhF5vLM=; b=eEF6wGc5l/0SgdAylSGABCl+RW7bUy6jIvAcHdtLl42Q7/ECrgFKjLIxMW+fYcpBiN d0myHejhPXYWALkuserwsoNX4656hEDsmHsvOPbjs8FriJDY6dfHNU9RARrbDVzqYpc3 fHPltWtfJ8A7aDWGI3F3j2NrbHDs5yTusH0Xr8jv3fiGwl1NQMnmcFVBPo9OpLq8gPkn k3g9HgbrOTYqnmjSk/DrJsIrpbmtvymvsEpQcJULMJa+xYEPd4YVQXtnvgBgyoFYAsAH FlHn2LtUsA66x12peskOIW3tstFFsaJ3aBEdP2wcKFVCcANcWly2wA+fMt4I3U8PW6ue tCCw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730483262; x=1731088062; 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=GaiHnwo8DRW+cYed7a1HEMqLUzjFX++R0qMPfhF5vLM=; b=w10F8B1K81ztUxM9g4gFQ5MKuv22a4Zk+SZfGEd8QkUIYyjxcTuNveNtcgvb9urXbY 9THMpnIT5CPiAyfobF5SSsHXoJx1l4RhC96meoMXeteRjvpcNVC97PzQndmfFZNpzSXJ 7Tn14xWnyXzBrVa965PM663eBzJqFKvMFcEzGrZyL/ISdYle5OBZ5JYgsLXD2LO0xT+m FKaz9H7JtzXJ3oS43fNUM1/p9zWoe1J1XiuAmtd3K4aCYCvBa0psx13BP8my7nVLst3a XCIrt36LJHQ2RDpGZ8p+1wLWnxPloxdZUEFC5VfXDSSP8tc/ppLSAfL/pQSvfhSlsus2 C9tg== X-Forwarded-Encrypted: i=1; AJvYcCWWRTZfR/8H9WuV/2oHkxkG7LekDVt+eLrok3teOZaxXOGIlN7cDq04yVWs7kc1S8wmYTfgd9FardnorD8=@vger.kernel.org X-Gm-Message-State: AOJu0YyXRUzmPhXCN/7ar6IRq+HfOboCjlp+UTSyO+eLpdGyFD1Nap5+ BuywNFzERnWXhAcH6e3/wyXBXPlU2JhFqaCZcwiI8N5YsanxzdFb X-Google-Smtp-Source: AGHT+IEoDC1+DdRyNwiGYE7qetGrHQUyrDq7g7gNsyLBOiO9dmY8iHh/vdMDVHQHSTCGd5Si/xC6wg== X-Received: by 2002:a05:600c:548a:b0:42c:c003:edd1 with SMTP id 5b1f17b1804b1-4319ac9c555mr211530915e9.10.1730483261864; Fri, 01 Nov 2024 10:47:41 -0700 (PDT) Received: from localhost.localdomain (82-64-73-52.subs.proxad.net. [82.64.73.52]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-381c1185b4bsm5732933f8f.112.2024.11.01.10.47.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Nov 2024 10:47:40 -0700 (PDT) From: Dave Penkler To: gregkh@linuxfoundation.org, linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org Cc: skhan@linuxfoundation.org, arnd@arndb.de, Dave Penkler Subject: [PATCH 1/9] Fix buffer overflow in ni_usb_init Date: Fri, 1 Nov 2024 18:46:57 +0100 Message-ID: <20241101174705.12682-2-dpenkler@gmail.com> X-Mailer: git-send-email 2.46.2 In-Reply-To: <20241101174705.12682-1-dpenkler@gmail.com> References: <20241101174705.12682-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 taking into accont the number of entries causing random oopses. 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..9ff56b063681 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(sizeof(*writes) * NUM_INIT_WRITES, GFP_KERNEL); if (!writes) return -ENOMEM; =20 --=20 2.46.2 From nobody Sun Nov 24 20:32:09 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 B4E3C1CDA25 for ; Fri, 1 Nov 2024 17:47:45 +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=1730483268; cv=none; b=YdCOds2IK0KX5ZiqSROpXzpJUL60EBu/oucOYL4rFnkb0vdfE6RyrRhvH92jGuX0eoMgQ0jK5Ui75JmhhhlHXnA89F+hViJrWd+y5Yffq6zKqn4cCzt0yWUQXbyeLdYxpkedUC5Z0oN6U0q2vgIdlKjPcCc1eaxETmeDPZe8odQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730483268; c=relaxed/simple; bh=9mM2Ir0fRqQyLD75Q3q4+v/p6bVZUst4e2rxxZR8vdA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=oEVNzGqQdFaqZGE9QGtYSW86BshQzzLBVQ57Z4S+ymHFXLgk9vQ0hhXOP7MlhgHf+VqTTiQJut4eDYvNaLm2X0Z2fp5iWi3LGiGLiW5AxHOYY1SwpIkAyHkHugXV1h/BnuUuJfsyoXWHsH2jqHVmTGqRWX2LqMA3XN+8Ng+50bk= 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=QshBt+wI; 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="QshBt+wI" Received: by mail-wm1-f49.google.com with SMTP id 5b1f17b1804b1-4315c1c7392so18962995e9.1 for ; Fri, 01 Nov 2024 10:47:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1730483264; x=1731088064; 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=gzUEzBSHcBdCbajMK7iOeW1kMT8CaNerIKnehwEBaZ0=; b=QshBt+wIFNtSakR3gvwNxoMb1cZr4A8olIo9k/xWjocRx5o3kyBv6Heo1SKDriP+py 9o/pli+KkmNQKxbFTrF/vZSp1gJdE9iH8wY+XHd5kkXy9OEHryp0FBL5s8HEFz5ormJU BuL/uS1Qpdk/NtlZYhsb4I+uoAGxEzqOvOMM9GW/ukyRchwb4s6IL2mr1BaLFICuMm/h HYV1b3JZGfVeWji9nws4zhO5yoIE62pPzxDK9iEi4Kbgq0SnltM1y3w1p7LK7PQb+avC sZJQ3udtKZQfXlJPzCazH57Mt1sBu7Z/dC7N7YMj/EqNRygCUZYLYDZHBHVNyCc1ex++ WJ6g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730483264; x=1731088064; 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=gzUEzBSHcBdCbajMK7iOeW1kMT8CaNerIKnehwEBaZ0=; b=Vh/UcEzjdDP3b2ksgIhXaFqcPTr2m+sKseIUAZxYXrKnFLh2MhWvXLYkNbazSu8Hds HrKqdMkige1T4SF3U7jTTTBre3pAH0NoB4LnTSkPL7bFU+q3HjnXP0i//dvHdkhUkmuA 6wqgq4C8+fGsCupED9DYcRHsNUzqt2i8X4sg0k3c1LhOLExa4atDNLVJ4mDmNaCer4Cn vrIcGlGYTn6ADtKGZJ7nFjaMDXiy7/OLApIyGzSmHoqlCF4YdWSN3eyBqyJimYk21vBl NSuvRRz4jsaYWGJ9PLT1jcWvrXJM6L5vzI8wQeBtzRFud+hXZga7Lc0PYQ1Vt3XwTOhm KIFg== X-Forwarded-Encrypted: i=1; AJvYcCWrQIgsIJMXV0COt+2tzB2D4Vh4t7ZWLhPy6Gmpma2MgAWUVOQcAByQhKj/zHWLbPy4fKZTZIKVOQlJgj0=@vger.kernel.org X-Gm-Message-State: AOJu0YwsPiIhEEUkpN6Jg/DUJ+6MxAens+/wp5ZzQAtSjZkbGhaCGYXb RBeAE8JRTGwpeg1TYZZMhyeXk8T9qEfWsv4eoN0+RT4+HceOTTgsvPxA7dJt X-Google-Smtp-Source: AGHT+IGE+XE5Ma++dE6XV5+cdqQGJqbxmgu+zSBe/zTzWX4TxVIdLUwWVluB2R+bPgJpu0fK+4rXyg== X-Received: by 2002:a05:600c:22d3:b0:432:7c08:d121 with SMTP id 5b1f17b1804b1-432849fa03amr35415025e9.12.1730483263552; Fri, 01 Nov 2024 10:47:43 -0700 (PDT) Received: from localhost.localdomain (82-64-73-52.subs.proxad.net. [82.64.73.52]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-381c1185b4bsm5732933f8f.112.2024.11.01.10.47.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Nov 2024 10:47:42 -0700 (PDT) From: Dave Penkler To: gregkh@linuxfoundation.org, linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org Cc: skhan@linuxfoundation.org, arnd@arndb.de, Dave Penkler Subject: [PATCH 2/9] Replace custom debug with dev_dbg Date: Fri, 1 Nov 2024 18:46:58 +0100 Message-ID: <20241101174705.12682-3-dpenkler@gmail.com> X-Mailer: git-send-email 2.46.2 In-Reply-To: <20241101174705.12682-1-dpenkler@gmail.com> References: <20241101174705.12682-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 | 136 +++++++++++--------- 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, 112 insertions(+), 122 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..c0b774a831a6 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,7 +630,7 @@ int ibclose(struct inode *inode, struct file *filep) return -ENODEV; } =20 - GPIB_DPRINTK("pid %i, gpib: closing minor %d\n", current->pid, minor); + dev_dbg(board->gpib_dev, "pid %i, gpib: closing minor %d\n", current->pid= , minor); =20 board =3D &board_array[minor]; =20 @@ -638,8 +638,8 @@ int ibclose(struct inode *inode, struct file *filep) 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, gpib: 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 20:32:09 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 250901CDFCC for ; Fri, 1 Nov 2024 17:47:46 +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=1730483273; cv=none; b=Ap61Y6JIazze3qAnNgqMyr7bh/Fl5PHzdQk6mawsIA4jtVPAZdL++kRwQV4b56sA0cOEr4v/lT3QKxGBE8VbAtWl5/vf9aLXQqXrf1PhnUX4ED6ZB5s/TkTj1rzzyNuGtbR6/X132v6xMgvFIjUUPRLNr2kSpxDcXUTkn+w/21E= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730483273; c=relaxed/simple; bh=RrjBIOvO5VopIzFTn82GGUqfsHnTdo2WWNhITjcisAs=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=StZT1n3OdZ9hSRTtimINMuGecm8Z6ayitjDD35lN1wxDNz8cmDlygrpiYaM8h+o994tCLhym5ZYQK/K/28WY1s+4hIS8dW4tDeE/X+uILAslWO0ij4B5wtuNHaFbW1P6VIY8iFG4GkD5v0PcVAi0j+AaeCLY0cOjFC5SjIEQHx8= 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=B74va3F3; 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="B74va3F3" Received: by mail-wm1-f54.google.com with SMTP id 5b1f17b1804b1-431481433bdso19404985e9.3 for ; Fri, 01 Nov 2024 10:47:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1730483265; x=1731088065; 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=pKAmaQTd98lxmzsF7BocOvZtrmC6TIqQEZQOptmQ6yI=; b=B74va3F32dkBR8cIH2NY/JzJ8cUPdfhNBSH/hjCsPh7ilJ4wZQdekjNwJeO7Xw5MCb xQWjyuzZqVVEoDgSq8bHcgVkQOfbjWd0iflronD4yxMFwqFVDMZvJaUsUhoC/ZFo1T/s r/rQkcSuLaKuCtQXYaOm0txKR7kghqCwIjcpXP/CwKf+veSgy3ln5GUaJzAqxokbJ/yM 3bCh764GaY893Ww8yAlacCY0a1O24Ue1yfWLLQ3IU3/m5MkUSnDzLEEPRdjk2mG+KV7N 31j7YydSplncES7bVcbnhtcVVUlInVPelnTZX5SrwVnSGNPuCT3LcirdxjK0NZTYsp6n UVww== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730483265; x=1731088065; 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=pKAmaQTd98lxmzsF7BocOvZtrmC6TIqQEZQOptmQ6yI=; b=Rzd+ltxmE25SgWd5+vxd9iGrlf7xA4K+C8C7T276k5J5qGYWSrJQabeAiiyKfaGbX6 W9obQ4HNgy11xa2oKnBLY/He1uineARYFUf9+HNrGgsHC3lubjCIZoY50NiRZpBr6UYI m77fMCS4VOkUfHhOk0RGdOqwuT0ioIUB5HpRp/gIVtzRQt5RG81zVimlehj577GiEmk6 XM7t9Dg+w/Y9VlPqiJnl7kx4wdupBvl1s5jyu2BPJ9BE5ZQNZtSZG96DVw9pV+3nhsro yjzJ0LY5ktLj+9xpLmc0krCCtSXvPVfvA5E+Ykcg18I35KqXumy4jZLqNHc2aveg2u7x kXOQ== X-Forwarded-Encrypted: i=1; AJvYcCXFIdHcnK85WmAOHaQ6xdk49hIGmO8O54pcd8EXqSBvUBUOfRER4jBM9LsburWOI6s9aoPq4MhYSAZmIq0=@vger.kernel.org X-Gm-Message-State: AOJu0Yyn13yIrtF22SLYyu04034QgUWA9bbpoEOmaWaNhi+hpmt6nDXB ULuMukNUvSH8RvSxmv7T/nHqsi8l2VsII3wufkiz/jmq4Zfd247MVrLeP5dL X-Google-Smtp-Source: AGHT+IEBpYLhhENJ1c35WZfxftj53DgcwPUz3gDJUJ4MiMy6p43XFvXb44+uEqT0F/jzqAw+dkAQEA== X-Received: by 2002:a05:600c:3507:b0:431:1512:743b with SMTP id 5b1f17b1804b1-4327b7019a5mr68312165e9.21.1730483264924; Fri, 01 Nov 2024 10:47:44 -0700 (PDT) Received: from localhost.localdomain (82-64-73-52.subs.proxad.net. [82.64.73.52]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-381c1185b4bsm5732933f8f.112.2024.11.01.10.47.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Nov 2024 10:47:44 -0700 (PDT) From: Dave Penkler To: gregkh@linuxfoundation.org, linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org Cc: skhan@linuxfoundation.org, arnd@arndb.de, Dave Penkler Subject: [PATCH 3/9] Update messaging and usb_device refs in ni_usb Date: Fri, 1 Nov 2024 18:46:59 +0100 Message-ID: <20241101174705.12682-4-dpenkler@gmail.com> X-Mailer: git-send-email 2.46.2 In-Reply-To: <20241101174705.12682-1-dpenkler@gmail.com> References: <20241101174705.12682-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 | 377 ++++++++++++---------- 1 file changed, 205 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 9ff56b063681..50ec934fe8be 100644 --- a/drivers/staging/gpib/ni_usb/ni_usb_gpib.c +++ b/drivers/staging/gpib/ni_usb/ni_usb_gpib.c @@ -132,13 +132,14 @@ 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__); + //dev_err(&usb_dev->dev, "%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 +147,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 +225,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 +251,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 +317,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 +331,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 +357,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 +517,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 +532,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 +542,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 +550,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 +577,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 +602,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 +617,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 +650,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 +669,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 +678,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 +700,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 +709,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 +732,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 +746,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 +778,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 +792,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 +809,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 +820,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 +835,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 +872,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 +889,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 +908,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 +941,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 +967,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 +985,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 +1000,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 +1024,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 +1040,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 +1058,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 +1092,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 +1106,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 +1119,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 +1130,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 +1140,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 +1154,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 +1166,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 +1201,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 +1215,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 +1228,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 +1243,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 +1255,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 +1270,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 +1310,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 +1318,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 +1329,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 +1352,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 +1365,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 +1381,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 +1392,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 +1403,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 +1417,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 +1428,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 +1439,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 +1455,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 +1466,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 +1477,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 +1508,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 +1526,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 +1594,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 +1603,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 +1637,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 +1735,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 +1745,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 +1761,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 +1772,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 +1792,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 +1808,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 +1871,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 +1890,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 +1923,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 +1944,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 +1954,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 +1972,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 +1995,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 +2003,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 +2030,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 +2053,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 +2063,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 +2096,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 +2105,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 +2117,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 +2133,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 +2148,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 +2164,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 +2222,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 +2265,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 +2295,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 +2318,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 +2395,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 +2430,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 +2457,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 +2497,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 +2508,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 +2534,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 +2574,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 +2599,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 20:32:09 2024 Received: from mail-wm1-f52.google.com (mail-wm1-f52.google.com [209.85.128.52]) (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 1CD2A1CDFD7 for ; Fri, 1 Nov 2024 17:47:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.52 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730483271; cv=none; b=plkxNeakOrtH/cfKK3EZC4tWNOqMcEIp5KXRmHZ7P9znSoaYsVoG4Xw9ul0DNvLTURe4rB2iMrPLdnBXRjDYhlu5uDKoUF+D0Zl03smlOyMi2gU0xZcUKdnPYqflpdCHopo9ZQFuT8dRktV2nEIu1lcB3C4zyoChEZVQkG64Nj4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730483271; c=relaxed/simple; bh=Fipw3YRddPZlG52fZDs/GmM8qStNwOowjoS7gN9Kt/0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=NurwGnd/7/SJ+DlJPSi2GcKHTbn2NioLlHAxqw/XzUp0Jb2wTTWIK+WGR5oaL4ZxfeMa0A3CBz6CIuVySBw4OQhatSjBYIctbUbEHpQC3OkOtl1hzrJgtuwVWNayMFA1B2WKU4atbmlfkvXJtIUfncngLQ9AwetAgBoJFpQeYhA= 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=jE9osVxZ; arc=none smtp.client-ip=209.85.128.52 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="jE9osVxZ" Received: by mail-wm1-f52.google.com with SMTP id 5b1f17b1804b1-4315df7b43fso17869925e9.0 for ; Fri, 01 Nov 2024 10:47:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1730483266; x=1731088066; 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=TVfjNRFutmg4i8+HbWxkhEKO3cv08yjsPPKAk+iSdo0=; b=jE9osVxZBuphHw4mBXDEJKG+YHDgE9AHsAzuA2ODRCUZwELHbtiRHjj5lIx7MUeeO6 ioFzExHT18e5zdImw4S7cyQVxiumrHdGp15Yqk9RY7O5xdVGNR072uXUfysx9xmQ6+h4 33OA7vWVPdsAsrQ9Ofp8aT7W5gyo+m/iIN25TRa2BX+x3fAXh3cdfsBvP6OeDEx7WekI 8uQyq3/mDmPDX+wdovgg39WWBisi+vxyDbk8Zu4sojgYSwndQbafpFheKlcyydFniQzD 9uw00SqRUNgDBLr7ogKuTMTuNp0qLEzY8cdO/YHfKPE+aBLdwFxTjvWpPYjHzVNoVUI6 bOKw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730483266; x=1731088066; 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=TVfjNRFutmg4i8+HbWxkhEKO3cv08yjsPPKAk+iSdo0=; b=TVXfF8XFPxNYLs3w2qOGRhO9UjFb2+MIxZD8rcjeHlui8/2ryUFSJ1DsfsKaV6dcNY PdMXuHcweKKY8FOYaqnuWmb5gitxemyF1tMaRvNdkFlRZJdYxW1orKDgX79Q51QZpN11 9lKU0bj7gq/Umvy3NSlSpGPbBO0OT3zGUWHOGIRIBghagKYfcdhXVeZrQkNTv5OMJ/OR Aqm3vsKqup64nJPglcYYdtzjgzQxmreenJ1ofgKRgy1fNNY3Rqrlza8WoIF0yooQgZMk 8ezZFaZWEna5x0gadq9JyqWRhY4N+QiO4ZN5BPp+60yL8KktvwMbQRyl/cZgZy7fcobx 8oKw== X-Forwarded-Encrypted: i=1; AJvYcCVgPPtSwd4aq+/JiJM5Q7Q1ZK7rc0/ME3hrRJJSaNuX0oZWxT/LozpXa7r0vnP6O81TxCpXv5XfPEcQ+cA=@vger.kernel.org X-Gm-Message-State: AOJu0Yyod0GjfPudSyOqSFEOyMu7z5zfTA+mEWwUc++vboKmWT1ee7dM 73Cgl/rQNKlwtTSqhysD4DaTm3e20Fs7WWMaZUHR6GltlYcor/8y X-Google-Smtp-Source: AGHT+IH17vBtCREmqdg17o6yZy8rpcgJxMdbidORldaY8qcbV+ZSM+MFPdmNaU7/k/bug4WgsWeupA== X-Received: by 2002:a05:600c:5246:b0:428:f0c2:ef4a with SMTP id 5b1f17b1804b1-4319aca5a1fmr214332025e9.13.1730483266183; Fri, 01 Nov 2024 10:47:46 -0700 (PDT) Received: from localhost.localdomain (82-64-73-52.subs.proxad.net. [82.64.73.52]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-381c1185b4bsm5732933f8f.112.2024.11.01.10.47.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Nov 2024 10:47:45 -0700 (PDT) From: Dave Penkler To: gregkh@linuxfoundation.org, linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org Cc: skhan@linuxfoundation.org, arnd@arndb.de, Dave Penkler Subject: [PATCH 4/9] Update messaging and usb_device refs in agilent_usb Date: Fri, 1 Nov 2024 18:47:00 +0100 Message-ID: <20241101174705.12682-5-dpenkler@gmail.com> X-Mailer: git-send-email 2.46.2 In-Reply-To: <20241101174705.12682-1-dpenkler@gmail.com> References: <20241101174705.12682-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..dcd0ac2a2ca0 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(board->gpib_dev, "%s: write timed out ibs %i, tmo %i\n", __func_= _, + 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(board->gpib_dev, "%s: write aborted bsr 0x%x\n", __func__, 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(board->gpib_dev, "%s: No listener on command\n", __func__); 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(board->gpib_dev, "%s: No listener on write\n", __func__); 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 20:32:09 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 D32A41CEAA2 for ; Fri, 1 Nov 2024 17:47:48 +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=1730483272; cv=none; b=t0Lf/n3yjd5qeqfYuFbJomkRiGCAox7JtL6EblISBLa/zeehPVy/my6MmKnREC24htFGTmzyVuuGjPvkeLex7mpRU918TAEDu5+KnavxTNfMmS68TKf869qeMGSHInPtpu13hlxPMFWmu897dhHcKySAl4rR9B1TsATWYQsRouk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730483272; c=relaxed/simple; bh=Wv8MMXJ+Py8EDogJKlT4hNxcHSRfLmTQK6sZN9sF+mE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=nRvpFrjHRf0/ovvM6714AdukWu7+/wLDIw//K3c2PZuRLwUQllJOpuPOB4jSBID7NHLSdOYTh5Mt77bxAd+hqdtYRXVPOupKzwLjarNUqvqtNVAOXG3ihhndgVw11eC9VLg4bz8GiTTK2dyP/mu7cLs64c4nTxcPaKLrfamIelk= 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=VhKNcMQq; 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="VhKNcMQq" Received: by mail-wm1-f54.google.com with SMTP id 5b1f17b1804b1-4314b316495so19528415e9.2 for ; Fri, 01 Nov 2024 10:47:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1730483267; x=1731088067; 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=6FCsFKtTlniBMf+HskEurqf7ZwS4OL3ptDFkdbvDQH4=; b=VhKNcMQqsBBgsCpycmSEYj3hwzQlo6XC7FsdTPa0i6tXA+YEOfclPrB7v1LaOm3HIa HLoWdA/FsbjsbCME6RFT8DHYtzyKxby15uRct4sIBw8yt7VMUe15c/gdBbxePpmjql35 v1C+XULX6KSNOY22oGlf3A3wclWue4GEA9Dofw++YV7LRljOsP3P6nxpDSRVFi7wM7kJ uSqK7nmSyfDkMqL5+bZtBRTL4gfnHTUyUE8/ToLlBnYJFyo5hJ9i0z6gKr9h+659Qri7 YX00eBjUHtSgXIe895chHQJt6hzzUoIWdRCml434e99Sff4ZBo2vI++xpJfqnJWv/iGf tPnQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730483267; x=1731088067; 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=6FCsFKtTlniBMf+HskEurqf7ZwS4OL3ptDFkdbvDQH4=; b=cw84+cAy42HHRsV4lqoq36DOIrm+G8NQrOFugJXkdsVtT8MlgbT5nqbE1u3ZebzXRf zA20bBAlBXhtzH0EWMLpJjjxcDX6aztI02U1tytlqOW6jaxYSBbDv9rdW8h4drIc/Kho AxhZuyQVveX9Tjg2MJ4AnBf3NVMSHT5VUb5lVj0aO3Tn2B2QiL1M2Z0j5TL+fl1shOSM otCGEosOV/eQXdFkpp3XyXXrQa8NyculL5OZ9iNXSgSyfWUZXcdZ3xS4xOtpS4AzLywl gVWilndhmA4D3WInTbp4jDkZeaxNDpiBeEDlb6v6S2zGOigCn8MZg7S15tTeIAtknmZl G8RA== X-Forwarded-Encrypted: i=1; AJvYcCVD1Qk6Br2kv+NsHPMZbGmQaVXlJfrwiGCjGChv4GuKT8u2FRWKk/0HPKpZ1c6NxPWhh4bp/oOIKn0seX8=@vger.kernel.org X-Gm-Message-State: AOJu0YzWioMFQ6mVJ8Lz4QyFx2R0ZaJ+gzaGG5Aa+F1XrEJIeS+TvCo1 EuJidCUxD2SPAs+QBYACCYIz5U5XcFGmHWhuEb5GREAUS0in90Od X-Google-Smtp-Source: AGHT+IGy0Pe0rjcA3JSYRD6Ge7Fw1LeHQXS2UJTErx1+bcXrKSz+uJrJP0zc8uhS4CtWPqZ87a2XBg== X-Received: by 2002:a05:600c:524d:b0:431:1d0a:38e2 with SMTP id 5b1f17b1804b1-4327b6fd392mr70795705e9.21.1730483267083; Fri, 01 Nov 2024 10:47:47 -0700 (PDT) Received: from localhost.localdomain (82-64-73-52.subs.proxad.net. [82.64.73.52]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-381c1185b4bsm5732933f8f.112.2024.11.01.10.47.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Nov 2024 10:47:46 -0700 (PDT) From: Dave Penkler To: gregkh@linuxfoundation.org, linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org Cc: skhan@linuxfoundation.org, arnd@arndb.de, Dave Penkler Subject: [PATCH 5/9] Remove GPIB_DEBUG reference and update messaging Date: Fri, 1 Nov 2024 18:47:01 +0100 Message-ID: <20241101174705.12682-6-dpenkler@gmail.com> X-Mailer: git-send-email 2.46.2 In-Reply-To: <20241101174705.12682-1-dpenkler@gmail.com> References: <20241101174705.12682-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 20:32:09 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 437111CDA2F for ; Fri, 1 Nov 2024 17:47:50 +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=1730483272; cv=none; b=f8r3xJl5+LhcRHUQXVWyoBoGLW+UR6KpPgTmh2ziXXi7h7rKiJU/Bk2yfB+pm611abJgPbtJ1qIWIysvrPZ5rGbju3ZKwNYpVpnpY7lVpJVceSzI5LU1F1sNdZkpnexvhQvjI58dznKIsdFVfTRr/YpNiEp+T5Nt0e6dGfJMLgI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730483272; c=relaxed/simple; bh=+2ZbUe5U+E2OEYIW+993vuoS7rTvvL1M9Xv6zVjD7cc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=HW5FNkpqDN+4fbiGxhiyw18jYMbPAwfHB6OlixmoHZ4Hr/+NSFvoNJzeMsYFBcqvP+vpUqc3i6O/XzV68gv0vKc0vzB3lBXZJXm7TeupufOILbc2Y1ddCiBPLYJai//ievzzpTsmQuQBVL9jX5qxaSV63D9Tv22rUOlaWeSjto0= 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=jGbyNNR+; 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="jGbyNNR+" Received: by mail-wm1-f42.google.com with SMTP id 5b1f17b1804b1-431616c23b5so13479715e9.0 for ; Fri, 01 Nov 2024 10:47:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1730483269; x=1731088069; 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=SaeLrECpXROHY7pwjLzQVPEarLzFsCZ3cJ6sERHUL3A=; b=jGbyNNR+Xn9gB11U0B2GX9iuc+4PYiX30k5G+a7JmgdRwh9cGYihFYL5VG3z3eiyAI /Gam0kY2pWok35StLsuFrRIROjj9eeV3893K3kZPfvChqQpMaNrV8Fge7/efoNXL/lLW HbnwJeQJ71GiF4asw0waf5Ta2D0bSD6cEr8xnWp48E7i6l2z8iptHK9gpmPplswjLLdx J8B2oamhFIB1IJaSyMxbNuoFR2a98g89s5+4rAgquKnTvvI4c/8ylvA5OPxt4hR0BPCS A6Zs3FJKQVsYbR29gSAd9NDsBYLSiT9slB6sfDBQO8+eY/qUn11ew7iYFFmvnNt3JEHC As0w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730483269; x=1731088069; 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=SaeLrECpXROHY7pwjLzQVPEarLzFsCZ3cJ6sERHUL3A=; b=tpLBctKMc5BWIUiW3OaAygGhQs24HFiUktS8jsWdukB9BoLOirLLmWSpDDbK9euq2J dq/4BXDyotO9UOY2XtLWqY2C8QJQwq3gkKzgHe7wRntnx5Wy/eDjOtby9aZ5H3RX3p+M eJQwopWHKF/Fv93wpycy/qTcTLzsh4WI4HOVdL+3T/V1o4edveQ2xUGsZKPT9RjdGZ2T krZhWTJVPjhB1o2eYhvRn8BhQQi57Skowyztj0RBrhQU8PApmMZLxjILMr62wdI1vIAe cryPw+Ah0mcDJIjpuYy3nzMzitvOHnNHkH2i6d81ljgOv6I05tjoQctSn4796QW6xl3v 7eOw== X-Forwarded-Encrypted: i=1; AJvYcCXjmWi7/cSAlx4lUIKPfWKqT9U09RKYRBXv+JwcvJLCfi5S7Y0ej5ahKH/xqQLJYCrDpxfSJiAOgKrS5DQ=@vger.kernel.org X-Gm-Message-State: AOJu0YwmaxyRbiLZ+hIssMAXa0ZEE5lVwK8gT1HKHMJ3Qm4tdiGIffrw vhs2aVB7My0XUO20blS8GQnclo0krTHuS191vR+3srZG4xWfE261 X-Google-Smtp-Source: AGHT+IH18wIXFH8jKPj32LWrbFUjspDICIELrUBuEIIAl+hXdssGLPupA/vj+6w12Y0agJdPXDLTzQ== X-Received: by 2002:a05:600c:3b0f:b0:431:4e33:98b6 with SMTP id 5b1f17b1804b1-4327daa33e9mr63453325e9.5.1730483268369; Fri, 01 Nov 2024 10:47:48 -0700 (PDT) Received: from localhost.localdomain (82-64-73-52.subs.proxad.net. [82.64.73.52]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-381c1185b4bsm5732933f8f.112.2024.11.01.10.47.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Nov 2024 10:47:47 -0700 (PDT) From: Dave Penkler To: gregkh@linuxfoundation.org, linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org Cc: skhan@linuxfoundation.org, arnd@arndb.de, Dave Penkler Subject: [PATCH 6/9] Use dev_xxx for messaging Date: Fri, 1 Nov 2024 18:47:02 +0100 Message-ID: <20241101174705.12682-7-dpenkler@gmail.com> X-Mailer: git-send-email 2.46.2 In-Reply-To: <20241101174705.12682-1-dpenkler@gmail.com> References: <20241101174705.12682-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 20:32:09 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 EA67D1CEAA7 for ; Fri, 1 Nov 2024 17:47:50 +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=1730483272; cv=none; b=oQMYK8dSigLgzYxLoLeIioCAK8U7h2GOGzkZYF7RMx1EKe6d9USQUz+UD3Fo4+s4aM/JTWYSOfeJPAkvX26qIOoQHf5y/RukmJ460JDLbjLOtCUl4t0I+k403a42FKBdjq9JWNwi1ZLtZdIlGxfsyvyUiEBHfd5KFuwUZ9altBk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730483272; c=relaxed/simple; bh=oa7FxakZaookSds0SFTFTDKYzsIa7xsMb5ayvu/2Js4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=VPrP1Zs8uHuFpRjq6FE5egqgeY7briPF7x88f5XcWzEpROo3IlGmmVGmhifm4vZiib9dbKdQO0PM18gP0eMfTYlYWQ7FkBCVY5QipXO6AJ8J/DynbBWp3qeJ2gZfFX/FQg70W+5a2dW0fAr7gqTjUiBTS3ROmgBr40ei0iazsEA= 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=BfyaKW79; 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="BfyaKW79" Received: by mail-wm1-f54.google.com with SMTP id 5b1f17b1804b1-4315c1c7392so18963545e9.1 for ; Fri, 01 Nov 2024 10:47:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1730483269; x=1731088069; 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=Dv3PqSzswe4Y5a8fVVX7vlIBbx348r3jo5xKs83X2jQ=; b=BfyaKW79+hRFsMrur/SMz52bK6Xf9kXmdpg3wIpQeWqGwdSFkSL3jDumepSgP17ykw +BHXCJ6ApxqF/8c5aFPwsubLLI+IA5EWLFzw8WLe3tgfFsnLlmCzJK/jM2Co84feCsAB J6I9wGw1NU0bbe60ZnAaOTlO3B1ws3zAChWBXwU7wXRQAJn1MAaWV7216oNThijL/OGd pk1EzpfYxuy285qdpVbVRWcJVNABsXaquFNpH2Uu2Ar0Mjp7hXGKQ30jalinJ1yI1gzB LVpTquKfIJJycsy3P8pfS/a8SaJzInv8hqMpL4suVFmO3IOu+TDxpgsWWEv2aRDXT7s0 Lelw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730483269; x=1731088069; 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=Dv3PqSzswe4Y5a8fVVX7vlIBbx348r3jo5xKs83X2jQ=; b=iQoUrn+MiMwM/6Gp4bOOzBKNEX1sxfIhALd8dx6paWTaZjSw8BJKeyBDrIQNNj9HIB CCUSugOuCKQEA+oTjlulCLOQMfRviCZEUwVWJ9UTN5XvgElcaStts2DSR5HTPqpmj0DM w9p3yAX8tqoJtIUmT+cWYc32Ea60yeE19WyVrxiEBesSuuKQWrC4ey8Xg1U7iy6K/ZtI BZNFOSfY6yheRdaphq5JuEJzsZTSvlsV1nz658+xPMkS9PGFjxQ8xyENcE2rTyqWZbKs roFmoHoCA9/xD7N3Q2YMql+Fxb7MFWq9m9mvjd1HAArVSqUlXJkQq8kRCzcFwG1xAlmX /pTg== X-Forwarded-Encrypted: i=1; AJvYcCUtDBj/xpc/kJwzXByC0ZnaXY/RYe/17viPDlAUVZR2VjcEYjIJh0JfrRkwPrWyvGjUcgy/c7Tur/njGms=@vger.kernel.org X-Gm-Message-State: AOJu0YyB+FoLXu0Vcz4yKiKL4eKbU37mesd/9D8HejU2nf1KXVr+HTfS txAyYXUQj2rJSoF6QknvtHNZrAOl6cTxkAznh2mDTSlFeQHHiKDnh4erZBwx X-Google-Smtp-Source: AGHT+IE0O7ngfpdMaxPEYBKK5+0KGkwJ4Bru5OWs4wnoIv0xOr7IFO5MWtlBds+6seq0q6jQeLc8Kg== X-Received: by 2002:a5d:6d8e:0:b0:37c:babe:2c49 with SMTP id ffacd0b85a97d-381c7a4c7d7mr3540674f8f.19.1730483269243; Fri, 01 Nov 2024 10:47:49 -0700 (PDT) Received: from localhost.localdomain (82-64-73-52.subs.proxad.net. [82.64.73.52]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-381c1185b4bsm5732933f8f.112.2024.11.01.10.47.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Nov 2024 10:47:48 -0700 (PDT) From: Dave Penkler To: gregkh@linuxfoundation.org, linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org Cc: skhan@linuxfoundation.org, arnd@arndb.de, Dave Penkler Subject: [PATCH 7/9] Fix Kconfig Date: Fri, 1 Nov 2024 18:47:03 +0100 Message-ID: <20241101174705.12682-8-dpenkler@gmail.com> X-Mailer: git-send-email 2.46.2 In-Reply-To: <20241101174705.12682-1-dpenkler@gmail.com> References: <20241101174705.12682-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: 2c9f5d8c6ece91ecd33350749230494d224550f1 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 20:32:09 2024 Received: from mail-wm1-f45.google.com (mail-wm1-f45.google.com [209.85.128.45]) (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 4414C1CEAA6 for ; Fri, 1 Nov 2024 17:47:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.45 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730483274; cv=none; b=C3OI7496pioWDGqH3Rzj2EJodAgA4uXpbLjBdZh0RGYcFKAEzJlwlPcxcMPbK8yHg7OV+uKQ2dZSJozErsPANV0ak9DKp5yr9Mep+CxKpiRhmI9X3iyEeMcWuTIWGXCegktM4aELCn3/r7SSvnnVi4JRtQX38oTkZwtini0SYcs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730483274; c=relaxed/simple; bh=E8GpDid0z0L+scbV3cTbbzBQ8cibWDg9h1nXglwEYuI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=KCIFSjkcCcxznH60SB1+tFazXthnGKAJ2Xg3Ujy9kLO41vzrKukVdMXeiKouc2E88K0qvZED5XwKQMZA6TjGxjA+UbS9TJ9OlyxWbkMyPthLBiXev4z1l6ssHyD+1PE+zk9whGI+UKRw9oQzLX9I94BGYuWxp6Q5Az5MGa1vReY= 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=MxOP4Tsm; arc=none smtp.client-ip=209.85.128.45 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="MxOP4Tsm" Received: by mail-wm1-f45.google.com with SMTP id 5b1f17b1804b1-431481433bdso19405475e9.3 for ; Fri, 01 Nov 2024 10:47:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1730483270; x=1731088070; 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=6c+vWdnejyhzbmDbcfsvQBCmeK/se4a+fgFkV5D6jqQ=; b=MxOP4TsmHv5ub1TbxtWiZawsJ/sPVbiGYuNVnTSJ8pl19ADruUxlrb3X7dDuxPnyWh eZYGZ+3WGKySmyo4wQ/mHdWAbLVnXd7e/DSDVsM0RBqYG/UI3RlDo9lhazwgCQhe2Ldt ojbA6PobM1o2xv7UOrCB36OpKQ8xrxvkjT18g9/MTd3rW0NNgaN5JI1sbYYTODCbA99K Xenzszk02B0mTlJZwyjulONLSK1GUPAYlCi1+ECQOEMvpcB5hzEPfp+eElidU0IU0kQF p8bWp84jR8bKRtaD15HYpwkeZwgoR1poNfSlQ0cOYCwlHnZUQsxLL5LKKmmIwz8cE02q A8lg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730483270; x=1731088070; 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=6c+vWdnejyhzbmDbcfsvQBCmeK/se4a+fgFkV5D6jqQ=; b=MUfpQ9Nxz5/8YuVROS2Zxku1Dmg/L6RPmAwRwQEfm9FYh/GogTMVH4piIGE/wc/xHk RoT1rllKuauMdtA5yVMAzZcFQlsEiFOjv2ydXbbgMe1V0tC+nroRabz3UbJTKKx+D+FN n1g6lMmqx3ym/t1DaoyTBYg4m1KI487P7cZUCT2EqAOVbGK57WxXQEg8xrDO/TBaU3yE JQhk6LWIlVuuDc9U/MUT4xlQZEVOvE1dmwFp2M6Sx3CVoTklWfoeE7FvG3zGkyR1RWvu kP+ywGrJTJ3zGmYEoUMZPEycBsueLXAow6Q22oohWtWG1mXwLBqlxYY6fMLl+7PQrLL+ +lcg== X-Forwarded-Encrypted: i=1; AJvYcCXYcodr8La7tkgIYaTcv6+g1zCz8i6l3mfIqqhL1UqNK/UWmjfiPCDs3+TMd8f+CHAL2Gnm5Jqj1IQJGBo=@vger.kernel.org X-Gm-Message-State: AOJu0YydDEwJMIsEYzixJT/iN40AMIy0B8PvzNdWManDMqhdBIgB9lYO Xp4pumCPxa2eYP7mbMoHw/r5wHId3Zm9l+SAJxBaXNYruGB+0q2e X-Google-Smtp-Source: AGHT+IG8JrW9cZ5ghpR/F8uKmVF8GGUEafLV+lott5rbv8LEwgWvK92GtmiULMRy+tMKkTaaHRtv7A== X-Received: by 2002:a05:600c:1c93:b0:42c:b9c7:f54b with SMTP id 5b1f17b1804b1-4327b70150fmr64121935e9.16.1730483270482; Fri, 01 Nov 2024 10:47:50 -0700 (PDT) Received: from localhost.localdomain (82-64-73-52.subs.proxad.net. [82.64.73.52]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-381c1185b4bsm5732933f8f.112.2024.11.01.10.47.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Nov 2024 10:47:49 -0700 (PDT) From: Dave Penkler To: gregkh@linuxfoundation.org, linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org Cc: skhan@linuxfoundation.org, arnd@arndb.de, Dave Penkler Subject: [PATCH 8/9] Rationalize lookup tables Date: Fri, 1 Nov 2024 18:47:04 +0100 Message-ID: <20241101174705.12682-9-dpenkler@gmail.com> X-Mailer: git-send-email 2.46.2 In-Reply-To: <20241101174705.12682-1-dpenkler@gmail.com> References: <20241101174705.12682-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. Remove GPIO14 and GPIO15 lines from the two other tables. 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 | 85 +++++++----------------- 1 file changed, 24 insertions(+), 61 deletions(-) diff --git a/drivers/staging/gpib/gpio/gpib_bitbang.c b/drivers/staging/gpi= b/gpio/gpib_bitbang.c index 8c03e91c01dc..e7a5248ee80d 100644 --- a/drivers/staging/gpib/gpio/gpib_bitbang.c +++ b/drivers/staging/gpib/gpio/gpib_bitbang.c @@ -203,41 +203,39 @@ int gpios_vector[] =3D { /* Lookup table for general GPIOs */ =20 static struct gpiod_lookup_table gpib_gpio_table_0 =3D { - // for bcm2835/6 .dev_id =3D "", // device id of board device .table =3D { - 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("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), - 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), + // for bcm27xx based pis (b b+ 2b 3b 3b+ 4 5) + GPIO_LOOKUP_IDX("GPIO4", 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("GPIO7", U16_MAX, NULL, 7, GPIO_ACTIVE_HIGH), + GPIO_LOOKUP_IDX("GPIO8", U16_MAX, NULL, 8, GPIO_ACTIVE_HIGH), + GPIO_LOOKUP_IDX("GPIO9", U16_MAX, NULL, 9, GPIO_ACTIVE_HIGH), + GPIO_LOOKUP_IDX("GPIO10", U16_MAX, NULL, 10, GPIO_ACTIVE_HIGH), + 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("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), { } }, }; =20 static struct gpiod_lookup_table gpib_gpio_table_1 =3D { + // for bcm2835/6 .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), @@ -248,8 +246,6 @@ static struct gpiod_lookup_table gpib_gpio_table_1 =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("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), @@ -266,42 +262,9 @@ static struct gpiod_lookup_table gpib_gpio_table_1 =3D= { }, }; =20 -static struct gpiod_lookup_table gpib_gpio_table_2 =3D { - .dev_id =3D "", // device id of board device - .table =3D { - // for bcm27xx based pis (b b+ 2b 3b 3b+ 4 5) - GPIO_LOOKUP_IDX("GPIO4", 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("GPIO7", U16_MAX, NULL, 7, GPIO_ACTIVE_HIGH), - GPIO_LOOKUP_IDX("GPIO8", U16_MAX, NULL, 8, GPIO_ACTIVE_HIGH), - GPIO_LOOKUP_IDX("GPIO9", U16_MAX, NULL, 9, GPIO_ACTIVE_HIGH), - GPIO_LOOKUP_IDX("GPIO10", U16_MAX, NULL, 10, GPIO_ACTIVE_HIGH), - 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), - 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 *lookup_tables[] =3D { &gpib_gpio_table_0, &gpib_gpio_table_1, - &gpib_gpio_table_2, 0 }; =20 --=20 2.46.2 From nobody Sun Nov 24 20:32:09 2024 Received: from mail-wr1-f42.google.com (mail-wr1-f42.google.com [209.85.221.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 8E61D1CEE80 for ; Fri, 1 Nov 2024 17:47:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.42 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730483275; cv=none; b=NeJAhEV/NL9pVtEsNQadG2kE00/rgrV8+MpcSkp2N5WbbsSg3TnUVMRUpJMPLUydqtWFbgfReNrtWFW1+yuCgLwwQvGpEUGyGxvbZwN4qU74uFM3ntZi3kiZzl+I9oPeciZWJE9W1+u2TtOPp1HVrAHu1jTPViuWW6R+RVZzM0Y= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730483275; c=relaxed/simple; bh=vp9brIm82+sri2wgQZ8jwsv51grmgrK+Q9ybRLWbnu4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=DQ6pyHscaYEmFpTMgTy6Pui4Bvo0p/biDEZr/e7eq0HtYpckckzor4fcGaXeeXFf8Xr+RAgeJmGmBS0Yx8HTFpTM7eXozjRqsPInDqG7ZTPg+ATYpncJKvWKB9xPJ3ie/bREQyMjNP99MCaAZbT/jBRStTzleFeVTI9RCF5/Kss= 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=MgPYIjOa; arc=none smtp.client-ip=209.85.221.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="MgPYIjOa" Received: by mail-wr1-f42.google.com with SMTP id ffacd0b85a97d-37d55f0cf85so1519253f8f.3 for ; Fri, 01 Nov 2024 10:47:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1730483272; x=1731088072; 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=PxfRaBd2Z4IAnFtE1pVDi1Drl+tQCB1zhAZtdVbCCqk=; b=MgPYIjOaZQlZkOyVEJ/PTvUCaNpBpa7s1JAQQBeVWaP1MYXNhXjJ/2rIBJN97J7Qb9 i0VMYYjsNZun2eCim0CKo9Vc9S1w9ZTpFRYTKTsuet98eFF7dHvec0pcsZef3s1xpXxp aHtXk6y7VAabFcgYvQdxzLt2iR5qIvh3ZM0GS9w1wuvaj81OQlkefYuxg5hyxkEFe9cN ILViaXTQx5RHQeIIJntniXsvoxgrhCOKM/Uke7MWlpH2LTFCDcp7AOCvGvmZ6pYGAY7g X4FnK6xE/PguEhEDA62rLmuuZc2BS1pZcLqL1qnTWkQ7UHdK+0dGCtTsb5XfN5oPgjrr x+qg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730483272; x=1731088072; 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=PxfRaBd2Z4IAnFtE1pVDi1Drl+tQCB1zhAZtdVbCCqk=; b=DHzxi0Fbf3MqArcY71LvcVXOUauoZUgc62tCkeLj16WL2rxv7cxjNQuObw0BVXu0pW ojo3BCMbWRUQu75VZBFr8hjfKNcU2AdEePx/hL69MVuheGw0Ih92y2+7gKfJL1hWNe2A hSVnuIn+5/1fS0ugllx2dz/Qe45IZzBdvyYadp/YZqP/GOhew+O+/fKstxZWrMveLYfB AgBonXHruCP1HS1soDoODMus3MEiD7ARXG0ektMegRAAWN9WFuG2XYf7rmmY1dPWVrUK 2yIwjh3WjHcTwBqeNMDWa81iZTGrrYlnZyX1XDM5Tb2DkkMBjfB3z1LO95L4LMF5Ub59 ICDQ== X-Forwarded-Encrypted: i=1; AJvYcCW2B7fz+5Mm/UrckqRp5g+zuiaDzkYmHcMYlBwRpXWNVqx/0nGI+nbadqnrERDn4LUE78Rfr7Dz9M4Lfrs=@vger.kernel.org X-Gm-Message-State: AOJu0YwEiJiB5bEgKU09npnFd1I5n3G2yLBTlPObQ79dk3DXT7ygy6l6 +UeZOMjBGGxkcYW11ak2APbzSKPrppsmZ/vlW1QCMUJYbUpsKGqu X-Google-Smtp-Source: AGHT+IGLOQm2Hs7TEtonoWfGm48x/Hh2jXZbzg/FowWQbD3IP/YZNteRD9TAQtsjxuFjEOkgSWVguA== X-Received: by 2002:a5d:6da8:0:b0:37d:4e03:ff8e with SMTP id ffacd0b85a97d-381be7bae0emr6837279f8f.28.1730483271730; Fri, 01 Nov 2024 10:47:51 -0700 (PDT) Received: from localhost.localdomain (82-64-73-52.subs.proxad.net. [82.64.73.52]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-381c1185b4bsm5732933f8f.112.2024.11.01.10.47.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Nov 2024 10:47:50 -0700 (PDT) From: Dave Penkler To: gregkh@linuxfoundation.org, linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org Cc: skhan@linuxfoundation.org, arnd@arndb.de, Dave Penkler Subject: [PATCH 9/9] Correct check for max secondary address Date: Fri, 1 Nov 2024 18:47:05 +0100 Message-ID: <20241101174705.12682-10-dpenkler@gmail.com> X-Mailer: git-send-email 2.46.2 In-Reply-To: <20241101174705.12682-1-dpenkler@gmail.com> References: <20241101174705.12682-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 used for UNT and UNL Signed-off-by: Dave Penkler --- drivers/staging/gpib/common/gpib_os.c | 3 +-- drivers/staging/gpib/common/iblib.c | 4 ++-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/drivers/staging/gpib/common/gpib_os.c b/drivers/staging/gpib/c= ommon/gpib_os.c index c0b774a831a6..65ab190ac68e 100644 --- a/drivers/staging/gpib/common/gpib_os.c +++ b/drivers/staging/gpib/common/gpib_os.c @@ -525,7 +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 */ =20 int dvrsp(gpib_board_t *board, unsigned int pad, int sad, unsigned int usec_timeout, uint8_t *result) @@ -538,7 +537,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 > 30 || sad > 31) { 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..5678e8bd709b 100644 --- a/drivers/staging/gpib/common/iblib.c +++ b/drivers/staging/gpib/common/iblib.c @@ -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 > 31) { + pr_err("gpib: invalid secondary address %i, must be 0-31\n", addr); return -1; } board->sad =3D addr; --=20 2.46.2