From nobody Sun Nov 24 15:51:27 2024 Received: from mail-wr1-f47.google.com (mail-wr1-f47.google.com [209.85.221.47]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0667B1C9EDB for ; Mon, 4 Nov 2024 17:50:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.47 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730742625; cv=none; b=ITwseUhVE1uq7eYdcWci78R5U1R7/b1ZbhJ3YDTq3g8/rHAjcvX6G2/8hIpNtpONTzxP6aImvHw3y+9vxs1cGw8oiXZp4/FJcxx/aBz5rE2VTH1TJwJ3eXNzBHnxCM2f+xHvh/I9gg+siOziMprWRvgxsvme2VAdND5CZiKEQio= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730742625; c=relaxed/simple; bh=Yuzlz/gAXGepN585boJbCqwkRBFgUVeNpMhTrcpSlGs=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=dUEr8Dg2nbZwncHhLHLybPRVkzOeJec6BDIlW3AngAGIsQ5IM72Gv0z4vfN2rLmmNxKTUHSOiVxxCwWbU32DWolHBsq50Qi6VGw3KNZQEXRo/a4GD5UpAt7K9vvOqkIF9KPvo54hW9BvgWAHh8lEokeiu+BESPon34O8tbZGW/I= 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=ejPkYLOC; arc=none smtp.client-ip=209.85.221.47 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="ejPkYLOC" Received: by mail-wr1-f47.google.com with SMTP id ffacd0b85a97d-37d518f9abcso3087891f8f.2 for ; Mon, 04 Nov 2024 09:50:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1730742622; x=1731347422; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=tM1Vc6LIKdr1UuGOL4gln8Hsis7ai+S2TMSH9A6g84A=; b=ejPkYLOCy6keMUJow1CmmHmVhJjz0gM5+lTKCjOAbt1MfUFg+EyiBu9AQ6UJl5fZ0j kkwoyzQjgogsj0B1ZXPWKpk7VVKXB5yaHLZuS7oa05LnxpqH2+KVTWx0nr6eimsD/32W fDeplAKSWKa7LiFQrirV3i4s/NuGqaVbInq8P2/PtyxPciFzIslylSTcsrV0lUr6dkVe vyo00pGuPdgp6dBsYdg4rqnfmsXjO5S70flODBYbcmBrivEtDTM1TMYSOdwfjkTxYATJ ef0ObgybXq/6CAJ3XdvMbeYcIHJjg9bMgWB4us8438KzuReHwDsBDqekl4qRPm8hhA0c +V8g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730742622; x=1731347422; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=tM1Vc6LIKdr1UuGOL4gln8Hsis7ai+S2TMSH9A6g84A=; b=C0PIKO4/5NeBCNcbmPsEMAqv6fiLVIAJIpnGB+UfRc2t/qBp6k15gBOn+77iuqLBOg ZeQqRqTjyT6D9iyKydPh6p31cqo1Z3531AarLflB38tCB7XXlXObcQQBokozVAIG761h GaqradUp6t6MmhSdpeu1lK3M88uQkgrqijMxxvSNZ+IflgCZsSbGb63IACXN9IDpUnFn QAN/8vMtR3EjLqbKogspa2weqFntZyU9shmkEJQpVbXuHwRBy3D0hvSAS5xR3k58urVY OIMv9VdkfvFb2Pw8U9DQbjmExWQfGlevj+du2/X8beGMDo+HXOgYN6ZQEBSefhaqWNmx Xh3A== X-Forwarded-Encrypted: i=1; AJvYcCUUPINF0OnApdkbXor/vs3KNSCRMjoP5XLd4+1r05vGDYaIVSy6Mek476YcUVAw7BTQhW26qTuo9a1NSNY=@vger.kernel.org X-Gm-Message-State: AOJu0YxvqbXkr/Rq1Nl4ktK3dytkFAUV9mfffe9dufFUyiw89AJEmNLf 1RazgyxIRccQblBeHqxH1y1xMlBZl9njziBMPk08OCTpyBtBvbEA X-Google-Smtp-Source: AGHT+IEQm+bKTmeh2Hd6jsEfemnIjw5OPfstig+UCjqrc3WI3GQug0ImO83tQxckObu0zIV5Cwcnfg== X-Received: by 2002:adf:ea43:0:b0:37d:633a:b361 with SMTP id ffacd0b85a97d-38061206c0cmr23241855f8f.51.1730742622242; Mon, 04 Nov 2024 09:50:22 -0800 (PST) Received: from localhost.localdomain (82-64-73-52.subs.proxad.net. [82.64.73.52]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-381c10b7f80sm13839821f8f.20.2024.11.04.09.50.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Nov 2024 09:50:21 -0800 (PST) From: Dave Penkler To: gregkh@linuxfoundation.org, linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org Cc: skhan@linuxfoundation.org, arnd@arndb.de, dan.carpenter@linaro.org, Dave Penkler Subject: [PATCH v3 01/12] staging: gpib: Fix buffer overflow in ni_usb_init Date: Mon, 4 Nov 2024 18:50:02 +0100 Message-ID: <20241104175014.12317-2-dpenkler@gmail.com> X-Mailer: git-send-email 2.46.2 In-Reply-To: <20241104175014.12317-1-dpenkler@gmail.com> References: <20241104175014.12317-1-dpenkler@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" The writes buffer size was not taking into account the number of entries in the array which was causing random oopses. Fixes: 4e127de14fa7 ("staging: gpib: Add National Instruments USB GPIB driv= er") Signed-off-by: Dave Penkler Reviewed-by: Dan Carpenter --- drivers/staging/gpib/ni_usb/ni_usb_gpib.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/gpib/ni_usb/ni_usb_gpib.c b/drivers/staging/gp= ib/ni_usb/ni_usb_gpib.c index 571f07800c9a..b7550a937f15 100644 --- a/drivers/staging/gpib/ni_usb/ni_usb_gpib.c +++ b/drivers/staging/gpib/ni_usb/ni_usb_gpib.c @@ -1726,7 +1726,7 @@ static int ni_usb_init(gpib_board_t *board) unsigned int ibsta; int writes_len; =20 - writes =3D kmalloc(sizeof(*writes), GFP_KERNEL); + writes =3D kmalloc_array(NUM_INIT_WRITES, sizeof(*writes), GFP_KERNEL); if (!writes) return -ENOMEM; =20 --=20 2.46.2 From nobody Sun Nov 24 15:51:27 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 E5DEF1CB9E7 for ; Mon, 4 Nov 2024 17:50:25 +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=1730742632; cv=none; b=AfgOTVjbUEtX+12+CRaSx9eoqS1XhsyLS68loWWq9u1lBrJzfhpA4QtwqzbCVf8iCUZ78YjnSGdisNu+SmwTAUj0sZU0nFtWBAwgK4Rql2iBZPyr/DN+e0xrRQys85NfPX5lMURTDzUcOIWVVzklptViHG5LV/nPvr69DxSe0Yk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730742632; c=relaxed/simple; bh=4bXC7gHunxqx86ZI+obzML20ntlCMxcJ1/rIythKv8c=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=XLrpsCUhRwV0KCsuSkw432YdqEafidpJ9WcXuw8GqAU9ezplu9G2BT7s5CrWYLpKitltpf5E5RihbuWJxzpeKmuScjrBl3IAFN2+e5bnlIi6RGRHMeQgzFc+icVVgrF2vjy5uJkTuzLd0ksE6RT7P7mga4KhLwlTO4v70883Hd8= 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=jw6nIomi; 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="jw6nIomi" Received: by mail-wm1-f52.google.com with SMTP id 5b1f17b1804b1-43155afca99so33655215e9.1 for ; Mon, 04 Nov 2024 09:50:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1730742624; x=1731347424; 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=TWV3uTs5Bqe8KmLy/isy9CcoAf9srWI0SgOaSFqPZAk=; b=jw6nIomiAhLYGRdosahNI6Noh3zrMPUCrwnnMxuqXvVf30YP5R6AdZQXvpD0iZFwqG q9rleMzX0V4P2InUd1fhE0qBtSIOSJgznBLPOLVswQZeZOcp6sP837r8wdm7tSGdrJqW NzucsLHekJOV37QzEnPEPhiAk3noXcCQ1Qd2lDSwbOhE9vUPKpO8nz5dxJJ9AsHDpWFE EMmRPmwlcY8yx0pcKsj3nG5CT2naTPSKnI83SA305EGStpc8TmqEDAa+QyztA5OXbUpd KvKkzPQy9X1So8U/xU+NqmvqAZp8DuaqLvXEKdRpaHdySM/2CvXn1Ctp0ILPAP3SPMIP ALaA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730742624; x=1731347424; 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=TWV3uTs5Bqe8KmLy/isy9CcoAf9srWI0SgOaSFqPZAk=; b=q0E8om7HZyOLXcQMyCxmZsNOitTHx4CiNMjhxYqeZSSbKoJOSB42zXqH1YatoC5s0W vFpOc3g7Y9hpE+SMQ/l+DboaSJYHq790onGTkKcro44gN2/oWrIEhbgLVHk9KQPJtRjp zWws7cRa1AORl0Ab6L0YDq64nCdbFxJh4AZhWGMNSAjBp9OxbK8OhBmdbGE5AlpiK/VU 2vJQT3PN0XThxluzfFEJ2m+0242zk5bW9rA8QBnx80iqRG2fXanBaKz2S8+celCRn5Pe tmP7D6oyGlVO7+oO3KU7C8rkp9eG0oOJ5g3zM6wRX9ruTbULLUwEFShZ1Kd8FJIlzbSH vVPg== X-Forwarded-Encrypted: i=1; AJvYcCUEAK1kR8+9u1pFcZWv7qAlsq4LdLPpjWz6sMC6Hr5RGvV9QkYtGIWJv2OE3sOFFM1PgaM8HEjmzSfUaUA=@vger.kernel.org X-Gm-Message-State: AOJu0YzzEe3uoGKx9+Ub8IIPiahA38a4EiEplTELJJFZRptAcw7v504x tG5wk7/Gpvw0AlBKEMZhpgmxwuQjpZC0zlLSxNwjAYEnzDSkxUpcY3fpOz/0 X-Google-Smtp-Source: AGHT+IH9iDsxVf2t4T9q9hL4FVR1/ZfpDJs23A/r+d0dLAJEUTrrgVHlhRnADnshNxUghvtdVihlIg== X-Received: by 2002:a05:6000:718:b0:37c:f561:1130 with SMTP id ffacd0b85a97d-381c149f129mr12911474f8f.18.1730742623837; Mon, 04 Nov 2024 09:50:23 -0800 (PST) Received: from localhost.localdomain (82-64-73-52.subs.proxad.net. [82.64.73.52]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-381c10b7f80sm13839821f8f.20.2024.11.04.09.50.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Nov 2024 09:50:22 -0800 (PST) From: Dave Penkler To: gregkh@linuxfoundation.org, linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org Cc: skhan@linuxfoundation.org, arnd@arndb.de, dan.carpenter@linaro.org, Dave Penkler Subject: [PATCH v3 02/12] staging: gpib: Replace custom debug with dev_dbg Date: Mon, 4 Nov 2024 18:50:03 +0100 Message-ID: <20241104175014.12317-3-dpenkler@gmail.com> X-Mailer: git-send-email 2.46.2 In-Reply-To: <20241104175014.12317-1-dpenkler@gmail.com> References: <20241104175014.12317-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 Remove GPIB_DEBUG reference Replace GPIB_DPRINTK with dev_dbg Change pr_alert to dev_alert Signed-off-by: Dave Penkler Reviewed-by: Dan Carpenter --- drivers/staging/gpib/Kconfig | 10 -- drivers/staging/gpib/Makefile | 1 - drivers/staging/gpib/cb7210/cb7210.c | 2 +- drivers/staging/gpib/common/gpib_os.c | 138 +++++++++--------- drivers/staging/gpib/common/iblib.c | 16 +- drivers/staging/gpib/common/ibsys.h | 4 +- drivers/staging/gpib/eastwood/fluke_gpib.c | 2 +- drivers/staging/gpib/fmh_gpib/fmh_gpib.c | 4 +- drivers/staging/gpib/include/gpibP.h | 8 +- drivers/staging/gpib/ines/ines_gpib.c | 2 +- .../gpib/lpvo_usb_gpib/lpvo_usb_gpib.c | 69 +++++---- drivers/staging/gpib/nec7210/nec7210.c | 34 ++--- drivers/staging/gpib/tms9914/tms9914.c | 8 +- drivers/staging/gpib/tnt4882/tnt4882_gpib.c | 7 +- 14 files changed, 147 insertions(+), 158 deletions(-) diff --git a/drivers/staging/gpib/Kconfig b/drivers/staging/gpib/Kconfig index 999e7adacd82..0ea9a276c389 100644 --- a/drivers/staging/gpib/Kconfig +++ b/drivers/staging/gpib/Kconfig @@ -12,16 +12,6 @@ menuconfig GPIB =20 if GPIB =20 -config GPIB_KERNEL_DEBUG - bool "GPIB debugging" - depends on BROKEN - help - This is an option for use by developers; most people should - say N here. - - It enables gpib core and driver debugging - messages to be printed on the console. - config GPIB_COMMON tristate "GPIB core" help diff --git a/drivers/staging/gpib/Makefile b/drivers/staging/gpib/Makefile index a5bf32320b21..d0e88f5c0844 100644 --- a/drivers/staging/gpib/Makefile +++ b/drivers/staging/gpib/Makefile @@ -1,5 +1,4 @@ =20 -subdir-ccflags-$(CONFIG_GPIB_KERNEL_DEBUG) :=3D -DGPIB_DEBUG subdir-ccflags-y +=3D -I$(src)/include -I$(src)/uapi =20 obj-$(CONFIG_GPIB_AGILENT_82350B) +=3D agilent_82350b/ diff --git a/drivers/staging/gpib/cb7210/cb7210.c b/drivers/staging/gpib/cb= 7210/cb7210.c index c827d03dacf5..63df7f3eb3f3 100644 --- a/drivers/staging/gpib/cb7210/cb7210.c +++ b/drivers/staging/gpib/cb7210/cb7210.c @@ -479,7 +479,7 @@ irqreturn_t cb7210_internal_interrupt(gpib_board_t *boa= rd) status2 =3D read_byte(nec_priv, ISR2); nec7210_interrupt_have_status(board, nec_priv, status1, status2); =20 - GPIB_DPRINTK("cb7210: status 0x%x, mode 0x%x\n", hs_status, priv->hs_mode= _bits); + dev_dbg(board->gpib_dev, "cb7210: status 0x%x, mode 0x%x\n", hs_status, p= riv->hs_mode_bits); =20 clear_bits =3D 0; =20 diff --git a/drivers/staging/gpib/common/gpib_os.c b/drivers/staging/gpib/c= ommon/gpib_os.c index 6b12404efe7d..e84097ac8f69 100644 --- a/drivers/staging/gpib/common/gpib_os.c +++ b/drivers/staging/gpib/common/gpib_os.c @@ -69,7 +69,7 @@ static int t1_delay_ioctl(gpib_board_t *board, unsigned l= ong arg); =20 static int cleanup_open_devices(gpib_file_private_t *file_priv, gpib_board= _t *board); =20 -static int pop_gpib_event_nolock(gpib_event_queue_t *queue, short *event_t= ype); +static int pop_gpib_event_nolock(gpib_board_t *board, gpib_event_queue_t *= queue, short *event_type); =20 /* * Timer functions @@ -225,7 +225,7 @@ unsigned int num_status_bytes(const gpib_status_queue_t= *dev) } =20 // push status byte onto back of status byte fifo -int push_status_byte(gpib_status_queue_t *device, u8 poll_byte) +int push_status_byte(gpib_board_t *board, gpib_status_queue_t *device, u8 = poll_byte) { struct list_head *head =3D &device->status_bytes; status_byte_t *status; @@ -236,7 +236,7 @@ int push_status_byte(gpib_status_queue_t *device, u8 po= ll_byte) u8 lost_byte; =20 device->dropped_byte =3D 1; - retval =3D pop_status_byte(device, &lost_byte); + retval =3D pop_status_byte(board, device, &lost_byte); if (retval < 0) return retval; } @@ -252,14 +252,14 @@ int push_status_byte(gpib_status_queue_t *device, u8 = poll_byte) =20 device->num_status_bytes++; =20 - GPIB_DPRINTK("pushed status byte 0x%x, %i in queue\n", - (int)poll_byte, num_status_bytes(device)); + dev_dbg(board->gpib_dev, "pushed status byte 0x%x, %i in queue\n", + (int)poll_byte, num_status_bytes(device)); =20 return 0; } =20 // pop status byte from front of status byte fifo -int pop_status_byte(gpib_status_queue_t *device, u8 *poll_byte) +int pop_status_byte(gpib_board_t *board, gpib_status_queue_t *device, u8 *= poll_byte) { struct list_head *head =3D &device->status_bytes; struct list_head *front =3D head->next; @@ -284,8 +284,8 @@ int pop_status_byte(gpib_status_queue_t *device, u8 *po= ll_byte) =20 device->num_status_bytes--; =20 - GPIB_DPRINTK("popped status byte 0x%x, %i in queue\n", - (int)*poll_byte, num_status_bytes(device)); + dev_dbg(board->gpib_dev, "popped status byte 0x%x, %i in queue\n", + (int)*poll_byte, num_status_bytes(device)); =20 return 0; } @@ -310,11 +310,11 @@ int get_serial_poll_byte(gpib_board_t *board, unsigne= d int pad, int sad, unsigne { gpib_status_queue_t *device; =20 - GPIB_DPRINTK("%s:()\n", __func__); + dev_dbg(board->gpib_dev, "%s:()\n", __func__); =20 device =3D get_gpib_status_queue(board, pad, sad); if (num_status_bytes(device)) - return pop_status_byte(device, poll_byte); + return pop_status_byte(board, device, poll_byte); else return dvrsp(board, pad, sad, usec_timeout, poll_byte); } @@ -323,7 +323,7 @@ int autopoll_all_devices(gpib_board_t *board) { int retval; =20 - GPIB_DPRINTK("entering %s()\n", __func__); + dev_dbg(board->gpib_dev, "entering %s()\n", __func__); if (mutex_lock_interruptible(&board->user_mutex)) return -ERESTARTSYS; if (mutex_lock_interruptible(&board->big_gpib_mutex)) { @@ -331,7 +331,7 @@ int autopoll_all_devices(gpib_board_t *board) return -ERESTARTSYS; } =20 - GPIB_DPRINTK("autopoll has board lock\n"); + dev_dbg(board->gpib_dev, "autopoll has board lock\n"); =20 retval =3D serial_poll_all(board, serial_timeout); if (retval < 0) { @@ -340,7 +340,7 @@ int autopoll_all_devices(gpib_board_t *board) return retval; } =20 - GPIB_DPRINTK("%s complete\n", __func__); + dev_dbg(board->gpib_dev, "%s complete\n", __func__); /* need to wake wait queue in case someone is * waiting on RQS */ @@ -358,7 +358,7 @@ static int setup_serial_poll(gpib_board_t *board, unsig= ned int usec_timeout) size_t bytes_written; int ret; =20 - GPIB_DPRINTK("entering %s()\n", __func__); + dev_dbg(board->gpib_dev, "entering %s()\n", __func__); =20 os_start_timer(board, usec_timeout); ret =3D ibcac(board, 1, 1); @@ -394,7 +394,7 @@ static int read_serial_poll_byte(gpib_board_t *board, u= nsigned int pad, int i; size_t nbytes; =20 - GPIB_DPRINTK("entering %s(), pad=3D%i sad=3D%i\n", __func__, pad, sad); + dev_dbg(board->gpib_dev, "entering %s(), pad=3D%i sad=3D%i\n", __func__, = pad, sad); =20 os_start_timer(board, usec_timeout); ret =3D ibcac(board, 1, 1); @@ -436,7 +436,7 @@ static int cleanup_serial_poll(gpib_board_t *board, uns= igned int usec_timeout) int ret; size_t bytes_written; =20 - GPIB_DPRINTK("entering %s()\n", __func__); + dev_dbg(board->gpib_dev, "entering %s()\n", __func__); =20 os_start_timer(board, usec_timeout); ret =3D ibcac(board, 1, 1); @@ -485,7 +485,7 @@ int serial_poll_all(gpib_board_t *board, unsigned int u= sec_timeout) u8 result; unsigned int num_bytes =3D 0; =20 - GPIB_DPRINTK("entering %s()\n", __func__); + dev_dbg(board->gpib_dev, "entering %s()\n", __func__); =20 head =3D &board->device_list; if (head->next =3D=3D head) @@ -502,7 +502,7 @@ int serial_poll_all(gpib_board_t *board, unsigned int u= sec_timeout) if (retval < 0) continue; if (result & request_service_bit) { - retval =3D push_status_byte(device, result); + retval =3D push_status_byte(board, device, result); if (retval < 0) continue; num_bytes++; @@ -596,15 +596,15 @@ int ibopen(struct inode *inode, struct file *filep) priv =3D filep->private_data; init_gpib_file_private((gpib_file_private_t *)filep->private_data); =20 - GPIB_DPRINTK("pid %i, gpib: opening minor %d\n", current->pid, minor); + dev_dbg(board->gpib_dev, "pid %i, gpib: opening minor %d\n", current->pid= , minor); =20 if (board->use_count =3D=3D 0) { int retval; =20 retval =3D request_module("gpib%i", minor); if (retval) { - GPIB_DPRINTK("pid %i, gpib: request module returned %i\n", - current->pid, retval); + dev_dbg(board->gpib_dev, "pid %i, gpib: request module returned %i\n", + current->pid, retval); } } if (board->interface) { @@ -630,16 +630,16 @@ int ibclose(struct inode *inode, struct file *filep) return -ENODEV; } =20 - GPIB_DPRINTK("pid %i, gpib: closing minor %d\n", current->pid, minor); - board =3D &board_array[minor]; =20 + dev_dbg(board->gpib_dev, "pid %i, closing minor %d\n", current->pid, mino= r); + if (priv) { desc =3D handle_to_descriptor(priv, 0); if (desc) { if (desc->autopoll_enabled) { - GPIB_DPRINTK("pid %i, gpib: decrementing autospollers\n", - current->pid); + dev_dbg(board->gpib_dev, "pid %i, decrementing autospollers\n", + current->pid); if (board->autospollers > 0) board->autospollers--; else @@ -682,11 +682,11 @@ long ibioctl(struct file *filep, unsigned int cmd, un= signed long arg) if (mutex_lock_interruptible(&board->big_gpib_mutex)) return -ERESTARTSYS; =20 - GPIB_DPRINTK("pid %i, minor %i, ioctl %d, interface=3D%s, use=3D%d, onl= =3D%d\n", - current->pid, minor, cmd & 0xff, - board->interface ? board->interface->name : "", - board->use_count, - board->online); + dev_dbg(board->gpib_dev, "pid %i, ioctl %d, interface=3D%s, use=3D%d, onl= =3D%d\n", + current->pid, cmd & 0xff, + board->interface ? board->interface->name : "", + board->use_count, + board->online); =20 switch (cmd) { case CFCBOARDTYPE: @@ -870,7 +870,7 @@ long ibioctl(struct file *filep, unsigned int cmd, unsi= gned long arg) =20 done: mutex_unlock(&board->big_gpib_mutex); - GPIB_DPRINTK("ioctl done status =3D 0x%lx\n", board->status); + dev_dbg(board->gpib_dev, "ioctl done status =3D 0x%lx\n", board->status); return retval; } =20 @@ -1180,7 +1180,8 @@ static int status_bytes_ioctl(gpib_board_t *board, un= signed long arg) return 0; } =20 -static int increment_open_device_count(struct list_head *head, unsigned in= t pad, int sad) +static int increment_open_device_count(gpib_board_t *board, struct list_he= ad *head, + unsigned int pad, int sad) { struct list_head *list_ptr; gpib_status_queue_t *device; @@ -1191,8 +1192,8 @@ static int increment_open_device_count(struct list_he= ad *head, unsigned int pad, for (list_ptr =3D head->next; list_ptr !=3D head; list_ptr =3D list_ptr->= next) { device =3D list_entry(list_ptr, gpib_status_queue_t, list); if (gpib_address_equal(device->pad, device->sad, pad, sad)) { - GPIB_DPRINTK("pid %i, incrementing open count for pad %i, sad %i\n", - current->pid, device->pad, device->sad); + dev_dbg(board->gpib_dev, "pid %i, incrementing open count for pad %i, s= ad %i\n", + current->pid, device->pad, device->sad); device->reference_count++; return 0; } @@ -1209,14 +1210,14 @@ static int increment_open_device_count(struct list_= head *head, unsigned int pad, =20 list_add(&device->list, head); =20 - GPIB_DPRINTK("pid %i, opened pad %i, sad %i\n", - current->pid, device->pad, device->sad); + dev_dbg(board->gpib_dev, "pid %i, opened pad %i, sad %i\n", + current->pid, device->pad, device->sad); =20 return 0; } =20 -static int subtract_open_device_count(struct list_head *head, unsigned int= pad, int sad, - unsigned int count) +static int subtract_open_device_count(gpib_board_t *board, struct list_hea= d *head, + unsigned int pad, int sad, unsigned int count) { gpib_status_queue_t *device; struct list_head *list_ptr; @@ -1224,16 +1225,16 @@ static int subtract_open_device_count(struct list_h= ead *head, unsigned int pad, for (list_ptr =3D head->next; list_ptr !=3D head; list_ptr =3D list_ptr->= next) { device =3D list_entry(list_ptr, gpib_status_queue_t, list); if (gpib_address_equal(device->pad, device->sad, pad, sad)) { - GPIB_DPRINTK("pid %i, decrementing open count for pad %i, sad %i\n", - current->pid, device->pad, device->sad); + dev_dbg(board->gpib_dev, "pid %i, decrementing open count for pad %i, s= ad %i\n", + current->pid, device->pad, device->sad); if (count > device->reference_count) { pr_err("gpib: bug! in %s()\n", __func__); return -EINVAL; } device->reference_count -=3D count; if (device->reference_count =3D=3D 0) { - GPIB_DPRINTK("pid %i, closing pad %i, sad %i\n", - current->pid, device->pad, device->sad); + dev_dbg(board->gpib_dev, "pid %i, closing pad %i, sad %i\n", + current->pid, device->pad, device->sad); list_del(list_ptr); kfree(device); } @@ -1244,9 +1245,10 @@ static int subtract_open_device_count(struct list_he= ad *head, unsigned int pad, return -EINVAL; } =20 -static inline int decrement_open_device_count(struct list_head *head, unsi= gned int pad, int sad) +static inline int decrement_open_device_count(gpib_board_t *board, struct = list_head *head, + unsigned int pad, int sad) { - return subtract_open_device_count(head, pad, sad, 1); + return subtract_open_device_count(board, head, pad, sad, 1); } =20 static int cleanup_open_devices(gpib_file_private_t *file_priv, gpib_board= _t *board) @@ -1262,7 +1264,7 @@ static int cleanup_open_devices(gpib_file_private_t *= file_priv, gpib_board_t *bo continue; =20 if (desc->is_board =3D=3D 0) { - retval =3D decrement_open_device_count(&board->device_list, desc->pad, + retval =3D decrement_open_device_count(board, &board->device_list, desc= ->pad, desc->sad); if (retval < 0) return retval; @@ -1306,7 +1308,7 @@ static int open_dev_ioctl(struct file *filep, gpib_bo= ard_t *board, unsigned long file_priv->descriptors[i]->is_board =3D open_dev_cmd.is_board; mutex_unlock(&file_priv->descriptors_mutex); =20 - retval =3D increment_open_device_count(&board->device_list, open_dev_cmd.= pad, + retval =3D increment_open_device_count(board, &board->device_list, open_d= ev_cmd.pad, open_dev_cmd.sad); if (retval < 0) return retval; @@ -1339,7 +1341,7 @@ static int close_dev_ioctl(struct file *filep, gpib_b= oard_t *board, unsigned lon if (!file_priv->descriptors[cmd.handle]) return -EINVAL; =20 - retval =3D decrement_open_device_count(&board->device_list, + retval =3D decrement_open_device_count(board, &board->device_list, file_priv->descriptors[cmd.handle]->pad, file_priv->descriptors[cmd.handle]->sad); if (retval < 0) @@ -1356,7 +1358,7 @@ static int serial_poll_ioctl(gpib_board_t *board, uns= igned long arg) serial_poll_ioctl_t serial_cmd; int retval; =20 - GPIB_DPRINTK("pid %i, entering %s()\n", __func__, current->pid); + dev_dbg(board->gpib_dev, "pid %i, entering %s()\n", current->pid, __func_= _); =20 retval =3D copy_from_user(&serial_cmd, (void *)arg, sizeof(serial_cmd)); if (retval) @@ -1521,13 +1523,15 @@ static int pad_ioctl(gpib_board_t *board, gpib_file= _private_t *file_priv, if (retval < 0) return retval; } else { - retval =3D decrement_open_device_count(&board->device_list, desc->pad, d= esc->sad); + retval =3D decrement_open_device_count(board, &board->device_list, desc-= >pad, + desc->sad); if (retval < 0) return retval; =20 desc->pad =3D cmd.pad; =20 - retval =3D increment_open_device_count(&board->device_list, desc->pad, d= esc->sad); + retval =3D increment_open_device_count(board, &board->device_list, desc-= >pad, + desc->sad); if (retval < 0) return retval; } @@ -1555,13 +1559,15 @@ static int sad_ioctl(gpib_board_t *board, gpib_file= _private_t *file_priv, if (retval < 0) return retval; } else { - retval =3D decrement_open_device_count(&board->device_list, desc->pad, d= esc->sad); + retval =3D decrement_open_device_count(board, &board->device_list, desc-= >pad, + desc->sad); if (retval < 0) return retval; =20 desc->sad =3D cmd.sad; =20 - retval =3D increment_open_device_count(&board->device_list, desc->pad, d= esc->sad); + retval =3D increment_open_device_count(board, &board->device_list, desc-= >pad, + desc->sad); if (retval < 0) return retval; } @@ -1717,7 +1723,8 @@ static int mutex_ioctl(gpib_board_t *board, gpib_file= _private_t *file_priv, =20 atomic_set(&file_priv->holding_mutex, 1); =20 - GPIB_DPRINTK("pid %i, locked board %d mutex\n", current->pid, board->min= or); + dev_dbg(board->gpib_dev, "pid %i, locked board %d mutex\n", + current->pid, board->minor); } else { spin_lock(&board->locking_pid_spinlock); if (current->pid !=3D board->locking_pid) { @@ -1732,7 +1739,8 @@ static int mutex_ioctl(gpib_board_t *board, gpib_file= _private_t *file_priv, atomic_set(&file_priv->holding_mutex, 0); =20 mutex_unlock(&board->user_mutex); - GPIB_DPRINTK("pid %i, unlocked board %i mutex\n", current->pid, board->m= inor); + dev_dbg(board->gpib_dev, "pid %i, unlocked board %i mutex\n", + current->pid, board->minor); } return 0; } @@ -1747,7 +1755,7 @@ static int timeout_ioctl(gpib_board_t *board, unsigne= d long arg) return -EFAULT; =20 board->usec_timeout =3D timeout; - GPIB_DPRINTK("pid %i, timeout set to %i usec\n", current->pid, timeout); + dev_dbg(board->gpib_dev, "pid %i, timeout set to %i usec\n", current->pid= , timeout); =20 return 0; } @@ -1922,7 +1930,7 @@ static int push_gpib_event_nolock(gpib_board_t *board= , short event_type) short lost_event; =20 queue->dropped_event =3D 1; - retval =3D pop_gpib_event_nolock(queue, &lost_event); + retval =3D pop_gpib_event_nolock(board, queue, &lost_event); if (retval < 0) return retval; } @@ -1941,8 +1949,8 @@ static int push_gpib_event_nolock(gpib_board_t *board= , short event_type) =20 queue->num_events++; =20 - GPIB_DPRINTK("pushed event %i, %i in queue\n", - (int)event_type, num_gpib_events(queue)); + dev_dbg(board->gpib_dev, "pushed event %i, %i in queue\n", + (int)event_type, num_gpib_events(queue)); =20 return 0; } @@ -1966,7 +1974,7 @@ int push_gpib_event(gpib_board_t *board, short event_= type) } EXPORT_SYMBOL(push_gpib_event); =20 -static int pop_gpib_event_nolock(gpib_event_queue_t *queue, short *event_t= ype) +static int pop_gpib_event_nolock(gpib_board_t *board, gpib_event_queue_t *= queue, short *event_type) { struct list_head *head =3D &queue->event_head; struct list_head *front =3D head->next; @@ -1993,20 +2001,20 @@ static int pop_gpib_event_nolock(gpib_event_queue_t= *queue, short *event_type) =20 queue->num_events--; =20 - GPIB_DPRINTK("popped event %i, %i in queue\n", - (int)*event_type, num_gpib_events(queue)); + dev_dbg(board->gpib_dev, "popped event %i, %i in queue\n", + (int)*event_type, num_gpib_events(queue)); =20 return 0; } =20 // pop event from front of event queue -int pop_gpib_event(gpib_event_queue_t *queue, short *event_type) +int pop_gpib_event(gpib_board_t *board, gpib_event_queue_t *queue, short *= event_type) { unsigned long flags; int retval; =20 spin_lock_irqsave(&queue->lock, flags); - retval =3D pop_gpib_event_nolock(queue, event_type); + retval =3D pop_gpib_event_nolock(board, queue, event_type); spin_unlock_irqrestore(&queue->lock, flags); return retval; } @@ -2017,7 +2025,7 @@ static int event_ioctl(gpib_board_t *board, unsigned = long arg) int retval; short event; =20 - retval =3D pop_gpib_event(&board->event_queue, &event); + retval =3D pop_gpib_event(board, &board->event_queue, &event); if (retval < 0) return retval; =20 @@ -2199,7 +2207,7 @@ void gpib_deallocate_board(gpib_board_t *board) board->buffer_length =3D 0; } while (num_gpib_events(&board->event_queue)) - pop_gpib_event(&board->event_queue, &dummy); + pop_gpib_event(board, &board->event_queue, &dummy); } =20 static void init_board_array(gpib_board_t *board_array, unsigned int lengt= h) diff --git a/drivers/staging/gpib/common/iblib.c b/drivers/staging/gpib/com= mon/iblib.c index 83795e7f5cf1..fc57e760c144 100644 --- a/drivers/staging/gpib/common/iblib.c +++ b/drivers/staging/gpib/common/iblib.c @@ -178,13 +178,13 @@ static int autospoll_thread(void *board_void) gpib_board_t *board =3D board_void; int retval =3D 0; =20 - GPIB_DPRINTK("entering autospoll thread\n"); + dev_dbg(board->gpib_dev, "entering autospoll thread\n"); =20 while (1) { wait_event_interruptible(board->wait, kthread_should_stop() || autospoll_wait_should_wake_up(board)); - GPIB_DPRINTK("autospoll wait satisfied\n"); + dev_dbg(board->gpib_dev, "autospoll wait satisfied\n"); if (kthread_should_stop()) break; =20 @@ -247,7 +247,7 @@ int ibonline(gpib_board_t *board) } #endif board->online =3D 1; - GPIB_DPRINTK("gpib: board online\n"); + dev_dbg(board->gpib_dev, "gpib: board online\n"); =20 return 0; } @@ -272,7 +272,7 @@ int iboffline(gpib_board_t *board) board->interface->detach(board); gpib_deallocate_board(board); board->online =3D 0; - GPIB_DPRINTK("gpib: board offline\n"); + dev_dbg(board->gpib_dev, "gpib: board offline\n"); =20 return 0; } @@ -436,7 +436,7 @@ int ibsic(gpib_board_t *board, unsigned int usec_durati= on) pr_warn("gpib: warning, shortening long udelay\n"); } =20 - GPIB_DPRINTK("sending interface clear\n"); + dev_dbg(board->gpib_dev, "sending interface clear\n"); board->interface->interface_clear(board, 1); udelay(usec_duration); board->interface->interface_clear(board, 0); @@ -486,7 +486,7 @@ int ibpad(gpib_board_t *board, unsigned int addr) board->pad =3D addr; if (board->online) board->interface->primary_address(board, board->pad); - GPIB_DPRINTK("set primary addr to %i\n", board->pad); + dev_dbg(board->gpib_dev, "set primary addr to %i\n", board->pad); return 0; } =20 @@ -509,7 +509,7 @@ int ibsad(gpib_board_t *board, int addr) else board->interface->secondary_address(board, 0, 0); } - GPIB_DPRINTK("set secondary addr to %i\n", board->sad); + dev_dbg(board->gpib_dev, "set secondary addr to %i\n", board->sad); =20 return 0; } @@ -683,7 +683,7 @@ int ibwait(gpib_board_t *board, int wait_mask, int clea= r_mask, int set_mask, =20 if (wait_event_interruptible(board->wait, wait_satisfied(&winfo, status_q= ueue, wait_mask, status, desc))) { - GPIB_DPRINTK("wait interrupted\n"); + dev_dbg(board->gpib_dev, "wait interrupted\n"); retval =3D -ERESTARTSYS; } remove_wait_timer(&winfo); diff --git a/drivers/staging/gpib/common/ibsys.h b/drivers/staging/gpib/com= mon/ibsys.h index 3f53a808a9b9..b78ca5ea4da1 100644 --- a/drivers/staging/gpib/common/ibsys.h +++ b/drivers/staging/gpib/common/ibsys.h @@ -20,8 +20,8 @@ int gpib_allocate_board(gpib_board_t *board); void gpib_deallocate_board(gpib_board_t *board); =20 unsigned int num_status_bytes(const gpib_status_queue_t *dev); -int push_status_byte(gpib_status_queue_t *device, uint8_t poll_byte); -int pop_status_byte(gpib_status_queue_t *device, uint8_t *poll_byte); +int push_status_byte(gpib_board_t *board, gpib_status_queue_t *device, uin= t8_t poll_byte); +int pop_status_byte(gpib_board_t *board, gpib_status_queue_t *device, uint= 8_t *poll_byte); gpib_status_queue_t *get_gpib_status_queue(gpib_board_t *board, unsigned i= nt pad, int sad); int get_serial_poll_byte(gpib_board_t *board, unsigned int pad, int sad, unsigned int usec_timeout, uint8_t *poll_byte); diff --git a/drivers/staging/gpib/eastwood/fluke_gpib.c b/drivers/staging/g= pib/eastwood/fluke_gpib.c index b528405f33e0..3f938ab0c84d 100644 --- a/drivers/staging/gpib/eastwood/fluke_gpib.c +++ b/drivers/staging/gpib/eastwood/fluke_gpib.c @@ -430,7 +430,7 @@ static int fluke_dma_write(gpib_board_t *board, uint8_t= *buffer, size_t length, test_bit(BUS_ERROR_BN, &nec_priv->state) || test_bit(DEV_CLEAR_BN, &nec_priv->state) || test_bit(TIMO_NUM, &board->status))) { - GPIB_DPRINTK("gpib write interrupted!\n"); + dev_dbg(board->gpib_dev, "gpib write interrupted!\n"); retval =3D -ERESTARTSYS; } if (test_bit(TIMO_NUM, &board->status)) diff --git a/drivers/staging/gpib/fmh_gpib/fmh_gpib.c b/drivers/staging/gpi= b/fmh_gpib/fmh_gpib.c index 73409b066727..62791db1c34a 100644 --- a/drivers/staging/gpib/fmh_gpib/fmh_gpib.c +++ b/drivers/staging/gpib/fmh_gpib/fmh_gpib.c @@ -440,7 +440,7 @@ static int fmh_gpib_dma_write(gpib_board_t *board, uint= 8_t *buffer, size_t lengt test_bit(BUS_ERROR_BN, &nec_priv->state) || test_bit(DEV_CLEAR_BN, &nec_priv->state) || test_bit(TIMO_NUM, &board->status))) { - GPIB_DPRINTK("gpib write interrupted!\n"); + dev_dbg(board->gpib_dev, "gpib write interrupted!\n"); retval =3D -ERESTARTSYS; } if (test_bit(TIMO_NUM, &board->status)) @@ -634,7 +634,7 @@ static int fmh_gpib_fifo_write_countable(gpib_board_t *= board, uint8_t *buffer, test_bit(BUS_ERROR_BN, &nec_priv->state) || test_bit(DEV_CLEAR_BN, &nec_priv->state) || test_bit(TIMO_NUM, &board->status))) { - GPIB_DPRINTK("gpib write interrupted!\n"); + dev_dbg(board->gpib_dev, "gpib write interrupted!\n"); retval =3D -ERESTARTSYS; } if (test_bit(TIMO_NUM, &board->status)) diff --git a/drivers/staging/gpib/include/gpibP.h b/drivers/staging/gpib/in= clude/gpibP.h index 0129fd29e704..5fc42b645ab7 100644 --- a/drivers/staging/gpib/include/gpibP.h +++ b/drivers/staging/gpib/include/gpibP.h @@ -26,7 +26,7 @@ struct pci_dev *gpib_pci_get_subsys(const gpib_board_conf= ig_t *config, unsigned unsigned int ss_device, struct pci_dev *from); unsigned int num_gpib_events(const gpib_event_queue_t *queue); int push_gpib_event(gpib_board_t *board, short event_type); -int pop_gpib_event(gpib_event_queue_t *queue, short *event_type); +int pop_gpib_event(gpib_board_t *board, gpib_event_queue_t *queue, short *= event_type); int gpib_request_pseudo_irq(gpib_board_t *board, irqreturn_t (*handler)(in= t, void *)); void gpib_free_pseudo_irq(gpib_board_t *board); int gpib_match_device_path(struct device *dev, const char *device_path_in); @@ -35,12 +35,6 @@ extern gpib_board_t board_array[GPIB_MAX_NUM_BOARDS]; =20 extern struct list_head registered_drivers; =20 -#ifdef GPIB_DEBUG -#define GPIB_DPRINTK(format, args...) pr_info("gpib debug: " format, ## ar= gs) -#else -#define GPIB_DPRINTK(arg...) -#endif - #include =20 void writeb_wrapper(unsigned int value, void *address); diff --git a/drivers/staging/gpib/ines/ines_gpib.c b/drivers/staging/gpib/i= nes/ines_gpib.c index e98a114a9570..9d8387c3bf01 100644 --- a/drivers/staging/gpib/ines/ines_gpib.c +++ b/drivers/staging/gpib/ines/ines_gpib.c @@ -202,7 +202,7 @@ static int ines_write_wait(gpib_board_t *board, struct = ines_priv *ines_priv, test_bit(BUS_ERROR_BN, &nec_priv->state) || test_bit(DEV_CLEAR_BN, &nec_priv->state) || test_bit(TIMO_NUM, &board->status))) { - GPIB_DPRINTK("gpib write interrupted\n"); + dev_dbg(board->gpib_dev, "gpib write interrupted\n"); return -ERESTARTSYS; } if (test_bit(BUS_ERROR_BN, &nec_priv->state)) diff --git a/drivers/staging/gpib/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 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 15:51:27 2024 Received: from mail-wr1-f46.google.com (mail-wr1-f46.google.com [209.85.221.46]) (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 8B6511C9B87 for ; Mon, 4 Nov 2024 17:50:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.46 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730742632; cv=none; b=abn/w66xJmMHKimCTbZi9M4sNcnqfdjD5n9as0Z6Eo5lHEENoVy0kJ5O72rqyan8B6y1Do/zzcQMJgl9fsNOw5UXFi4oWWeUPtRS4kFxZbhQGGu0z0ZfBNTImlnhoXR1hIM21+PeqvYJAN0dKP4k/8cHeyPx16IYUFyvYasrJS0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730742632; c=relaxed/simple; bh=8tOooZSqjZLktK11SFQlQMuq3FUWL4flmY68otICPp0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=XZd10L2v83Ofh/0JzN/uwfNX8jTYIa2cafOJxi8BBxX47akORqMnjGXoaNFqq2LuY4foG1DO3b8iLLllyOYKHMhGuUpJOrXQZK7kM+WUkDSe2/W/Y+KLsxt4wGhXBbtarfVWqHKY8Ax41oWMI2rh39LJcRzVjkWivu+u1VNjCNk= 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=c51q/fs+; arc=none smtp.client-ip=209.85.221.46 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="c51q/fs+" Received: by mail-wr1-f46.google.com with SMTP id ffacd0b85a97d-37d473c4bb6so4107682f8f.3 for ; Mon, 04 Nov 2024 09:50:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1730742626; x=1731347426; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=LuHJvsgGH4bf1MV0j7IEBdB41iQSPKkdiyMMwagJFNc=; b=c51q/fs+zdMu/cXnSNqAcfZqw63OEjZsJI0HAfa1fAGqX6RvzIkV6fe8BXXU/2XpJb JdSLDKUqJclGzwZW8+hMzfyNA3w4Kfq9wqyZkMtvbWX4cyfuUa8Tqh+YUWMP8GwqsSUS oebUz3WtSAD3+X4rQuUpqnfm5a5/ziTUK+QA8LBT2msF90VbUIUeU3pyQnZl1vbTdNbD cVUwr2gBs9T9+lLlKW5t45SnkX+hQRG5TZE62ayMrwaCJJPQxPDSBJWwbw9RZeSJXWmX i18fl1cdP0WQI2zw2uTCyAhMKWvRpv00/dUn6m+WWp2CJbf7FOFROo89H6yZ+XrPef3K FpuA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730742626; x=1731347426; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=LuHJvsgGH4bf1MV0j7IEBdB41iQSPKkdiyMMwagJFNc=; b=WpWjEZJsDZVdMhmdynZTmd+ZrX5HV8ENTO/7dtDktkeJknGrxSwUphsLYk4LpIM7z3 jBVXW0kDD/PV/tLK8EmHAf20oXSmcjeEDOm9WwRYIrG3r55GCg0M4L6vm/DRuQXrRg2e zVpvrJZkxoHc9/XD8Og5VgdXKjjwDbKEBrUCpnaP1y0dpsaMRba4n1aDYhlILwjU8Ocu FY3pnHgaZ6n//+O5pkKXSriJBoK6jtZNHta4BHIOHpWEI+ZJdfUx97cfxdXLInrSBFaj 808fitNaMCOFJJvaDdrP8L1zkS5bs4LxoAGp+UiltBoclsFZQfNuVW+aGFl8IbaWvj7V wBiA== X-Forwarded-Encrypted: i=1; AJvYcCXgvf+1MeK8dGhzlcGr8qXfY/EfxNmLPi6JN0z2Ir2XP+/Qvgx6TvuLiL4nepqb0CgFTI2EUpTmVgfgV64=@vger.kernel.org X-Gm-Message-State: AOJu0YxwE390KdAP80DONW0gqRylgbEzLdgEsJYtGiJ+9odvoRueId3K N6qKWS6u2y79cABVxgZbr6nclALT80/7fuGIM3HmcS7+zy20Jq0sQukuSMKU X-Google-Smtp-Source: AGHT+IFy8YOrqa1Ii6eyH9aHtpsD5NvhiCyFv0/F0LAEc9x36e9F2WlSjfjAkCymHhM0xbJ7wiDjcw== X-Received: by 2002:a05:6000:a12:b0:37c:d2e3:1298 with SMTP id ffacd0b85a97d-381c7ae0b41mr14005072f8f.55.1730742625544; Mon, 04 Nov 2024 09:50:25 -0800 (PST) Received: from localhost.localdomain (82-64-73-52.subs.proxad.net. [82.64.73.52]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-381c10b7f80sm13839821f8f.20.2024.11.04.09.50.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Nov 2024 09:50:24 -0800 (PST) From: Dave Penkler To: gregkh@linuxfoundation.org, linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org Cc: skhan@linuxfoundation.org, arnd@arndb.de, dan.carpenter@linaro.org, Dave Penkler Subject: [PATCH v3 03/12] staging: gpib: Update messaging and usb_device refs in ni_usb Date: Mon, 4 Nov 2024 18:50:04 +0100 Message-ID: <20241104175014.12317-4-dpenkler@gmail.com> X-Mailer: git-send-email 2.46.2 In-Reply-To: <20241104175014.12317-1-dpenkler@gmail.com> References: <20241104175014.12317-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 Reviewed-by: Dan Carpenter --- drivers/staging/gpib/ni_usb/ni_usb_gpib.c | 376 ++++++++++++---------- 1 file changed, 204 insertions(+), 172 deletions(-) diff --git a/drivers/staging/gpib/ni_usb/ni_usb_gpib.c b/drivers/staging/gp= ib/ni_usb/ni_usb_gpib.c index b7550a937f15..b7b6fb1be379 100644 --- a/drivers/staging/gpib/ni_usb/ni_usb_gpib.c +++ b/drivers/staging/gpib/ni_usb/ni_usb_gpib.c @@ -132,13 +132,13 @@ static int ni_usb_nonblocking_send_bulk_msg(struct ni= _usb_priv *ni_priv, void *d if (timeout_msecs) mod_timer(&ni_priv->bulk_timer, jiffies + msecs_to_jiffies(timeout_msecs= )); =20 - //pr_err("%s: submitting urb\n", __func__); retval =3D usb_submit_urb(ni_priv->bulk_urb, GFP_KERNEL); if (retval) { del_timer_sync(&ni_priv->bulk_timer); usb_free_urb(ni_priv->bulk_urb); ni_priv->bulk_urb =3D NULL; - pr_err("%s: failed to submit bulk out urb, retval=3D%i\n", __func__, ret= val); + dev_err(&usb_dev->dev, "%s: failed to submit bulk out urb, retval=3D%i\n= ", + __func__, retval); mutex_unlock(&ni_priv->bulk_transfer_lock); return retval; } @@ -146,7 +146,7 @@ static int ni_usb_nonblocking_send_bulk_msg(struct ni_u= sb_priv *ni_priv, void *d down(&context->complete); // wait for ni_usb_bulk_complete if (context->timed_out) { usb_kill_urb(ni_priv->bulk_urb); - pr_err("%s: killed urb due to timeout\n", __func__); + dev_err(&usb_dev->dev, "%s: killed urb due to timeout\n", __func__); retval =3D -ETIMEDOUT; } else { retval =3D ni_priv->bulk_urb->status; @@ -224,7 +224,8 @@ static int ni_usb_nonblocking_receive_bulk_msg(struct n= i_usb_priv *ni_priv, del_timer_sync(&ni_priv->bulk_timer); usb_free_urb(ni_priv->bulk_urb); ni_priv->bulk_urb =3D NULL; - pr_err("%s: failed to submit bulk out urb, retval=3D%i\n", __func__, ret= val); + dev_err(&usb_dev->dev, "%s: failed to submit bulk out urb, retval=3D%i\n= ", + __func__, retval); mutex_unlock(&ni_priv->bulk_transfer_lock); return retval; } @@ -249,7 +250,7 @@ static int ni_usb_nonblocking_receive_bulk_msg(struct n= i_usb_priv *ni_priv, } if (context->timed_out) { usb_kill_urb(ni_priv->bulk_urb); - pr_err("%s: killed urb due to timeout\n", __func__); + dev_err(&usb_dev->dev, "%s: killed urb due to timeout\n", __func__); retval =3D -ETIMEDOUT; } else { if (ni_priv->bulk_urb->status) @@ -315,6 +316,7 @@ static void ni_usb_soft_update_status(gpib_board_t *boa= rd, unsigned int ni_usb_i static const unsigned int ni_usb_ibsta_mask =3D SRQI | ATN | CIC | REM | = LACS | TACS | LOK; =20 struct ni_usb_priv *ni_priv =3D board->private_data; + struct usb_device *usb_dev =3D interface_to_usbdev(ni_priv->bus_interface= ); unsigned int need_monitoring_bits =3D ni_usb_ibsta_monitor_mask; unsigned long flags; =20 @@ -328,15 +330,14 @@ static void ni_usb_soft_update_status(gpib_board_t *b= oard, unsigned int ni_usb_i ni_priv->monitored_ibsta_bits &=3D ~ni_usb_ibsta; need_monitoring_bits &=3D ~ni_priv->monitored_ibsta_bits; /* mm - monitor= ed set */ spin_unlock_irqrestore(&board->spinlock, flags); - - GPIB_DPRINTK("%s: need_monitoring_bits=3D0x%x\n", __func__, need_monitori= ng_bits); + dev_dbg(&usb_dev->dev, "%s: need_monitoring_bits=3D0x%x\n", __func__, nee= d_monitoring_bits); =20 if (need_monitoring_bits & ~ni_usb_ibsta) ni_usb_set_interrupt_monitor(board, ni_usb_ibsta_monitor_mask); else if (need_monitoring_bits & ni_usb_ibsta) wake_up_interruptible(&board->wait); =20 - GPIB_DPRINTK("%s: ni_usb_ibsta=3D0x%x\n", __func__, ni_usb_ibsta); + dev_dbg(&usb_dev->dev, "%s: ni_usb_ibsta=3D0x%x\n", __func__, ni_usb_ibst= a); } =20 static int ni_usb_parse_status_block(const u8 *buffer, struct ni_usb_statu= s_block *status) @@ -355,7 +356,6 @@ static int ni_usb_parse_status_block(const u8 *buffer, = struct ni_usb_status_bloc =20 static void ni_usb_dump_raw_block(const u8 *raw_data, int length) { - pr_info("hex block dump\n"); print_hex_dump(KERN_INFO, "", DUMP_PREFIX_NONE, 8, 1, raw_data, length, t= rue); } =20 @@ -516,6 +516,7 @@ static int ni_usb_write_registers(struct ni_usb_priv *n= i_priv, const struct ni_usb_register *writes, int num_writes, unsigned int *ibsta) { + struct usb_device *usb_dev =3D interface_to_usbdev(ni_priv->bus_interface= ); int retval; u8 *out_data, *in_data; int out_data_length; @@ -530,7 +531,7 @@ static int ni_usb_write_registers(struct ni_usb_priv *n= i_priv, out_data_length =3D num_writes * bytes_per_write + 0x10; out_data =3D kmalloc(out_data_length, GFP_KERNEL); if (!out_data) { - pr_err("%s: kmalloc failed\n", __func__); + dev_err(&usb_dev->dev, "%s: kmalloc failed\n", __func__); return -ENOMEM; } i +=3D ni_usb_bulk_register_write_header(&out_data[i], num_writes); @@ -540,7 +541,7 @@ static int ni_usb_write_registers(struct ni_usb_priv *n= i_priv, out_data[i++] =3D 0x00; i +=3D ni_usb_bulk_termination(&out_data[i]); if (i > out_data_length) - pr_err("%s: bug! buffer overrun\n", __func__); + dev_err(&usb_dev->dev, "%s: bug! buffer overrun\n", __func__); =20 mutex_lock(&ni_priv->addressed_transfer_lock); =20 @@ -548,22 +549,22 @@ static int ni_usb_write_registers(struct ni_usb_priv = *ni_priv, kfree(out_data); if (retval) { mutex_unlock(&ni_priv->addressed_transfer_lock); - pr_err("%s: ni_usb_send_bulk_msg returned %i, bytes_written=3D%i, i=3D%i= \n", - __func__, retval, bytes_written, i); + dev_err(&usb_dev->dev, "%s: ni_usb_send_bulk_msg returned %i, bytes_writ= ten=3D%i, i=3D%i\n", + __func__, retval, bytes_written, i); return retval; } =20 in_data =3D kmalloc(in_data_length, GFP_KERNEL); if (!in_data) { mutex_unlock(&ni_priv->addressed_transfer_lock); - pr_err("%s: kmalloc failed\n", __func__); + dev_err(&usb_dev->dev, "%s: kmalloc failed\n", __func__); return -ENOMEM; } retval =3D ni_usb_receive_bulk_msg(ni_priv, in_data, in_data_length, &byt= es_read, 1000, 0); if (retval || bytes_read !=3D 16) { mutex_unlock(&ni_priv->addressed_transfer_lock); - pr_err("%s: ni_usb_receive_bulk_msg returned %i, bytes_read=3D%i\n", - __func__, retval, bytes_read); + dev_err(&usb_dev->dev, "%s: ni_usb_receive_bulk_msg returned %i, bytes_r= ead=3D%i\n", + __func__, retval, bytes_read); ni_usb_dump_raw_block(in_data, bytes_read); kfree(in_data); return retval; @@ -575,17 +576,18 @@ static int ni_usb_write_registers(struct ni_usb_priv = *ni_priv, //FIXME parse extra 09 status bits and termination kfree(in_data); if (status.id !=3D NIUSB_REG_WRITE_ID) { - pr_err("%s: parse error, id=3D0x%x !=3D NIUSB_REG_WRITE_ID\n", - __func__, status.id); + dev_err(&usb_dev->dev, "%s: parse error, id=3D0x%x !=3D NIUSB_REG_WRITE_= ID\n", + __func__, status.id); return -EIO; } if (status.error_code) { - pr_err("%s: nonzero error code 0x%x\n", __func__, status.error_code); + dev_err(&usb_dev->dev, "%s: nonzero error code 0x%x\n", + __func__, status.error_code); return -EIO; } if (reg_writes_completed !=3D num_writes) { - pr_err("%s: reg_writes_completed=3D%i, num_writes=3D%i\n", __func__, - reg_writes_completed, num_writes); + dev_err(&usb_dev->dev, "%s: reg_writes_completed=3D%i, num_writes=3D%i\n= ", + __func__, reg_writes_completed, num_writes); return -EIO; } if (ibsta) @@ -599,6 +601,7 @@ static int ni_usb_read(gpib_board_t *board, uint8_t *bu= ffer, size_t length, { int retval, parse_retval; struct ni_usb_priv *ni_priv =3D board->private_data; + struct usb_device *usb_dev =3D interface_to_usbdev(ni_priv->bus_interface= ); u8 *out_data, *in_data; static const int out_data_length =3D 0x20; int in_data_length; @@ -613,7 +616,7 @@ static int ni_usb_read(gpib_board_t *board, uint8_t *bu= ffer, size_t length, *bytes_read =3D 0; if (length > max_read_length) { length =3D max_read_length; - pr_err("%s: read length too long\n", __func__); + dev_err(&usb_dev->dev, "%s: read length too long\n", __func__); } out_data =3D kmalloc(out_data_length, GFP_KERNEL); if (!out_data) @@ -646,8 +649,8 @@ static int ni_usb_read(gpib_board_t *board, uint8_t *bu= ffer, size_t length, if (retval || usb_bytes_written !=3D i) { if (retval =3D=3D 0) retval =3D -EIO; - pr_err("%s: ni_usb_send_bulk_msg returned %i, usb_bytes_written=3D%i, i= =3D%i\n", - __func__, retval, usb_bytes_written, i); + dev_err(&usb_dev->dev, "%s: ni_usb_send_bulk_msg returned %i, usb_bytes_= written=3D%i, i=3D%i\n", + __func__, retval, usb_bytes_written, i); mutex_unlock(&ni_priv->addressed_transfer_lock); return retval; } @@ -665,8 +668,8 @@ static int ni_usb_read(gpib_board_t *board, uint8_t *bu= ffer, size_t length, =20 if (retval =3D=3D -ERESTARTSYS) { } else if (retval) { - pr_err("%s: ni_usb_receive_bulk_msg returned %i, usb_bytes_read=3D%i\n", - __func__, retval, usb_bytes_read); + dev_err(&usb_dev->dev, "%s: ni_usb_receive_bulk_msg returned %i, usb_byt= es_read=3D%i\n", + __func__, retval, usb_bytes_read); kfree(in_data); return retval; } @@ -674,14 +677,14 @@ static int ni_usb_read(gpib_board_t *board, uint8_t *= buffer, size_t length, if (parse_retval !=3D usb_bytes_read) { if (parse_retval >=3D 0) parse_retval =3D -EIO; - pr_err("%s: retval=3D%i usb_bytes_read=3D%i\n", - __func__, parse_retval, usb_bytes_read); + dev_err(&usb_dev->dev, "%s: retval=3D%i usb_bytes_read=3D%i\n", + __func__, parse_retval, usb_bytes_read); kfree(in_data); return parse_retval; } if (actual_length !=3D length - status.count) { - pr_err("%s: actual_length=3D%i expected=3D%li\n", - __func__, actual_length, (long)(length - status.count)); + dev_err(&usb_dev->dev, "%s: actual_length=3D%i expected=3D%li\n", + __func__, actual_length, (long)(length - status.count)); ni_usb_dump_raw_block(in_data, usb_bytes_read); } kfree(in_data); @@ -696,7 +699,7 @@ static int ni_usb_read(gpib_board_t *board, uint8_t *bu= ffer, size_t length, break; case NIUSB_ATN_STATE_ERROR: retval =3D -EIO; - pr_err("%s: read when ATN set\n", __func__); + dev_err(&usb_dev->dev, "%s: read when ATN set\n", __func__); break; case NIUSB_ADDRESSING_ERROR: retval =3D -EIO; @@ -705,12 +708,12 @@ static int ni_usb_read(gpib_board_t *board, uint8_t *= buffer, size_t length, retval =3D -ETIMEDOUT; break; case NIUSB_EOSMODE_ERROR: - pr_err("%s: driver bug, we should have been able to avoid NIUSB_EOSMODE_= ERROR.\n", - __func__); + dev_err(&usb_dev->dev, "%s: driver bug, we should have been able to avoi= d NIUSB_EOSMODE_ERROR.\n", + __func__); retval =3D -EINVAL; break; default: - pr_err("%s: unknown error code=3D%i\n", __func__, status.error_code); + dev_err(&usb_dev->dev, "%s: unknown error code=3D%i\n", __func__, status= .error_code); retval =3D -EIO; break; } @@ -728,6 +731,7 @@ static int ni_usb_write(gpib_board_t *board, uint8_t *b= uffer, size_t length, { int retval; struct ni_usb_priv *ni_priv =3D board->private_data; + struct usb_device *usb_dev =3D interface_to_usbdev(ni_priv->bus_interface= ); u8 *out_data, *in_data; int out_data_length; static const int in_data_length =3D 0x10; @@ -741,7 +745,7 @@ static int ni_usb_write(gpib_board_t *board, uint8_t *b= uffer, size_t length, if (length > max_write_length) { length =3D max_write_length; send_eoi =3D 0; - pr_err("%s: write length too long\n", __func__); + dev_err(&usb_dev->dev, "%s: write length too long\n", __func__); } out_data_length =3D length + 0x10; out_data =3D kmalloc(out_data_length, GFP_KERNEL); @@ -773,8 +777,8 @@ static int ni_usb_write(gpib_board_t *board, uint8_t *b= uffer, size_t length, kfree(out_data); if (retval || usb_bytes_written !=3D i) { mutex_unlock(&ni_priv->addressed_transfer_lock); - pr_err("%s: ni_usb_send_bulk_msg returned %i, usb_bytes_written=3D%i, i= =3D%i\n", - __func__, retval, usb_bytes_written, i); + dev_err(&usb_dev->dev, "%s: ni_usb_send_bulk_msg returned %i, usb_bytes_= written=3D%i, i=3D%i\n", + __func__, retval, usb_bytes_written, i); return retval; } =20 @@ -787,8 +791,8 @@ static int ni_usb_write(gpib_board_t *board, uint8_t *b= uffer, size_t length, mutex_unlock(&ni_priv->addressed_transfer_lock); =20 if ((retval && retval !=3D -ERESTARTSYS) || usb_bytes_read !=3D 12) { - pr_err("%s: ni_usb_receive_bulk_msg returned %i, usb_bytes_read=3D%i\n", - __func__, retval, usb_bytes_read); + dev_err(&usb_dev->dev, "%s: ni_usb_receive_bulk_msg returned %i, usb_byt= es_read=3D%i\n", + __func__, retval, usb_bytes_read); kfree(in_data); return retval; } @@ -804,8 +808,8 @@ static int ni_usb_write(gpib_board_t *board, uint8_t *b= uffer, size_t length, */ break; case NIUSB_ADDRESSING_ERROR: - pr_err("%s: Addressing error retval %d error code=3D%i\n", - __func__, retval, status.error_code); + dev_err(&usb_dev->dev, "%s: Addressing error retval %d error code=3D%i\n= ", + __func__, retval, status.error_code); retval =3D -ENXIO; break; case NIUSB_NO_LISTENER_ERROR: @@ -815,8 +819,8 @@ static int ni_usb_write(gpib_board_t *board, uint8_t *b= uffer, size_t length, retval =3D -ETIMEDOUT; break; default: - pr_err("%s: unknown error code=3D%i\n", - __func__, status.error_code); + dev_err(&usb_dev->dev, "%s: unknown error code=3D%i\n", + __func__, status.error_code); retval =3D -EPIPE; break; } @@ -830,6 +834,7 @@ static int ni_usb_command_chunk(gpib_board_t *board, ui= nt8_t *buffer, size_t len { int retval; struct ni_usb_priv *ni_priv =3D board->private_data; + struct usb_device *usb_dev =3D interface_to_usbdev(ni_priv->bus_interface= ); u8 *out_data, *in_data; int out_data_length; static const int in_data_length =3D 0x10; @@ -866,8 +871,8 @@ static int ni_usb_command_chunk(gpib_board_t *board, ui= nt8_t *buffer, size_t len kfree(out_data); if (retval || bytes_written !=3D i) { mutex_unlock(&ni_priv->addressed_transfer_lock); - pr_err("%s: ni_usb_send_bulk_msg returned %i, bytes_written=3D%i, i=3D%i= \n", - __func__, retval, bytes_written, i); + dev_err(&usb_dev->dev, "%s: ni_usb_send_bulk_msg returned %i, bytes_writ= ten=3D%i, i=3D%i\n", + __func__, retval, bytes_written, i); return retval; } =20 @@ -883,8 +888,8 @@ static int ni_usb_command_chunk(gpib_board_t *board, ui= nt8_t *buffer, size_t len mutex_unlock(&ni_priv->addressed_transfer_lock); =20 if ((retval && retval !=3D -ERESTARTSYS) || bytes_read !=3D 12) { - pr_err("%s: ni_usb_receive_bulk_msg returned %i, bytes_read=3D%i\n", - __func__, retval, bytes_read); + dev_err(&usb_dev->dev, "%s: ni_usb_receive_bulk_msg returned %i, bytes_r= ead=3D%i\n", + __func__, retval, bytes_read); kfree(in_data); return retval; } @@ -902,12 +907,12 @@ static int ni_usb_command_chunk(gpib_board_t *board, = uint8_t *buffer, size_t len case NIUSB_NO_BUS_ERROR: return -ENOTCONN; case NIUSB_EOSMODE_ERROR: - pr_err("%s: got eosmode error. Driver bug?\n", __func__); + dev_err(&usb_dev->dev, "%s: got eosmode error. Driver bug?\n", __func__); return -EIO; case NIUSB_TIMEOUT_ERROR: return -ETIMEDOUT; default: - pr_err("%s: unknown error code=3D%i\n", __func__, status.error_code); + dev_err(&usb_dev->dev, "%s: unknown error code=3D%i\n", __func__, status= .error_code); return -EIO; } ni_usb_soft_update_status(board, status.ibsta, 0); @@ -935,6 +940,7 @@ static int ni_usb_take_control(gpib_board_t *board, int= synchronous) { int retval; struct ni_usb_priv *ni_priv =3D board->private_data; + struct usb_device *usb_dev =3D interface_to_usbdev(ni_priv->bus_interface= ); u8 *out_data, *in_data; static const int out_data_length =3D 0x10; static const int in_data_length =3D 0x10; @@ -960,15 +966,15 @@ static int ni_usb_take_control(gpib_board_t *board, i= nt synchronous) kfree(out_data); if (retval || bytes_written !=3D i) { mutex_unlock(&ni_priv->addressed_transfer_lock); - pr_err("%s: ni_usb_send_bulk_msg returned %i, bytes_written=3D%i, i=3D%i= \n", - __func__, retval, bytes_written, i); + dev_err(&usb_dev->dev, "%s: ni_usb_send_bulk_msg returned %i, bytes_writ= ten=3D%i, i=3D%i\n", + __func__, retval, bytes_written, i); return retval; } =20 in_data =3D kmalloc(in_data_length, GFP_KERNEL); if (!in_data) { mutex_unlock(&ni_priv->addressed_transfer_lock); - pr_err("%s: kmalloc failed\n", __func__); + dev_err(&usb_dev->dev, "%s: kmalloc failed\n", __func__); return -ENOMEM; } retval =3D ni_usb_receive_bulk_msg(ni_priv, in_data, in_data_length, &byt= es_read, 1000, 1); @@ -978,8 +984,8 @@ static int ni_usb_take_control(gpib_board_t *board, int= synchronous) if ((retval && retval !=3D -ERESTARTSYS) || bytes_read !=3D 12) { if (retval =3D=3D 0) retval =3D -EIO; - pr_err("%s: ni_usb_receive_bulk_msg returned %i, bytes_read=3D%i\n", - __func__, retval, bytes_read); + dev_err(&usb_dev->dev, "%s: ni_usb_receive_bulk_msg returned %i, bytes_r= ead=3D%i\n", + __func__, retval, bytes_read); kfree(in_data); return retval; } @@ -993,6 +999,7 @@ static int ni_usb_go_to_standby(gpib_board_t *board) { int retval; struct ni_usb_priv *ni_priv =3D board->private_data; + struct usb_device *usb_dev =3D interface_to_usbdev(ni_priv->bus_interface= ); u8 *out_data, *in_data; static const int out_data_length =3D 0x10; static const int in_data_length =3D 0x20; @@ -1016,15 +1023,15 @@ static int ni_usb_go_to_standby(gpib_board_t *board) kfree(out_data); if (retval || bytes_written !=3D i) { mutex_unlock(&ni_priv->addressed_transfer_lock); - pr_err("%s: ni_usb_send_bulk_msg returned %i, bytes_written=3D%i, i=3D%i= \n", - __func__, retval, bytes_written, i); + dev_err(&usb_dev->dev, "%s: ni_usb_send_bulk_msg returned %i, bytes_writ= ten=3D%i, i=3D%i\n", + __func__, retval, bytes_written, i); return retval; } =20 in_data =3D kmalloc(in_data_length, GFP_KERNEL); if (!in_data) { mutex_unlock(&ni_priv->addressed_transfer_lock); - pr_err("%s: kmalloc failed\n", __FILE__); + dev_err(&usb_dev->dev, "%s: kmalloc failed\n", __func__); return -ENOMEM; } retval =3D ni_usb_receive_bulk_msg(ni_priv, in_data, in_data_length, &byt= es_read, 1000, 0); @@ -1032,16 +1039,16 @@ static int ni_usb_go_to_standby(gpib_board_t *board) mutex_unlock(&ni_priv->addressed_transfer_lock); =20 if (retval || bytes_read !=3D 12) { - pr_err("%s: ni_usb_receive_bulk_msg returned %i, bytes_read=3D%i\n", - __func__, retval, bytes_read); + dev_err(&usb_dev->dev, "%s: ni_usb_receive_bulk_msg returned %i, bytes_r= ead=3D%i\n", + __func__, retval, bytes_read); kfree(in_data); return retval; } ni_usb_parse_status_block(in_data, &status); kfree(in_data); if (status.id !=3D NIUSB_IBGTS_ID) - pr_err("%s: bug: status.id 0x%x !=3D INUSB_IBGTS_ID\n", - __func__, status.id); + dev_err(&usb_dev->dev, "%s: bug: status.id 0x%x !=3D INUSB_IBGTS_ID\n", + __func__, status.id); ni_usb_soft_update_status(board, status.ibsta, 0); return 0; } @@ -1050,6 +1057,7 @@ static void ni_usb_request_system_control(gpib_board_= t *board, int request_contr { int retval; struct ni_usb_priv *ni_priv =3D board->private_data; + struct usb_device *usb_dev =3D interface_to_usbdev(ni_priv->bus_interface= ); int i =3D 0; struct ni_usb_register writes[4]; unsigned int ibsta; @@ -1083,7 +1091,7 @@ static void ni_usb_request_system_control(gpib_board_= t *board, int request_contr } retval =3D ni_usb_write_registers(ni_priv, writes, i, &ibsta); if (retval < 0) { - pr_err("%s: register write failed, retval=3D%i\n", __func__, retval); + dev_err(&usb_dev->dev, "%s: register write failed, retval=3D%i\n", __fun= c__, retval); return; // retval; } if (!request_control) @@ -1097,6 +1105,7 @@ static void ni_usb_interface_clear(gpib_board_t *boar= d, int assert) { int retval; struct ni_usb_priv *ni_priv =3D board->private_data; + struct usb_device *usb_dev =3D interface_to_usbdev(ni_priv->bus_interface= ); u8 *out_data, *in_data; static const int out_data_length =3D 0x10; static const int in_data_length =3D 0x10; @@ -1109,7 +1118,7 @@ static void ni_usb_interface_clear(gpib_board_t *boar= d, int assert) return; out_data =3D kmalloc(out_data_length, GFP_KERNEL); if (!out_data) { - pr_err("%s: kmalloc failed\n", __FILE__); + dev_err(&usb_dev->dev, "%s: kmalloc failed\n", __func__); return; } out_data[i++] =3D NIUSB_IBSIC_ID; @@ -1120,8 +1129,8 @@ static void ni_usb_interface_clear(gpib_board_t *boar= d, int assert) retval =3D ni_usb_send_bulk_msg(ni_priv, out_data, i, &bytes_written, 100= 0); kfree(out_data); if (retval || bytes_written !=3D i) { - pr_err("%s: ni_usb_send_bulk_msg returned %i, bytes_written=3D%i, i=3D%i= \n", - __func__, retval, bytes_written, i); + dev_err(&usb_dev->dev, "%s: ni_usb_send_bulk_msg returned %i, bytes_writ= ten=3D%i, i=3D%i\n", + __func__, retval, bytes_written, i); return; } in_data =3D kmalloc(in_data_length, GFP_KERNEL); @@ -1130,8 +1139,8 @@ static void ni_usb_interface_clear(gpib_board_t *boar= d, int assert) =20 retval =3D ni_usb_receive_bulk_msg(ni_priv, in_data, in_data_length, &byt= es_read, 1000, 0); if (retval || bytes_read !=3D 12) { - pr_err("%s: ni_usb_receive_bulk_msg returned %i, bytes_read=3D%i\n", - __func__, retval, bytes_read); + dev_err(&usb_dev->dev, "%s: ni_usb_receive_bulk_msg returned %i, bytes_r= ead=3D%i\n", + __func__, retval, bytes_read); kfree(in_data); return; } @@ -1144,6 +1153,7 @@ static void ni_usb_remote_enable(gpib_board_t *board,= int enable) { int retval; struct ni_usb_priv *ni_priv =3D board->private_data; + struct usb_device *usb_dev =3D interface_to_usbdev(ni_priv->bus_interface= ); struct ni_usb_register reg; unsigned int ibsta; =20 @@ -1155,7 +1165,7 @@ static void ni_usb_remote_enable(gpib_board_t *board,= int enable) reg.value =3D AUX_CREN; retval =3D ni_usb_write_registers(ni_priv, ®, 1, &ibsta); if (retval < 0) { - pr_err("%s: register write failed, retval=3D%i\n", __func__, retval); + dev_err(&usb_dev->dev, "%s: register write failed, retval=3D%i\n", __fun= c__, retval); return; //retval; } ni_priv->ren_state =3D enable; @@ -1190,11 +1200,12 @@ static unsigned int ni_usb_update_status(gpib_board= _t *board, unsigned int clear { int retval; struct ni_usb_priv *ni_priv =3D board->private_data; + struct usb_device *usb_dev =3D interface_to_usbdev(ni_priv->bus_interface= ); static const int buffer_length =3D 8; u8 *buffer; struct ni_usb_status_block status; =20 - //printk("%s: receive control pipe is %i\n", __FILE__, pipe); + //printk("%s: receive control pipe is %i\n", __func__, pipe); buffer =3D kmalloc(buffer_length, GFP_KERNEL); if (!buffer) return board->status; @@ -1203,7 +1214,7 @@ static unsigned int ni_usb_update_status(gpib_board_t= *board, unsigned int clear USB_TYPE_VENDOR | USB_RECIP_DEVICE, 0x200, 0x0, buffer, buffer_length, 1000); if (retval !=3D buffer_length) { - pr_err("%s: usb_control_msg returned %i\n", __FILE__, retval); + dev_err(&usb_dev->dev, "%s: usb_control_msg returned %i\n", __func__, re= tval); kfree(buffer); return board->status; } @@ -1216,12 +1227,13 @@ static unsigned int ni_usb_update_status(gpib_board= _t *board, unsigned int clear // tells ni-usb to immediately stop an ongoing i/o operation static void ni_usb_stop(struct ni_usb_priv *ni_priv) { + struct usb_device *usb_dev =3D interface_to_usbdev(ni_priv->bus_interface= ); int retval; static const int buffer_length =3D 8; u8 *buffer; struct ni_usb_status_block status; =20 - //printk("%s: receive control pipe is %i\n", __FILE__, pipe); + //printk("%s: receive control pipe is %i\n", __func__, pipe); buffer =3D kmalloc(buffer_length, GFP_KERNEL); if (!buffer) return; @@ -1230,7 +1242,7 @@ static void ni_usb_stop(struct ni_usb_priv *ni_priv) USB_TYPE_VENDOR | USB_RECIP_DEVICE, 0x0, 0x0, buffer, buffer_length, 1000); if (retval !=3D buffer_length) { - pr_err("%s: usb_control_msg returned %i\n", __FILE__, retval); + dev_err(&usb_dev->dev, "%s: usb_control_msg returned %i\n", __func__, re= tval); kfree(buffer); return; } @@ -1242,6 +1254,7 @@ static int ni_usb_primary_address(gpib_board_t *board= , unsigned int address) { int retval; struct ni_usb_priv *ni_priv =3D board->private_data; + struct usb_device *usb_dev =3D interface_to_usbdev(ni_priv->bus_interface= ); int i =3D 0; struct ni_usb_register writes[2]; unsigned int ibsta; @@ -1256,7 +1269,7 @@ static int ni_usb_primary_address(gpib_board_t *board= , unsigned int address) i++; retval =3D ni_usb_write_registers(ni_priv, writes, i, &ibsta); if (retval < 0) { - pr_err("%s: register write failed, retval=3D%i\n", __func__, retval); + dev_err(&usb_dev->dev, "%s: register write failed, retval=3D%i\n", __fun= c__, retval); return retval; } ni_usb_soft_update_status(board, ibsta, 0); @@ -1296,6 +1309,7 @@ static int ni_usb_secondary_address(gpib_board_t *boa= rd, unsigned int address, i { int retval; struct ni_usb_priv *ni_priv =3D board->private_data; + struct usb_device *usb_dev =3D interface_to_usbdev(ni_priv->bus_interface= ); int i =3D 0; struct ni_usb_register writes[3]; unsigned int ibsta; @@ -1303,7 +1317,7 @@ static int ni_usb_secondary_address(gpib_board_t *boa= rd, unsigned int address, i i +=3D ni_usb_write_sad(writes, address, enable); retval =3D ni_usb_write_registers(ni_priv, writes, i, &ibsta); if (retval < 0) { - pr_err("%s: register write failed, retval=3D%i\n", __func__, retval); + dev_err(&usb_dev->dev, "%s: register write failed, retval=3D%i\n", __fun= c__, retval); return retval; } ni_usb_soft_update_status(board, ibsta, 0); @@ -1314,6 +1328,7 @@ static int ni_usb_parallel_poll(gpib_board_t *board, = uint8_t *result) { int retval; struct ni_usb_priv *ni_priv =3D board->private_data; + struct usb_device *usb_dev =3D interface_to_usbdev(ni_priv->bus_interface= ); u8 *out_data, *in_data; static const int out_data_length =3D 0x10; static const int in_data_length =3D 0x20; @@ -1336,8 +1351,8 @@ static int ni_usb_parallel_poll(gpib_board_t *board, = uint8_t *result) =20 kfree(out_data); if (retval || bytes_written !=3D i) { - pr_err("%s: ni_usb_send_bulk_msg returned %i, bytes_written=3D%i, i=3D%i= \n", - __func__, retval, bytes_written, i); + dev_err(&usb_dev->dev, "%s: ni_usb_send_bulk_msg returned %i, bytes_writ= ten=3D%i, i=3D%i\n", + __func__, retval, bytes_written, i); return retval; } in_data =3D kmalloc(in_data_length, GFP_KERNEL); @@ -1349,8 +1364,8 @@ static int ni_usb_parallel_poll(gpib_board_t *board, = uint8_t *result) &bytes_read, 1000, 1); =20 if (retval && retval !=3D -ERESTARTSYS) { - pr_err("%s: ni_usb_receive_bulk_msg returned %i, bytes_read=3D%i\n", - __func__, retval, bytes_read); + dev_err(&usb_dev->dev, "%s: ni_usb_receive_bulk_msg returned %i, bytes_r= ead=3D%i\n", + __func__, retval, bytes_read); kfree(in_data); return retval; } @@ -1365,6 +1380,7 @@ static void ni_usb_parallel_poll_configure(gpib_board= _t *board, uint8_t config) { int retval; struct ni_usb_priv *ni_priv =3D board->private_data; + struct usb_device *usb_dev =3D interface_to_usbdev(ni_priv->bus_interface= ); int i =3D 0; struct ni_usb_register writes[1]; unsigned int ibsta; @@ -1375,7 +1391,7 @@ static void ni_usb_parallel_poll_configure(gpib_board= _t *board, uint8_t config) i++; retval =3D ni_usb_write_registers(ni_priv, writes, i, &ibsta); if (retval < 0) { - pr_err("%s: register write failed, retval=3D%i\n", __func__, retval); + dev_err(&usb_dev->dev, "%s: register write failed, retval=3D%i\n", __fun= c__, retval); return;// retval; } ni_usb_soft_update_status(board, ibsta, 0); @@ -1386,6 +1402,7 @@ static void ni_usb_parallel_poll_response(gpib_board_= t *board, int ist) { int retval; struct ni_usb_priv *ni_priv =3D board->private_data; + struct usb_device *usb_dev =3D interface_to_usbdev(ni_priv->bus_interface= ); int i =3D 0; struct ni_usb_register writes[1]; unsigned int ibsta; @@ -1399,7 +1416,7 @@ static void ni_usb_parallel_poll_response(gpib_board_= t *board, int ist) i++; retval =3D ni_usb_write_registers(ni_priv, writes, i, &ibsta); if (retval < 0) { - pr_err("%s: register write failed, retval=3D%i\n", __func__, retval); + dev_err(&usb_dev->dev, "%s: register write failed, retval=3D%i\n", __fun= c__, retval); return;// retval; } ni_usb_soft_update_status(board, ibsta, 0); @@ -1410,6 +1427,7 @@ static void ni_usb_serial_poll_response(gpib_board_t = *board, u8 status) { int retval; struct ni_usb_priv *ni_priv =3D board->private_data; + struct usb_device *usb_dev =3D interface_to_usbdev(ni_priv->bus_interface= ); int i =3D 0; struct ni_usb_register writes[1]; unsigned int ibsta; @@ -1420,7 +1438,7 @@ static void ni_usb_serial_poll_response(gpib_board_t = *board, u8 status) i++; retval =3D ni_usb_write_registers(ni_priv, writes, i, &ibsta); if (retval < 0) { - pr_err("%s: register write failed, retval=3D%i\n", __func__, retval); + dev_err(&usb_dev->dev, "%s: register write failed, retval=3D%i\n", __fun= c__, retval); return;// retval; } ni_usb_soft_update_status(board, ibsta, 0); @@ -1436,6 +1454,7 @@ static void ni_usb_return_to_local(gpib_board_t *boar= d) { int retval; struct ni_usb_priv *ni_priv =3D board->private_data; + struct usb_device *usb_dev =3D interface_to_usbdev(ni_priv->bus_interface= ); int i =3D 0; struct ni_usb_register writes[1]; unsigned int ibsta; @@ -1446,7 +1465,7 @@ static void ni_usb_return_to_local(gpib_board_t *boar= d) i++; retval =3D ni_usb_write_registers(ni_priv, writes, i, &ibsta); if (retval < 0) { - pr_err("%s: register write failed, retval=3D%i\n", __func__, retval); + dev_err(&usb_dev->dev, "%s: register write failed, retval=3D%i\n", __fun= c__, retval); return;// retval; } ni_usb_soft_update_status(board, ibsta, 0); @@ -1457,6 +1476,7 @@ static int ni_usb_line_status(const gpib_board_t *boa= rd) { int retval; struct ni_usb_priv *ni_priv =3D board->private_data; + struct usb_device *usb_dev =3D interface_to_usbdev(ni_priv->bus_interface= ); u8 *out_data, *in_data; static const int out_data_length =3D 0x20; static const int in_data_length =3D 0x20; @@ -1487,15 +1507,15 @@ static int ni_usb_line_status(const gpib_board_t *b= oard) if (retval || bytes_written !=3D i) { mutex_unlock(&ni_priv->addressed_transfer_lock); if (retval !=3D -EAGAIN) - pr_err("%s: ni_usb_send_bulk_msg returned %i, bytes_written=3D%i, i=3D%= i\n", - __func__, retval, bytes_written, i); + dev_err(&usb_dev->dev, "%s: ni_usb_send_bulk_msg returned %i, bytes_wri= tten=3D%i, i=3D%i\n", + __func__, retval, bytes_written, i); return retval; } =20 in_data =3D kmalloc(in_data_length, GFP_KERNEL); if (!in_data) { mutex_unlock(&ni_priv->addressed_transfer_lock); - pr_err("%s: kmalloc failed\n", __FILE__); + dev_err(&usb_dev->dev, "%s: kmalloc failed\n", __func__); return -ENOMEM; } retval =3D ni_usb_nonblocking_receive_bulk_msg(ni_priv, in_data, in_data_= length, @@ -1505,8 +1525,8 @@ static int ni_usb_line_status(const gpib_board_t *boa= rd) =20 if (retval) { if (retval !=3D -EAGAIN) - pr_err("%s: ni_usb_receive_bulk_msg returned %i, bytes_read=3D%i\n", - __func__, retval, bytes_read); + dev_err(&usb_dev->dev, "%s: ni_usb_receive_bulk_msg returned %i, bytes_= read=3D%i\n", + __func__, retval, bytes_read); kfree(in_data); return retval; } @@ -1573,6 +1593,7 @@ static unsigned int ni_usb_t1_delay(gpib_board_t *boa= rd, unsigned int nano_sec) { int retval; struct ni_usb_priv *ni_priv =3D board->private_data; + struct usb_device *usb_dev =3D interface_to_usbdev(ni_priv->bus_interface= ); struct ni_usb_register writes[3]; unsigned int ibsta; unsigned int actual_ns; @@ -1581,7 +1602,7 @@ static unsigned int ni_usb_t1_delay(gpib_board_t *boa= rd, unsigned int nano_sec) i =3D ni_usb_setup_t1_delay(writes, nano_sec, &actual_ns); retval =3D ni_usb_write_registers(ni_priv, writes, i, &ibsta); if (retval < 0) { - pr_err("%s: register write failed, retval=3D%i\n", __func__, retval); + dev_err(&usb_dev->dev, "%s: register write failed, retval=3D%i\n", __fun= c__, retval); return -1; //FIXME should change return type to int for error reporting } board->t1_nano_sec =3D actual_ns; @@ -1615,6 +1636,7 @@ static void ni_usb_free_private(struct ni_usb_priv *n= i_priv) static int ni_usb_setup_init(gpib_board_t *board, struct ni_usb_register *= writes) { struct ni_usb_priv *ni_priv =3D board->private_data; + struct usb_device *usb_dev =3D interface_to_usbdev(ni_priv->bus_interface= ); unsigned int mask, actual_ns; int i =3D 0; =20 @@ -1712,7 +1734,7 @@ static int ni_usb_setup_init(gpib_board_t *board, str= uct ni_usb_register *writes writes[i].value =3D AUX_CPPF; i++; if (i > NUM_INIT_WRITES) { - pr_err("%s: bug!, buffer overrun, i=3D%i\n", __func__, i); + dev_err(&usb_dev->dev, "%s: bug!, buffer overrun, i=3D%i\n", __func__, i= ); return 0; } return i; @@ -1722,6 +1744,7 @@ static int ni_usb_init(gpib_board_t *board) { int retval; struct ni_usb_priv *ni_priv =3D board->private_data; + struct usb_device *usb_dev =3D interface_to_usbdev(ni_priv->bus_interface= ); struct ni_usb_register *writes; unsigned int ibsta; int writes_len; @@ -1737,7 +1760,7 @@ static int ni_usb_init(gpib_board_t *board) return -EFAULT; kfree(writes); if (retval) { - pr_err("%s: register write failed, retval=3D%i\n", __func__, retval); + dev_err(&usb_dev->dev, "%s: register write failed, retval=3D%i\n", __fun= c__, retval); return retval; } ni_usb_soft_update_status(board, ibsta, 0); @@ -1748,6 +1771,7 @@ static void ni_usb_interrupt_complete(struct urb *urb) { gpib_board_t *board =3D urb->context; struct ni_usb_priv *ni_priv =3D board->private_data; + struct usb_device *usb_dev =3D interface_to_usbdev(ni_priv->bus_interface= ); int retval; struct ni_usb_status_block status; unsigned long flags; @@ -1767,7 +1791,7 @@ static void ni_usb_interrupt_complete(struct urb *urb) default: /* other error, resubmit */ retval =3D usb_submit_urb(ni_priv->interrupt_urb, GFP_ATOMIC); if (retval) - pr_err("%s: failed to resubmit interrupt urb\n", __func__); + dev_err(&usb_dev->dev, "%s: failed to resubmit interrupt urb\n", __func= __); return; } =20 @@ -1783,32 +1807,34 @@ static void ni_usb_interrupt_complete(struct urb *u= rb) =20 retval =3D usb_submit_urb(ni_priv->interrupt_urb, GFP_ATOMIC); if (retval) - pr_err("%s: failed to resubmit interrupt urb\n", __func__); + dev_err(&usb_dev->dev, "%s: failed to resubmit interrupt urb\n", __func_= _); } =20 static int ni_usb_set_interrupt_monitor(gpib_board_t *board, unsigned int = monitored_bits) { int retval; struct ni_usb_priv *ni_priv =3D board->private_data; + struct usb_device *usb_dev =3D interface_to_usbdev(ni_priv->bus_interface= ); static const int buffer_length =3D 8; u8 *buffer; struct ni_usb_status_block status; unsigned long flags; - //printk("%s: receive control pipe is %i\n", __FILE__, pipe); + //printk("%s: receive control pipe is %i\n", __func__, pipe); buffer =3D kmalloc(buffer_length, GFP_KERNEL); if (!buffer) return -ENOMEM; =20 spin_lock_irqsave(&board->spinlock, flags); ni_priv->monitored_ibsta_bits =3D ni_usb_ibsta_monitor_mask & monitored_b= its; -// pr_err("debug: %s: monitored_ibsta_bits=3D0x%x\n", __func__, ni_priv->m= onitored_ibsta_bits); +// dev_err(&usb_dev->dev, "debug: %s: monitored_ibsta_bits=3D0x%x\n", +// __func__, ni_priv->monitored_ibsta_bits); spin_unlock_irqrestore(&board->spinlock, flags); retval =3D ni_usb_receive_control_msg(ni_priv, NI_USB_WAIT_REQUEST, USB_D= IR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE, 0x300, ni_usb_ibsta_monitor_mask & monitored_bits, buffer, buffer_length, 1000); if (retval !=3D buffer_length) { - pr_err("%s: usb_control_msg returned %i\n", __FILE__, retval); + dev_err(&usb_dev->dev, "%s: usb_control_msg returned %i\n", __func__, re= tval); kfree(buffer); return -1; } @@ -1844,7 +1870,8 @@ static int ni_usb_setup_urbs(gpib_board_t *board) retval =3D usb_submit_urb(ni_priv->interrupt_urb, GFP_KERNEL); mutex_unlock(&ni_priv->interrupt_transfer_lock); if (retval) { - pr_err("%s: failed to submit first interrupt urb, retval=3D%i\n", __FILE= __, retval); + dev_err(&usb_dev->dev, "%s: failed to submit first interrupt urb, retval= =3D%i\n", + __func__, retval); return retval; } return 0; @@ -1862,6 +1889,7 @@ static void ni_usb_cleanup_urbs(struct ni_usb_priv *n= i_priv) =20 static int ni_usb_b_read_serial_number(struct ni_usb_priv *ni_priv) { + struct usb_device *usb_dev =3D interface_to_usbdev(ni_priv->bus_interface= ); int retval; u8 *out_data; u8 *in_data; @@ -1894,20 +1922,20 @@ static int ni_usb_b_read_serial_number(struct ni_us= b_priv *ni_priv) i +=3D ni_usb_bulk_termination(&out_data[i]); retval =3D ni_usb_send_bulk_msg(ni_priv, out_data, out_data_length, &byte= s_written, 1000); if (retval) { - pr_err("%s: ni_usb_send_bulk_msg returned %i, bytes_written=3D%i, i=3D%l= i\n", - __func__, - retval, bytes_written, (long)out_data_length); + dev_err(&usb_dev->dev, "%s: ni_usb_send_bulk_msg returned %i, bytes_writ= ten=3D%i, i=3D%li\n", + __func__, + retval, bytes_written, (long)out_data_length); goto serial_out; } retval =3D ni_usb_receive_bulk_msg(ni_priv, in_data, in_data_length, &byt= es_read, 1000, 0); if (retval) { - pr_err("%s: ni_usb_receive_bulk_msg returned %i, bytes_read=3D%i\n", - __func__, retval, bytes_read); + dev_err(&usb_dev->dev, "%s: ni_usb_receive_bulk_msg returned %i, bytes_r= ead=3D%i\n", + __func__, retval, bytes_read); ni_usb_dump_raw_block(in_data, bytes_read); goto serial_out; } if (ARRAY_SIZE(results) < num_reads) { - pr_err("Setup bug\n"); + dev_err(&usb_dev->dev, "Setup bug\n"); retval =3D -EINVAL; goto serial_out; } @@ -1915,7 +1943,7 @@ static int ni_usb_b_read_serial_number(struct ni_usb_= priv *ni_priv) serial_number =3D 0; for (j =3D 0; j < num_reads; ++j) serial_number |=3D (results[j] & 0xff) << (8 * j); - pr_info("%s: board serial number is 0x%x\n", __func__, serial_number); + dev_info(&usb_dev->dev, "%s: board serial number is 0x%x\n", __func__, se= rial_number); retval =3D 0; serial_out: kfree(in_data); @@ -1925,6 +1953,7 @@ static int ni_usb_b_read_serial_number(struct ni_usb_= priv *ni_priv) =20 static int ni_usb_hs_wait_for_ready(struct ni_usb_priv *ni_priv) { + struct usb_device *usb_dev =3D interface_to_usbdev(ni_priv->bus_interface= ); static const int buffer_size =3D 0x10; static const int timeout =3D 50; static const int msec_sleep_duration =3D 100; @@ -1942,22 +1971,22 @@ static int ni_usb_hs_wait_for_ready(struct ni_usb_p= riv *ni_priv) USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE, 0x0, 0x0, buffer, buffer_size, 1000); if (retval < 0) { - pr_err("%s: usb_control_msg request 0x%x returned %i\n", - __FILE__, NI_USB_SERIAL_NUMBER_REQUEST, retval); + dev_err(&usb_dev->dev, "%s: usb_control_msg request 0x%x returned %i\n", + __func__, NI_USB_SERIAL_NUMBER_REQUEST, retval); goto ready_out; } j =3D 0; if (buffer[j] !=3D NI_USB_SERIAL_NUMBER_REQUEST) { - pr_err("%s: unexpected data: buffer[%i]=3D0x%x, expected 0x%x\n", - __func__, j, (int)buffer[j], NI_USB_SERIAL_NUMBER_REQUEST); + dev_err(&usb_dev->dev, "%s: unexpected data: buffer[%i]=3D0x%x, expected= 0x%x\n", + __func__, j, (int)buffer[j], NI_USB_SERIAL_NUMBER_REQUEST); unexpected =3D 1; } if (unexpected) ni_usb_dump_raw_block(buffer, retval); // NI-USB-HS+ pads the serial with 0x0 to make 16 bytes if (retval !=3D 5 && retval !=3D 16) { - pr_err("%s: received unexpected number of bytes =3D %i, expected 5 or 16= \n", - __func__, retval); + dev_err(&usb_dev->dev, "%s: received unexpected number of bytes =3D %i, = expected 5 or 16\n", + __func__, retval); ni_usb_dump_raw_block(buffer, retval); } serial_number =3D 0; @@ -1965,7 +1994,7 @@ static int ni_usb_hs_wait_for_ready(struct ni_usb_pri= v *ni_priv) serial_number |=3D (buffer[++j] << 8); serial_number |=3D (buffer[++j] << 16); serial_number |=3D (buffer[++j] << 24); - pr_info("%s: board serial number is 0x%x\n", __func__, serial_number); + dev_info(&usb_dev->dev, "%s: board serial number is 0x%x\n", __func__, se= rial_number); for (i =3D 0; i < timeout; ++i) { int ready =3D 0; =20 @@ -1973,26 +2002,26 @@ static int ni_usb_hs_wait_for_ready(struct ni_usb_p= riv *ni_priv) USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE, 0x0, 0x0, buffer, buffer_size, 100); if (retval < 0) { - pr_err("%s: usb_control_msg request 0x%x returned %i\n", - __func__, NI_USB_POLL_READY_REQUEST, retval); + dev_err(&usb_dev->dev, "%s: usb_control_msg request 0x%x returned %i\n", + __func__, NI_USB_POLL_READY_REQUEST, retval); goto ready_out; } j =3D 0; unexpected =3D 0; if (buffer[j] !=3D NI_USB_POLL_READY_REQUEST) { // [0] - pr_err("%s: unexpected data: buffer[%i]=3D0x%x, expected 0x%x\n", - __func__, j, (int)buffer[j], NI_USB_POLL_READY_REQUEST); + dev_err(&usb_dev->dev, "%s: unexpected data: buffer[%i]=3D0x%x, expecte= d 0x%x\n", + __func__, j, (int)buffer[j], NI_USB_POLL_READY_REQUEST); unexpected =3D 1; } ++j; if (buffer[j] !=3D 0x1 && buffer[j] !=3D 0x0) { // [1] HS+ sends 0x0 - pr_err("%s: unexpected data: buffer[%i]=3D0x%x, expected 0x1 or 0x0\n", - __func__, j, (int)buffer[j]); + dev_err(&usb_dev->dev, "%s: unexpected data: buffer[%i]=3D0x%x, expecte= d 0x1 or 0x0\n", + __func__, j, (int)buffer[j]); unexpected =3D 1; } if (buffer[++j] !=3D 0x0) { // [2] - pr_err("%s: unexpected data: buffer[%i]=3D0x%x, expected 0x%x\n", - __func__, j, (int)buffer[j], 0x0); + dev_err(&usb_dev->dev, "%s: unexpected data: buffer[%i]=3D0x%x, expecte= d 0x%x\n", + __func__, j, (int)buffer[j], 0x0); unexpected =3D 1; } ++j; @@ -2000,22 +2029,22 @@ static int ni_usb_hs_wait_for_ready(struct ni_usb_p= riv *ni_priv) // NI-USB-HS+ sends 0x0 if (buffer[j] !=3D 0x1 && buffer[j] !=3D 0x8 && buffer[j] !=3D 0x7 && bu= ffer[j] !=3D 0x0) { // [3] - pr_err("%s: unexpected data: buffer[%i]=3D0x%x, expected 0x0, 0x1, 0x7 = or 0x8\n", - __func__, j, (int)buffer[j]); + dev_err(&usb_dev->dev, "%s: unexpected data: buffer[%i]=3D0x%x, expecte= d 0x0, 0x1, 0x7 or 0x8\n", + __func__, j, (int)buffer[j]); unexpected =3D 1; } ++j; // NI-USB-HS+ sends 0 here if (buffer[j] !=3D 0x30 && buffer[j] !=3D 0x0) { // [4] - pr_err("%s: unexpected data: buffer[%i]=3D0x%x, expected 0x0 or 0x30\n", - __func__, j, (int)buffer[j]); + dev_err(&usb_dev->dev, "%s: unexpected data: buffer[%i]=3D0x%x, expecte= d 0x0 or 0x30\n", + __func__, j, (int)buffer[j]); unexpected =3D 1; } ++j; // MC usb-488 (and sometimes NI-USB-HS?) and NI-USB-HS+ sends 0x0 here if (buffer[j] !=3D 0x1 && buffer[j] !=3D 0x0) { // [5] - pr_err("%s: unexpected data: buffer[%i]=3D0x%x, expected 0x1 or 0x0\n", - __func__, j, (int)buffer[j]); + dev_err(&usb_dev->dev, "%s: unexpected data: buffer[%i]=3D0x%x, expecte= d 0x1 or 0x0\n", + __func__, j, (int)buffer[j]); unexpected =3D 1; } if (buffer[++j] !=3D 0x0) { // [6] @@ -2023,8 +2052,8 @@ static int ni_usb_hs_wait_for_ready(struct ni_usb_pri= v *ni_priv) // NI-USB-HS+ sends 0xf here if (buffer[j] !=3D 0x2 && buffer[j] !=3D 0xe && buffer[j] !=3D 0xf && buffer[j] !=3D 0x16) { - pr_err("%s: unexpected data: buffer[%i]=3D0x%x, expected 0x2, 0xe, 0xf= or 0x16\n", - __func__, j, (int)buffer[j]); + dev_err(&usb_dev->dev, "%s: unexpected data: buffer[%i]=3D0x%x, expect= ed 0x2, 0xe, 0xf or 0x16\n", + __func__, j, (int)buffer[j]); unexpected =3D 1; } } @@ -2033,30 +2062,30 @@ static int ni_usb_hs_wait_for_ready(struct ni_usb_p= riv *ni_priv) // MC usb-488 sends 0x5 here; MC usb-488A sends 0x6 here if (buffer[j] !=3D 0x3 && buffer[j] !=3D 0x5 && buffer[j] !=3D 0x6 && buffer[j] !=3D 0x8) { - pr_err("%s: unexpected data: buffer[%i]=3D0x%x, expected 0x3 or 0x5, 0= x6 or 0x08\n", - __func__, j, (int)buffer[j]); + dev_err(&usb_dev->dev, "%s: unexpected data: buffer[%i]=3D0x%x, expect= ed 0x3 or 0x5, 0x6 or 0x08\n", + __func__, j, (int)buffer[j]); unexpected =3D 1; } } ++j; if (buffer[j] !=3D 0x0 && buffer[j] !=3D 0x2) { // [8] MC usb-488 sends = 0x2 here - pr_err("%s: unexpected data: buffer[%i]=3D0x%x, expected 0x0 or 0x2\n", - __func__, j, (int)buffer[j]); + dev_err(&usb_dev->dev, "%s: unexpected data: buffer[%i]=3D0x%x, expecte= d 0x0 or 0x2\n", + __func__, j, (int)buffer[j]); unexpected =3D 1; } ++j; // MC usb-488A and NI-USB-HS sends 0x3 here; NI-USB-HS+ sends 0x30 here if (buffer[j] !=3D 0x0 && buffer[j] !=3D 0x3 && buffer[j] !=3D 0x30) { /= / [9] - pr_err("%s: unexpected data: buffer[%i]=3D0x%x, expected 0x0, 0x3 or 0x= 30\n", - __func__, j, (int)buffer[j]); + dev_err(&usb_dev->dev, "%s: unexpected data: buffer[%i]=3D0x%x, expecte= d 0x0, 0x3 or 0x30\n", + __func__, j, (int)buffer[j]); unexpected =3D 1; } if (buffer[++j] !=3D 0x0) { ready =3D 1; if (buffer[j] !=3D 0x96 && buffer[j] !=3D 0x7 && buffer[j] !=3D 0x6e) { // [10] MC usb-488 sends 0x7 here - pr_err("%s: unexpected data: buffer[%i]=3D0x%x, expected 0x96, 0x07 or= 0x6e\n", - __func__, j, (int)buffer[j]); + dev_err(&usb_dev->dev, "%s: unexpected data: buffer[%i]=3D0x%x, expect= ed 0x96, 0x07 or 0x6e\n", + __func__, j, (int)buffer[j]); unexpected =3D 1; } } @@ -2066,7 +2095,7 @@ static int ni_usb_hs_wait_for_ready(struct ni_usb_pri= v *ni_priv) break; retval =3D msleep_interruptible(msec_sleep_duration); if (retval) { - pr_err("ni_usb_gpib: msleep interrupted\n"); + dev_err(&usb_dev->dev, "ni_usb_gpib: msleep interrupted\n"); retval =3D -ERESTARTSYS; goto ready_out; } @@ -2075,7 +2104,7 @@ static int ni_usb_hs_wait_for_ready(struct ni_usb_pri= v *ni_priv) =20 ready_out: kfree(buffer); - GPIB_DPRINTK("%s: %s exit retval=3D%d\n", __func__, retval); + dev_dbg(&usb_dev->dev, "%s: exit retval=3D%d\n", __func__, retval); return retval; } =20 @@ -2087,6 +2116,7 @@ static int ni_usb_hs_wait_for_ready(struct ni_usb_pri= v *ni_priv) */ static int ni_usb_hs_plus_extra_init(struct ni_usb_priv *ni_priv) { + struct usb_device *usb_dev =3D interface_to_usbdev(ni_priv->bus_interface= ); int retval; u8 *buffer; static const int buffer_size =3D 16; @@ -2102,14 +2132,14 @@ static int ni_usb_hs_plus_extra_init(struct ni_usb_= priv *ni_priv) USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE, 0x0, 0x0, buffer, transfer_size, 1000); if (retval < 0) { - pr_err("%s: usb_control_msg request 0x%x returned %i\n", - __FILE__, NI_USB_HS_PLUS_0x48_REQUEST, retval); + dev_err(&usb_dev->dev, "%s: usb_control_msg request 0x%x returned %i\n", + __func__, NI_USB_HS_PLUS_0x48_REQUEST, retval); break; } // expected response data: 48 f3 30 00 00 00 00 00 00 00 00 00 00 00 00 = 00 if (buffer[0] !=3D NI_USB_HS_PLUS_0x48_REQUEST) - pr_err("%s: unexpected data: buffer[0]=3D0x%x, expected 0x%x\n", - __func__, (int)buffer[0], NI_USB_HS_PLUS_0x48_REQUEST); + dev_err(&usb_dev->dev, "%s: unexpected data: buffer[0]=3D0x%x, expected= 0x%x\n", + __func__, (int)buffer[0], NI_USB_HS_PLUS_0x48_REQUEST); =20 transfer_size =3D 2; =20 @@ -2117,14 +2147,14 @@ static int ni_usb_hs_plus_extra_init(struct ni_usb_= priv *ni_priv) USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE, 0x1, 0x0, buffer, transfer_size, 1000); if (retval < 0) { - pr_err("%s: usb_control_msg request 0x%x returned %i\n", - __FILE__, NI_USB_HS_PLUS_LED_REQUEST, retval); + dev_err(&usb_dev->dev, "%s: usb_control_msg request 0x%x returned %i\n", + __func__, NI_USB_HS_PLUS_LED_REQUEST, retval); break; } // expected response data: 4b 00 if (buffer[0] !=3D NI_USB_HS_PLUS_LED_REQUEST) - pr_err("%s: unexpected data: buffer[0]=3D0x%x, expected 0x%x\n", - __func__, (int)buffer[0], NI_USB_HS_PLUS_LED_REQUEST); + dev_err(&usb_dev->dev, "%s: unexpected data: buffer[0]=3D0x%x, expected= 0x%x\n", + __func__, (int)buffer[0], NI_USB_HS_PLUS_LED_REQUEST); =20 transfer_size =3D 9; =20 @@ -2133,14 +2163,14 @@ static int ni_usb_hs_plus_extra_init(struct ni_usb_= priv *ni_priv) USB_RECIP_INTERFACE, 0x0, 0x1, buffer, transfer_size, 1000); if (retval < 0) { - pr_err("%s: usb_control_msg request 0x%x returned %i\n", - __func__, NI_USB_HS_PLUS_0xf8_REQUEST, retval); + dev_err(&usb_dev->dev, "%s: usb_control_msg request 0x%x returned %i\n", + __func__, NI_USB_HS_PLUS_0xf8_REQUEST, retval); break; } // expected response data: f8 01 00 00 00 01 00 00 00 if (buffer[0] !=3D NI_USB_HS_PLUS_0xf8_REQUEST) - pr_err("%s: unexpected data: buffer[0]=3D0x%x, expected 0x%x\n", - __func__, (int)buffer[0], NI_USB_HS_PLUS_0xf8_REQUEST); + dev_err(&usb_dev->dev, "%s: unexpected data: buffer[0]=3D0x%x, expected= 0x%x\n", + __func__, (int)buffer[0], NI_USB_HS_PLUS_0xf8_REQUEST); =20 } while (0); =20 @@ -2191,9 +2221,9 @@ static int ni_usb_attach(gpib_board_t *board, const g= pib_board_config_t *config) return -ENODEV; } if (usb_reset_configuration(interface_to_usbdev(ni_priv->bus_interface))) - pr_err("ni_usb_gpib: usb_reset_configuration() failed.\n"); + dev_err(&usb_dev->dev, "ni_usb_gpib: usb_reset_configuration() failed.\n= "); =20 - product_id =3D le16_to_cpu(interface_to_usbdev(ni_priv->bus_interface)->d= escriptor.idProduct); + product_id =3D le16_to_cpu(usb_dev->descriptor.idProduct); ni_priv->product_id =3D product_id; =20 timer_setup(&ni_priv->bulk_timer, ni_usb_timeout_handler, 0); @@ -2234,7 +2264,8 @@ static int ni_usb_attach(gpib_board_t *board, const g= pib_board_config_t *config) break; default: mutex_unlock(&ni_usb_hotplug_lock); - pr_err("\tDriver bug: unknown endpoints for usb device id\n"); + dev_err(&usb_dev->dev, "\tDriver bug: unknown endpoints for usb device i= d %x\n", + product_id); return -EINVAL; } =20 @@ -2263,12 +2294,13 @@ static int ni_usb_attach(gpib_board_t *board, const= gpib_board_config_t *config) } =20 mutex_unlock(&ni_usb_hotplug_lock); - pr_info("%s: attached\n", __func__); + dev_info(&usb_dev->dev, "%s: attached\n", __func__); return retval; } =20 static int ni_usb_shutdown_hardware(struct ni_usb_priv *ni_priv) { + struct usb_device *usb_dev =3D interface_to_usbdev(ni_priv->bus_interface= ); int retval; int i =3D 0; struct ni_usb_register writes[2]; @@ -2285,12 +2317,12 @@ static int ni_usb_shutdown_hardware(struct ni_usb_p= riv *ni_priv) writes[i].value =3D 0x0; i++; if (i > writes_length) { - pr_err("%s: bug!, buffer overrun, i=3D%i\n", __func__, i); + dev_err(&usb_dev->dev, "%s: bug!, buffer overrun, i=3D%i\n", __func__, i= ); return -EINVAL; } retval =3D ni_usb_write_registers(ni_priv, writes, i, &ibsta); if (retval) { - pr_err("%s: register write failed, retval=3D%i\n", __func__, retval); + dev_err(&usb_dev->dev, "%s: register write failed, retval=3D%i\n", __fun= c__, retval); return retval; } return 0; @@ -2362,35 +2394,34 @@ MODULE_DEVICE_TABLE(usb, ni_usb_driver_device_table= ); =20 static int ni_usb_driver_probe(struct usb_interface *interface, const stru= ct usb_device_id *id) { + struct usb_device *usb_dev =3D interface_to_usbdev(interface); int i; char *path; static const int path_length =3D 1024; =20 -// printk("ni_usb_driver_probe\n"); mutex_lock(&ni_usb_hotplug_lock); - usb_get_dev(interface_to_usbdev(interface)); + usb_get_dev(usb_dev); for (i =3D 0; i < MAX_NUM_NI_USB_INTERFACES; i++) { if (!ni_usb_driver_interfaces[i]) { ni_usb_driver_interfaces[i] =3D interface; usb_set_intfdata(interface, NULL); -// printk("set bus interface %i to address 0x%p\n", i, interface); break; } } if (i =3D=3D MAX_NUM_NI_USB_INTERFACES) { - usb_put_dev(interface_to_usbdev(interface)); + usb_put_dev(usb_dev); mutex_unlock(&ni_usb_hotplug_lock); - pr_err("ni_usb_gpib: out of space in ni_usb_driver_interfaces[]\n"); + dev_err(&usb_dev->dev, "%s: ni_usb_driver_interfaces[] full\n", __func__= ); return -1; } path =3D kmalloc(path_length, GFP_KERNEL); if (!path) { - usb_put_dev(interface_to_usbdev(interface)); + usb_put_dev(usb_dev); mutex_unlock(&ni_usb_hotplug_lock); return -ENOMEM; } - usb_make_path(interface_to_usbdev(interface), path, path_length); - pr_info("ni_usb_gpib: probe succeeded for path: %s\n", path); + usb_make_path(usb_dev, path, path_length); + dev_info(&usb_dev->dev, "ni_usb_gpib: probe succeeded for path: %s\n", pa= th); kfree(path); mutex_unlock(&ni_usb_hotplug_lock); return 0; @@ -2398,6 +2429,7 @@ static int ni_usb_driver_probe(struct usb_interface *= interface, const struct usb =20 static void ni_usb_driver_disconnect(struct usb_interface *interface) { + struct usb_device *usb_dev =3D interface_to_usbdev(interface); int i; =20 mutex_lock(&ni_usb_hotplug_lock); @@ -2424,14 +2456,15 @@ static void ni_usb_driver_disconnect(struct usb_int= erface *interface) } } if (i =3D=3D MAX_NUM_NI_USB_INTERFACES) - pr_err("unable to find interface in ni_usb_driver_interfaces[]? bug?\n"); - usb_put_dev(interface_to_usbdev(interface)); + dev_err(&usb_dev->dev, "%s: unable to find interface in ni_usb_driver_in= terfaces[]? bug?\n", + __func__); + usb_put_dev(usb_dev); mutex_unlock(&ni_usb_hotplug_lock); } =20 static int ni_usb_driver_suspend(struct usb_interface *interface, pm_messa= ge_t message) { - struct usb_device *usb_dev; + struct usb_device *usb_dev =3D interface_to_usbdev(interface); gpib_board_t *board; int i, retval; =20 @@ -2463,7 +2496,6 @@ static int ni_usb_driver_suspend(struct usb_interface= *interface, pm_message_t m ni_usb_cleanup_urbs(ni_priv); mutex_unlock(&ni_priv->interrupt_transfer_lock); } - usb_dev =3D interface_to_usbdev(ni_priv->bus_interface); dev_info(&usb_dev->dev, "bus %d dev num %d gpib minor %d, ni usb interface %i suspended\n", usb_dev->bus->busnum, usb_dev->devnum, board->minor, i); @@ -2475,7 +2507,8 @@ static int ni_usb_driver_suspend(struct usb_interface= *interface, pm_message_t m =20 static int ni_usb_driver_resume(struct usb_interface *interface) { - struct usb_device *usb_dev; + struct usb_device *usb_dev =3D interface_to_usbdev(interface); + gpib_board_t *board; int i, retval; =20 @@ -2500,15 +2533,15 @@ static int ni_usb_driver_resume(struct usb_interfac= e *interface) mutex_lock(&ni_priv->interrupt_transfer_lock); retval =3D usb_submit_urb(ni_priv->interrupt_urb, GFP_KERNEL); if (retval) { - pr_err("%s: failed to resubmit interrupt urb, retval=3D%i\n", - __func__, retval); + dev_err(&usb_dev->dev, "%s: failed to resubmit interrupt urb, retval= =3D%i\n", + __func__, retval); mutex_unlock(&ni_priv->interrupt_transfer_lock); mutex_unlock(&ni_usb_hotplug_lock); return retval; } mutex_unlock(&ni_priv->interrupt_transfer_lock); } else { - pr_err("%s: bug! int urb not set up\n", __func__); + dev_err(&usb_dev->dev, "%s: bug! int urb not set up\n", __func__); mutex_unlock(&ni_usb_hotplug_lock); return -EINVAL; } @@ -2540,7 +2573,7 @@ static int ni_usb_driver_resume(struct usb_interface = *interface) break; default: mutex_unlock(&ni_usb_hotplug_lock); - pr_err("\tDriver bug: unknown endpoints for usb device id\n"); + dev_err(&usb_dev->dev, "\tDriver bug: unknown endpoints for usb device = id\n"); return -EINVAL; } =20 @@ -2565,7 +2598,6 @@ static int ni_usb_driver_resume(struct usb_interface = *interface) if (ni_priv->ren_state) ni_usb_remote_enable(board, 1); =20 - usb_dev =3D interface_to_usbdev(ni_priv->bus_interface); dev_info(&usb_dev->dev, "bus %d dev num %d gpib minor %d, ni usb interface %i resumed\n", usb_dev->bus->busnum, usb_dev->devnum, board->minor, i); --=20 2.46.2 From nobody Sun Nov 24 15:51:27 2024 Received: from mail-lf1-f42.google.com (mail-lf1-f42.google.com [209.85.167.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 BFB581C9EB7 for ; Mon, 4 Nov 2024 17:50:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.42 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730742634; cv=none; b=FCoFeX+UGD6hseZQZXa7Yx6enz90K/b72l55qUMGjL9k2xdPZ7MvEpf+AeNEnhtBebbw9BUXRMjjbNjTCGpZ4S8jUjerKcEibmnJ61levO91nSnr+ZB6QbYpyQcYeVuGWFHemxVEGwHX0lqkbf0/yAHFolxArLyLYyxzijT8JzM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730742634; c=relaxed/simple; bh=PffAhAUcuIWvQej7AP8J9sr6xMFDZio2m4aEcFKkJ2Q=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=rKJASVuidiqqndNt6GJnLOmIh++oimJswqRSdkA3zQ4c1VL45vzECZUOp7REmglb4iKveFSVhAV4ILSJThZKQ1CE36GWI4+6ysK3hHwWu4TtC+QB8o3pRLosxsAmpIO7MSvQnNpEQ14Dh8JTX28s6JEhdb3oTYau5E/fV4FD+QA= 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=N2R2rMij; arc=none smtp.client-ip=209.85.167.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="N2R2rMij" Received: by mail-lf1-f42.google.com with SMTP id 2adb3069b0e04-539f0f9ee49so5060610e87.1 for ; Mon, 04 Nov 2024 09:50:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1730742628; x=1731347428; 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=fmsUySjeW2F1sH5xbvbK1e0fM56vcqgWv6kEsmqRgCA=; b=N2R2rMijwNtwaLgvhJUKXJDp4gWPj7rM7U4DbXOkI+akJJRIQWVV8URnrJYyK4m2Cs v0vzLETIUwlEFIQQTovzlb/pstQj6kSAxX0cD7HAPtfNC5PS5Igmxhp7FzuhoXPRmdT7 frM7/zmIVKv29jruCI/IVkQIkv38W5DkGDCJkIMvwqfbiXzcaIJdLR90a56ZNknbsHZF Xovbze232AJI/TI06+JfZsu/zzN1QANY9ykO3NBY/Aun+mygQFJwV6/aAI7yeQM5Nm3V zCUKxnWoPHMqTbDH9lG7MyuOyK/I2XLt3odmp7FCU9zboDlAW3QGFxtr77WGoAbL4qRE CyVQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730742628; x=1731347428; 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=fmsUySjeW2F1sH5xbvbK1e0fM56vcqgWv6kEsmqRgCA=; b=gCdnn7M6ZKSziTjLWq2tGR/qFmRkgLHeYWJ42iC9igj65ZiOSv+a2qvlt3WREnFMl8 1wVYB3WA5sjHK0C7ljoWHHXNACpaQIf0vR5GaZobOdmfcfjm09Jv8LFFFQoXGdXRv8/y In7IOUdHo+fN/Ul42JB99lSs2buUKqjSg7RQJ2SLCDUhcEa2+tpK1Nh076otHhnpBIIf uxKp5SI1hsZW6oocIKTd4CEEvfJVHctr7RDt1bSX1+V6RWdAP+2VtP5geHBpCLjCyLR7 23VxLsSlHOagA0I9EstgT8GfIy7TWyHXhEesUtoD9cFjR17Dw58kfpw1J6RVx7gy3xq5 5SXw== X-Forwarded-Encrypted: i=1; AJvYcCUMykP9094ax+CPXoB8+W60Z/HkveEWGfadk/pefsJUVAeXSpJmsuWahMo8p0HeRR2PG+iVpQf4f5u7KaA=@vger.kernel.org X-Gm-Message-State: AOJu0YxWH4HffgUnREShiIylTCK8Q0yBiPDn4L/ACaP59ebxn9GjfzNQ 57XbH7HAiVZuyzJvT1WJzON+IfD/L3XvwvArvc3Bmq455H4eNXnI X-Google-Smtp-Source: AGHT+IGRXGkX7O8PBfmRwjDFI9PQjXO8K05eJAeEf87Zqjz/JzKJ743m6f5aWYhxAXeGk0iPrbqjqg== X-Received: by 2002:a05:6512:401f:b0:52c:9383:4c16 with SMTP id 2adb3069b0e04-53b348cea2amr16696209e87.22.1730742627377; Mon, 04 Nov 2024 09:50:27 -0800 (PST) Received: from localhost.localdomain (82-64-73-52.subs.proxad.net. [82.64.73.52]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-381c10b7f80sm13839821f8f.20.2024.11.04.09.50.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Nov 2024 09:50:26 -0800 (PST) From: Dave Penkler To: gregkh@linuxfoundation.org, linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org Cc: skhan@linuxfoundation.org, arnd@arndb.de, dan.carpenter@linaro.org, Dave Penkler Subject: [PATCH v3 04/12] staging: gpib: Update messaging and usb_device refs in agilent_usb Date: Mon, 4 Nov 2024 18:50:05 +0100 Message-ID: <20241104175014.12317-5-dpenkler@gmail.com> X-Mailer: git-send-email 2.46.2 In-Reply-To: <20241104175014.12317-1-dpenkler@gmail.com> References: <20241104175014.12317-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() Remove commented out console message code. Signed-off-by: Dave Penkler Reviewed-by: Dan Carpenter --- .../gpib/agilent_82357a/agilent_82357a.c | 257 ++++++++++-------- 1 file changed, 144 insertions(+), 113 deletions(-) diff --git a/drivers/staging/gpib/agilent_82357a/agilent_82357a.c b/drivers= /staging/gpib/agilent_82357a/agilent_82357a.c index 748aadc5cebc..ca9c938284c9 100644 --- a/drivers/staging/gpib/agilent_82357a/agilent_82357a.c +++ b/drivers/staging/gpib/agilent_82357a/agilent_82357a.c @@ -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,16 @@ 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__); 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 +147,16 @@ 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__); 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 +213,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,15 +225,14 @@ 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__); + if (!out_data) return -ENOMEM; - } + out_data[i++] =3D DATA_PIPE_CMD_WR_REGS; out_data[i++] =3D num_writes; for (j =3D 0; j < num_writes; j++) { @@ -243,7 +240,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 +249,14 @@ 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__); mutex_unlock(&a_priv->bulk_transfer_lock); return -ENOMEM; } @@ -269,20 +265,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 +289,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,20 +300,19 @@ 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__); + if (!out_data) return -ENOMEM; - } + out_data[i++] =3D DATA_PIPE_CMD_RD_REGS; out_data[i++] =3D num_reads; 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 +329,14 @@ 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__); mutex_unlock(&a_priv->bulk_transfer_lock); return -ENOMEM; } @@ -350,21 +345,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 +370,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 +390,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 +413,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 +433,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 +469,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 +499,15 @@ 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); 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,8 +515,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__); - // agilent_82357a_dump_raw_block(in_data, bytes_read); + if (bytes_read >=3D 1) { memcpy(buffer, in_data, bytes_read - 1); trailing_flags =3D in_data[bytes_read - 1]; @@ -545,6 +540,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 +570,6 @@ 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); =20 clear_bit(AIF_WRITE_COMPLETE_BN, &a_priv->interrupt_flags); =20 @@ -589,28 +584,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__); + retval =3D wait_event_interruptible(board->wait, test_bit(AIF_WRITE_COMPLETE_BN, &a_priv->interrupt_flags) || test_bit(TIMO_NUM, &board->status)); if (retval) { - pr_err("%s: wait write complete interrupted\n", __func__); + dev_err(&usb_dev->dev, "%s: wait write complete interrupted\n", __func__= ); agilent_82357a_abort(a_priv, 0); mutex_unlock(&a_priv->bulk_transfer_lock); return -ERESTARTSYS; } =20 if (test_bit(AIF_WRITE_COMPLETE_BN, &a_priv->interrupt_flags) =3D=3D 0) { - GPIB_DPRINTK("%s: write timed out ibs %i, tmo %i\n", __func__, - test_bit(TIMO_NUM, &board->status), msec_timeout); + dev_dbg(&usb_dev->dev, "write timed out ibs %i, tmo %i\n", + test_bit(TIMO_NUM, &board->status), msec_timeout); =20 agilent_82357a_abort(a_priv, 0); =20 @@ -619,16 +614,17 @@ static ssize_t agilent_82357a_generic_write(gpib_boar= d_t *board, uint8_t *buffer read_reg.address =3D BSR; retval =3D agilent_82357a_read_registers(a_priv, &read_reg, 1, 1); if (retval) { - pr_err("%s: agilent_82357a_read_registers() returned error\n", __func__= ); + dev_err(&usb_dev->dev, "%s: agilent_82357a_read_registers() returned er= ror\n", + __func__); return -ETIMEDOUT; } =20 bsr =3D read_reg.value; - GPIB_DPRINTK("%s: write aborted bsr 0x%hx\n", __func__, bsr); + dev_dbg(&usb_dev->dev, "write aborted bsr 0x%x\n", bsr); =20 if (send_commands) {/* check for no listeners */ if ((bsr & BSR_ATN_BIT) && !(bsr & (BSR_NDAC_BIT | BSR_NRFD_BIT))) { - GPIB_DPRINTK("%s: No listener on command\n", __func__); + dev_dbg(&usb_dev->dev, "No listener on command\n"); clear_bit(TIMO_NUM, &board->status); return -ENOTCONN; // no listener on bus } @@ -636,13 +632,13 @@ static ssize_t agilent_82357a_generic_write(gpib_boar= d_t *board, uint8_t *buffer read_reg.address =3D ADSR; retval =3D agilent_82357a_read_registers(a_priv, &read_reg, 1, 1); if (retval) { - pr_err("%s: agilent_82357a_read_registers() returned error\n", - __func__); + dev_err(&usb_dev->dev, "%s: agilent_82357a_read_registers() returned e= rror\n", + __func__); return -ETIMEDOUT; } adsr =3D read_reg.value; if ((adsr & HR_TA) && !(bsr & (BSR_NDAC_BIT | BSR_NRFD_BIT))) { - GPIB_DPRINTK("%s: No listener on write\n", __func__); + dev_dbg(&usb_dev->dev, "No listener on write\n"); clear_bit(TIMO_NUM, &board->status); return -ECOMM; } @@ -657,14 +653,14 @@ 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__); 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 +670,6 @@ 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); return 0; } =20 @@ -693,6 +688,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 +699,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 +733,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 +741,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 +750,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 +771,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 +791,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 +808,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 +837,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 +850,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 +883,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 +898,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 +907,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 +924,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 +936,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 +956,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 +996,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 +1005,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 +1047,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 +1055,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 +1064,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 +1081,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 +1097,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 +1133,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 +1150,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 +1159,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 +1201,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 +1217,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 +1283,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 +1364,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 +1391,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 +1399,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 +1426,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 +1441,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 +1458,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 +1506,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 +1543,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 +1565,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 +1596,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 +1621,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 +1644,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 +1668,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 +1710,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 15:51:27 2024 Received: from mail-wm1-f53.google.com (mail-wm1-f53.google.com [209.85.128.53]) (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 B1C291C9EC9 for ; Mon, 4 Nov 2024 17:50:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.53 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730742632; cv=none; b=k7de5W0tp6WkLuuEVnm0enL9GVxLwEDXEd5GWSsP8K/jnnHH+0u34Gor854ilNn/bmtPBhuHBuQTEgQVLPWqkV/WnaK/2bTjROFOnzK/KvfKpgYGP+Tlox4lOWoIZ9x7yC1nASW8vyaWFs8Hdncn2jEy4COPmG2cK9mg1kFmsDI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730742632; c=relaxed/simple; bh=DbDP9y+Z1Z92uli2XTbO36BvaUcaMIE6LpjBRU0RiLk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=qxVcYZOYhrCR/ITkvymMjB1goNBcvCkSJkFYOQoW4kvVO++ZwUe/E5M8iUbOtTRAoCGoj9g8/5FKKlkg34qVJRPdEsAUeNHstwlax/kDCyFpSjivGJ+1GkGUX1niNWMnYJVByIIRrGndpC3kmYrKa1vnxd+34927sUzEhtOaMyg= 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=dlO/b9fZ; arc=none smtp.client-ip=209.85.128.53 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="dlO/b9fZ" Received: by mail-wm1-f53.google.com with SMTP id 5b1f17b1804b1-43161e7bb25so35215105e9.2 for ; Mon, 04 Nov 2024 09:50:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1730742629; x=1731347429; 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=ajwobQL/OgHCeHlEBCD2gk8z11jb/W4yobyOVkJlzRE=; b=dlO/b9fZGuIPKqg8MDL8FbMCKQ8v5rHzcoEK/qKKiKNi6Sp4RrudmaktFf/qAAxNUN /PJ20ug+Boe8FZ9b6IwKcl8JBlaEWFKD6ArknG2BJ751te0mm8SnFh4cmFfNZqbSfVbu Ks9EeHD66oUK4W8FUo2AXnj4MNNlqOP9z9OMeAJeRIfC6PDSeajG9Xlhb832ZOnIKBIS JS/T5zPTSjNpiX7ZvxoZaT8nJEQNPKXK0S96f6oNvhgNdNyrxhm0D8WH+gzaom7aLCiW x6wM5zI3+xJMmb+m6+bP+rjvcLqV2g2LJzF6lftvNv61aZNPZGwffl0RCQc1vCHu/A35 1L5Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730742629; x=1731347429; 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=ajwobQL/OgHCeHlEBCD2gk8z11jb/W4yobyOVkJlzRE=; b=HdYE48k2zJf3qIznq+6kjdu9BHPxeAVSJV60SKYGI/6t38hKONl8SYltg7HMFe1gSw lLpiFWVoG2foVP8OPj782KCX10EEnV499MKR9j8UPljVXVJvDXAm5qfKrrDCuFwt0lWW QfOQcip08Qm9ZWK46pvp80kOnKmVJ9te5ToqOsZlAsdklN7V6wG+xQtEAZWQobvwkYfs wR2a9vqjH3cJ/4KfUpjHReqSFWlILSMLuQ8aqVVz50hikxMCmcAWAP1BdiYxTbkponl8 5j69IR9o6tYIftu6SItuV1EPOl50Z938r2LY/lMD8zfMnFqEZCiandgzoyZZRldKKs19 M4Ow== X-Forwarded-Encrypted: i=1; AJvYcCU+CR/QTAHYhs2od09nZ2qxv+hSWRNysmX8mCEPz7tUKoASM+N18yKua9RPTcH8NLvfuYlIRjcOC1fRjNU=@vger.kernel.org X-Gm-Message-State: AOJu0YxLBOGWCPU07WR+ET/bXrClDiOYJ5jcZg+ZYWUoflYC4Zm6zoSk 5pF3B2Mu+CfoB7Mj10azvgG4AO+FZTq0VhdZJiGS3vncjAk+uqwe X-Google-Smtp-Source: AGHT+IGfQ7FGigP66UxM4jE7vbTR2gUi72gYyh5y6I0lzwKLSM/mt/Hrbte9btOApFKFU7UAC7a2eg== X-Received: by 2002:adf:ea89:0:b0:374:b6f3:728d with SMTP id ffacd0b85a97d-381b70f06e5mr13351906f8f.46.1730742628908; Mon, 04 Nov 2024 09:50:28 -0800 (PST) Received: from localhost.localdomain (82-64-73-52.subs.proxad.net. [82.64.73.52]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-381c10b7f80sm13839821f8f.20.2024.11.04.09.50.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Nov 2024 09:50:28 -0800 (PST) From: Dave Penkler To: gregkh@linuxfoundation.org, linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org Cc: skhan@linuxfoundation.org, arnd@arndb.de, dan.carpenter@linaro.org, Dave Penkler Subject: [PATCH v3 05/12] staging: gpib: Fix MODULES_DESCRIPTION Date: Mon, 4 Nov 2024 18:50:06 +0100 Message-ID: <20241104175014.12317-6-dpenkler@gmail.com> X-Mailer: git-send-email 2.46.2 In-Reply-To: <20241104175014.12317-1-dpenkler@gmail.com> References: <20241104175014.12317-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" Use plural for adapters Fixes: ad59cf382cd5 ("staging: gpib: add module descriptions") Signed-off-by: Dave Penkler Reviewed-by: Dan Carpenter --- drivers/staging/gpib/agilent_82357a/agilent_82357a.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/gpib/agilent_82357a/agilent_82357a.c b/drivers= /staging/gpib/agilent_82357a/agilent_82357a.c index ca9c938284c9..02c6ec9a42a0 100644 --- a/drivers/staging/gpib/agilent_82357a/agilent_82357a.c +++ b/drivers/staging/gpib/agilent_82357a/agilent_82357a.c @@ -15,7 +15,7 @@ #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]; --=20 2.46.2 From nobody Sun Nov 24 15:51:27 2024 Received: from mail-wr1-f46.google.com (mail-wr1-f46.google.com [209.85.221.46]) (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 5554F1CACFD for ; Mon, 4 Nov 2024 17:50:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.46 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730742634; cv=none; b=ii1bKmoYsS1sFXIcf8J8FBB/Nh60C7fdnejqMllX9cq7ZBdmsYLx6wqu34/cdRweNBu5KfIok/5hYzaVnGtyTKU7eVEf66CtRMZ/oVjdqFJ1v0D/ohkNgkWuIfMFDIw8nRxWZbj/dnTSATt9Z0WAAcOZCC5h37B83V66MRglWpM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730742634; c=relaxed/simple; bh=vQzpGg7deYclM9yBsT3wwI2mUpipEYQCDmwXV/+K5Vc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=I9bhCYsbhsvVjDq9zWMR9klzBwijuxCsFUdiHqrSa9RfqHd4L5fstIjgPL2T5tuevJns1E/CJBAosp1gAykykkJ9TTqpzg3t4Znrtc7UZCiGEAi+RPodKh+DepHd2GJEa3CS1/RTq7BnQT1+ByMSYO1zd5lyFpT1y9hM1pHVGBg= 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=X0Vybybq; arc=none smtp.client-ip=209.85.221.46 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="X0Vybybq" Received: by mail-wr1-f46.google.com with SMTP id ffacd0b85a97d-37d55f0cf85so2945640f8f.3 for ; Mon, 04 Nov 2024 09:50:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1730742630; x=1731347430; 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=DD8a3bEYVTRlBul1UBKXN/QyJ117Vbrsn/u7Gv5aRXI=; b=X0VybybqQwnp430YY6lTC5Xt+lMXtSuBL7OLFxOoMbjceJZZHfLqz0baXoVpmgT0qm FOcaUoWfUeYPJFkeZPZ9w+HQis+xx8M4Abgc7NP/AWb42HF8rfTY4bHZkcUdJS29hJRV EokGCVahXADdagDHg1KzrSRhQ7RZ8V0NcHXgX+fBYlxZidI2NT9auku4Sw7ZHdydS+iW UWeId+IdWOM9hNhbLjspQnIJK3Eaf2I5KS3ZQUUvkHIp7hPd1VbtXf0LY19coMmzgmbJ KafdtYAS1w8ssM11MqJibWEELinSbrMT7nUf1LxaDDUiuO1H+IcN2+1C9XSO0JQouanp 0v2Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730742630; x=1731347430; 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=DD8a3bEYVTRlBul1UBKXN/QyJ117Vbrsn/u7Gv5aRXI=; b=i2N/Rw4LyxDNPuu8wqsLe446RZ4uJ06D3qixuamodoc0JRCYqw1PFhJTEdDi0OekvN w2OkPg95jz9Vj7exYsVyN3Q2B+XAk0iEI6cELaNSSXxxxGsuyc36s1CFKg+MEnEy3Bew az3Fj0pKqIcQ0lNBc6udQDJ0x3snbF81wvWWWLEWEDtVTUHP2D+3MyIeNcKTp6/kvNYy dde12vQjFOXys0W9rMBU1kDGaMlKUf4OB4ibpNhp3wj+Ulimvae3HCqHEulOrhs0BcYK ODCmHJf7kw9FGPutFNaAiopqlP3ohxF36KTkB40uC8tkswoYxutp2vHV+40GduIz9DLA +Kcg== X-Forwarded-Encrypted: i=1; AJvYcCXRCPSuhd8OhY8tunOyFXn7wC41h5Kw9eFlgSGkgwXF99/CX96dh7wglP+uhwQYw0Z1Y9PfRLtPtRiDZsI=@vger.kernel.org X-Gm-Message-State: AOJu0YwWsIScDT03bkgBLXkDBdt3vQYKSAkBY31QgmAIz1q9zF29l6Kp n7m3duqwc2BvveJmsAGVE9EMCuwF2rGYPPw7EDBh/LVdxj9/5vUN X-Google-Smtp-Source: AGHT+IGXOzZj3KlJpbXOL+v3I9GmYe6fkZ2MRZtotgWqVaFVvxrrJgRkPxCxh25tQacS3aOFS9nVSw== X-Received: by 2002:a5d:64a8:0:b0:37d:46e3:4e88 with SMTP id ffacd0b85a97d-381be7654c6mr15656681f8f.9.1730742630403; Mon, 04 Nov 2024 09:50:30 -0800 (PST) Received: from localhost.localdomain (82-64-73-52.subs.proxad.net. [82.64.73.52]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-381c10b7f80sm13839821f8f.20.2024.11.04.09.50.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Nov 2024 09:50:29 -0800 (PST) From: Dave Penkler To: gregkh@linuxfoundation.org, linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org Cc: skhan@linuxfoundation.org, arnd@arndb.de, dan.carpenter@linaro.org, Dave Penkler Subject: [PATCH v3 06/12] staging: gpib: Add comment for mutex define Date: Mon, 4 Nov 2024 18:50:07 +0100 Message-ID: <20241104175014.12317-7-dpenkler@gmail.com> X-Mailer: git-send-email 2.46.2 In-Reply-To: <20241104175014.12317-1-dpenkler@gmail.com> References: <20241104175014.12317-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" Handle checkpatch CHECK message Signed-off-by: Dave Penkler Reviewed-by: Dan Carpenter --- drivers/staging/gpib/agilent_82357a/agilent_82357a.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/gpib/agilent_82357a/agilent_82357a.c b/drivers= /staging/gpib/agilent_82357a/agilent_82357a.c index 02c6ec9a42a0..a6b177d7f8a0 100644 --- a/drivers/staging/gpib/agilent_82357a/agilent_82357a.c +++ b/drivers/staging/gpib/agilent_82357a/agilent_82357a.c @@ -19,7 +19,7 @@ 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 --=20 2.46.2 From nobody Sun Nov 24 15:51:27 2024 Received: from mail-wr1-f50.google.com (mail-wr1-f50.google.com [209.85.221.50]) (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 A58531CBA1C for ; Mon, 4 Nov 2024 17:50:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.50 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730742636; cv=none; b=obsQanFdb7ZWR9ClQDvANz+IRXvn/HP2HVhgrACGAIuTqguJ3rmCE/6+nqEIq7FAIWotoW+LbX82ptQLy6T4kLV9UZPSLRPWPS4NeOA9wpg6TfZgLYIMFZNgDHIq4fuuyp272rbccCrslafRbv03NvyTeiqifBv8qkcy+Lq3Dqk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730742636; c=relaxed/simple; bh=lVjBIPmAWAxvwFpAqjKCBvNzEMuvfZvqfx6EZrhXWBg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=kTDdlzCtv91HjcHKBGuDLRxAVeQyAVvxJMMby8ux5Q8+bnmBk4BJxu2LAj3QCo+k8tiXea5A0Dd4W0m8jQrN60vclkQjncQCJgyZDMdiKir0eTDHJixl5c8fSEDjwwHE+dBmyaS78K0HRg0YA3JYZZyiEsjZFzShdPcPr4gb8eE= 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=Q6dajg1I; arc=none smtp.client-ip=209.85.221.50 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="Q6dajg1I" Received: by mail-wr1-f50.google.com with SMTP id ffacd0b85a97d-37d4c1b1455so2812422f8f.3 for ; Mon, 04 Nov 2024 09:50:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1730742632; x=1731347432; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=PMiOenlcN+NEHEm2VnBri2kDf2u06cLWkpnyRcrJPNU=; b=Q6dajg1IPD8kPAKtSLutXkiKW/+T5BrSiZXLIQsh1sl9AGB6m+EAheJb31fmH5A4ut vlsi//Viuu1/7mM+Vk4ttAXbLM7oD/S5zYJHQxxNekDJjZhgvS7uSgafjo9sx+L5y+s+ 0MjRM4t/a7FrNuVl9yyNUQ0drU1wTotmgYwXLE0CaBlsWWLcj2sLk159Dy+c/ffudBX+ 02Z70JPE5gTo0/WeyW6L9ubEWGJiw5ZbaQ7gfPrvYSkb9nbOTagTBHfdnNzDvk5Gs6AC w9KSdka4zLsXFK9EzwP7cZq1OceOhF/5wFe0c9oG5JdBdfRu/degn4LkfPmWN9QbrC+g hqXg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730742632; x=1731347432; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=PMiOenlcN+NEHEm2VnBri2kDf2u06cLWkpnyRcrJPNU=; b=tPGPCTyT4sdXg7DtWyRxVUnAosSAZOFhZdDbTCsfEFN9QT9MZHgsbkjBeh7tIXZuoo /ECIkz93kKsFZQLauZ+knIF3rjeVLFLIOc+DHVdXb23zVRTssFO1iYEL4tAhsRE20YfB bwdRZJIg8+ZGUKKxkzQ2w/pOk6G9bblAQf6HJRmq+k0KFXKl/g3EFtqu1holuEF44eBD kvrqkkLxZINhHkYom0tma7ciJBPgieR9dubOJP1Ky/RIM07TCsSVWm0i+oqJvYcTjdy0 Oop2mzu11MaC0owrkMj5X5IbXMOmI45Lm2h1Y6Z1TrdeNJdq5MJvuo5w2BfXuft2Bw+p u3Pg== X-Forwarded-Encrypted: i=1; AJvYcCW7Fq0408FcIrIGSwtpNiBb7DKcgROkBHe2/lMO1hRmKfleIBxuXAH59J2o6mYvnjIyDz5PcyKlnF1o9jw=@vger.kernel.org X-Gm-Message-State: AOJu0YxUcyxOLFRaOFp20sDJI7Pw/iwqfI4Jk6228jHTCRsLLKCjnrNW lo4LJ4qL9zBxBa+Kz+n4BDtAR10W5FFzGFD5QTzQsbVNt5nsu0pgNagN4Dpm X-Google-Smtp-Source: AGHT+IEYu0O/zRYXlo0EjgHgU8xNPVMv4v+PIe4NGMmPO3QQGiwv0qNR55PjL+lBtuFIicgA/BlU3g== X-Received: by 2002:adf:f6d1:0:b0:37d:4332:e91d with SMTP id ffacd0b85a97d-381b710f7f1mr15130516f8f.52.1730742631823; Mon, 04 Nov 2024 09:50:31 -0800 (PST) Received: from localhost.localdomain (82-64-73-52.subs.proxad.net. [82.64.73.52]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-381c10b7f80sm13839821f8f.20.2024.11.04.09.50.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Nov 2024 09:50:31 -0800 (PST) From: Dave Penkler To: gregkh@linuxfoundation.org, linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org Cc: skhan@linuxfoundation.org, arnd@arndb.de, dan.carpenter@linaro.org, Dave Penkler Subject: [PATCH v3 07/12] staging: gpib: Use dev_xxx for messaging Date: Mon, 4 Nov 2024 18:50:08 +0100 Message-ID: <20241104175014.12317-8-dpenkler@gmail.com> X-Mailer: git-send-email 2.46.2 In-Reply-To: <20241104175014.12317-1-dpenkler@gmail.com> References: <20241104175014.12317-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 Reviewed-by: Dan Carpenter --- .../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 15:51:27 2024 Received: from mail-wr1-f53.google.com (mail-wr1-f53.google.com [209.85.221.53]) (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 C5B531CC159 for ; Mon, 4 Nov 2024 17:50:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.53 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730742636; cv=none; b=jhcpTjwGHmk8KBs+AI7lN+GttNjIUJ/EfWsE8yiT01DW5goxOyVZFgg5Tw7iqcb1cVF2Ys0YW6yt/ZdJHI4eDsSUImfi7apeoapLDqe0bk03PTaE30lfukD8/q6/GwOjfUxIVy/IZOF3rccs/ctWgb+SZ8NnH3cO+rW9BlMJnK0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730742636; c=relaxed/simple; bh=4pTAaxFfewlJw9PAEP+mahiy/IhKHj4085X8iVV2nQY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=YZH/WhChNSMaBKOlskWcw/BXSGjjWiLCtP3O381H+W8/e+jLR0gIUJAYyP6avevj9+hDHGuk/JPyqxmnCxsmcdX+uwe6nPzqQ4VOAQ3OCI7ngfJfjtMIZQEJX6WMRILNFqCZ1k3SM+cyYaamO9i9iO9pAPTxrvi/stCpBHZEVic= 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=ViQK8Jc6; arc=none smtp.client-ip=209.85.221.53 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="ViQK8Jc6" Received: by mail-wr1-f53.google.com with SMTP id ffacd0b85a97d-37d4ac91d97so3857634f8f.2 for ; Mon, 04 Nov 2024 09:50:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1730742633; x=1731347433; 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=jGC8SOXxfXFQ5pvO+YRC7IJz4OGiSZL30CVR1jYAJkY=; b=ViQK8Jc6MP71Cx2sjsD8GuP0fqpuUrKsLTafwW3QaXODKxba7Ff/GAlBvk7iTwgYb2 ySVx29bPGK9O85zSfspjtWk5v0aZLk43r97JPc6jFQKYhgpMv873gB92dDUdJSst5qEX 5+3xfkvTo+bM3l1wvRMDKF+ZQOb6oaKMgD7OPgiW8OJ4XPA91taAajrV1CH4aJjfldpa 2J7Xgro+1zQO1Yu8rTLkzh5JskLajzppADy1S0UN08Hycd3mJF0fc0pCnji4wC3w0zMr NCjqkkp870k4Oun5KwddpYS/7iT6SgGZm46P0zYoNwztkxVPsFfACJZ4q2Id0Isbu9YX jnsg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730742633; x=1731347433; 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=jGC8SOXxfXFQ5pvO+YRC7IJz4OGiSZL30CVR1jYAJkY=; b=aUssjkWbD5EiC6yQ/wfcFlbwtopgFycZWAXlFzKxuQVnAAakChvOo86AcPJh4fT5ZJ lTZKZt+8TcKCWmBZeJElPRPDPyNxgcQqBLlGIKr+mx6Sk3H/gZSATvv+bb/49H2DWhpk kmaybWY9fyXVnWycjZm/Ppbn4MTabWKNJmHF8Nn9ocIw9/cXG1CoAQjNYCHNfajHHEYR MWXjrI6UJWJA9wLsos+dpnfF3Gql//tsaBeAbREeMoOAh3F0gq1ZwBOWMR8SVK5iJFW6 FIXruHBgR0SL9aZtLadKik19D9BIH+4sq5+svvrrrCqrjkUUoqYXbXimwnbRVBVALZOW fwKA== X-Forwarded-Encrypted: i=1; AJvYcCXwFuwesC8DRBAYJI7lHttfzTA6HvELCWALcKBskuq1Dqs/FoQi0RqyEgi0MkyOmBR/qCM6cdstBdzD+AY=@vger.kernel.org X-Gm-Message-State: AOJu0Yxc2ikllu3n3m1tXDXvrL6LhkjyHEOFxKZ81ywn9nv+Gb69XCeh NaqliCK2w1/qpXNUSl3+4MohoEATG/ZC3tABSNMjqLz7DOYWiySQcQIPFfTr X-Google-Smtp-Source: AGHT+IFuvK6Cz2AIyw5UeTFvXNS0T3fabV3pxzQGYnlHWEehdx4DPu/RKpZaKpKzuhz3vu01WMtk4A== X-Received: by 2002:a5d:6da6:0:b0:374:c1c5:43ca with SMTP id ffacd0b85a97d-381c7a6c662mr13202421f8f.32.1730742633009; Mon, 04 Nov 2024 09:50:33 -0800 (PST) Received: from localhost.localdomain (82-64-73-52.subs.proxad.net. [82.64.73.52]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-381c10b7f80sm13839821f8f.20.2024.11.04.09.50.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Nov 2024 09:50:32 -0800 (PST) From: Dave Penkler To: gregkh@linuxfoundation.org, linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org Cc: skhan@linuxfoundation.org, arnd@arndb.de, dan.carpenter@linaro.org, Dave Penkler Subject: [PATCH v3 08/12] staging: gpib: Fix Kconfig Date: Mon, 4 Nov 2024 18:50:09 +0100 Message-ID: <20241104175014.12317-9-dpenkler@gmail.com> X-Mailer: git-send-email 2.46.2 In-Reply-To: <20241104175014.12317-1-dpenkler@gmail.com> References: <20241104175014.12317-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 typo COMPIlE_TEST Fixes: 2c9f5d8c6ece ("staging: gpib: add bus specific Kconfig dependencies") Signed-off-by: Dave Penkler Reviewed-by: Dan Carpenter --- 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 15:51:27 2024 Received: from mail-wr1-f41.google.com (mail-wr1-f41.google.com [209.85.221.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 028771C729E for ; Mon, 4 Nov 2024 17:50:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.41 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730742637; cv=none; b=VvI8Ubi+egGMpC3YP+oHk0dskrKdOtxVjSNSIDRkX7eSGH8GZR+PVAzN67B+vQ73UVmT0U166sc4wUw9epwXL7YaIQ18BYigqs2aEk49PJpM1bfykdwYBfrBIJ75Sy3vCDS+tPCB3530YzhsrxVX3ny04gsHKOUImWXtyFHnVqA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730742637; c=relaxed/simple; bh=pLnkhpeYKMc1lxFV3xV4m3dNh7n0yiuHjAX660xk0n8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=eLpLNCenHAS6tPWSMeOUSfQxyt4mTIeFq4SAuCb2LQIHBTcRgp4Z9PCeUJUH4OnsMcQx1UlgoIbz4TJEFoAicG0WsxIOez+hN0+KZtU+FbSek6vqZHm+6zIhA3VLRBK6s9mFUImcdWjyW/FY0zIYcTH9mBFQ6pRnt5tJ42CC2OM= 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=YtXQIm89; arc=none smtp.client-ip=209.85.221.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="YtXQIm89" Received: by mail-wr1-f41.google.com with SMTP id ffacd0b85a97d-37ed3bd6114so2591947f8f.2 for ; Mon, 04 Nov 2024 09:50:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1730742634; x=1731347434; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=U4LeEghsieJmKHP01xof54mT4MI7YKin+O0LeMS7tsE=; b=YtXQIm89Tx0DBkALR60b71beL9sDmTWJLont7N8Vd25NzPipbJhN3l4u0fMxDVaXM4 g+DMMM6DU/ubWnbl3Ve86BHdfOKKC3awYChNCZbXCcQlP7G1AkANc8uQiE4Hpd+HRXlB qaLF0GIHX/ct9v11dF1WAjfwWSXcSfKRwoVUlGQ+kb/uoxOIXifRUvf12Oc8U7N8I1WT 9DsBJswbc3vlmWcdssoHzPtfO1bMVDlensKIDQ+X5I6vuc/KDCCoVA3f3CAI+67jzqXH SmFMllB6cB7Pmkcm6araoMbr6NGe0vB3SBOVVcWcqcUf0pAoGQ94opCXfHX7nxv+ENGK QODw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730742634; x=1731347434; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=U4LeEghsieJmKHP01xof54mT4MI7YKin+O0LeMS7tsE=; b=aJwn0us1/BYuMSc0G/KtFM9lX7sooFEjrHZanfjMGGxT3KvQbBW98H4pOixaGfoq6R ANLnxYAsOZrwx4e7C9OrzW/b2Z642XTxCOJ970GpNMlPRhqePkrhvQbPhPVlEznvOk9i JmKIZMsGNtkH8UA4KworffDpicstWr9XtD5Bwjhws8f+PzwkqYVNaqswbI6L6rOggXo0 GoAzFw1d8ZpRb5yHH7YcPOj+BmykOPBelbtGhs0mz2WvO2+RFfOWs6kWWHrGzQRN8Dqm VKAPIA6A4IE43OWUlfqKVyHo3MRRgYVTPLv25mtn3Gdq2Tz/VsD454ieDUWbaz3BhOFU +Diw== X-Forwarded-Encrypted: i=1; AJvYcCWcXyyBLANtdqwJ5KJfLcgqwFxPQepo83lmKTcIQqI3D+VaBn+ljgqUjZbKg4PHIosyG0F3FQajblel5PQ=@vger.kernel.org X-Gm-Message-State: AOJu0YwLnyt/BKuuiaaRWLShZiODasgMYUhGKPiO2RD36JrM2AJ0IdYu RAR9+PUHUG93awLXn5btC7IwxqjfYTNLM/oGjMV7IyS+2osQO1k/ X-Google-Smtp-Source: AGHT+IGL8Hz6ldNQ7BGl+8qPvJkcLFeycE81fUs3UMeqJ1aqsq/l2/DaxtogxbGayXLaq0ktaorcQQ== X-Received: by 2002:a5d:59af:0:b0:374:ca43:cda5 with SMTP id ffacd0b85a97d-381c796903amr9607821f8f.0.1730742634220; Mon, 04 Nov 2024 09:50:34 -0800 (PST) Received: from localhost.localdomain (82-64-73-52.subs.proxad.net. [82.64.73.52]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-381c10b7f80sm13839821f8f.20.2024.11.04.09.50.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Nov 2024 09:50:33 -0800 (PST) From: Dave Penkler To: gregkh@linuxfoundation.org, linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org Cc: skhan@linuxfoundation.org, arnd@arndb.de, dan.carpenter@linaro.org, Dave Penkler Subject: [PATCH v3 09/12] staging: gpib: Remove unneeded lookup table Date: Mon, 4 Nov 2024 18:50:10 +0100 Message-ID: <20241104175014.12317-10-dpenkler@gmail.com> X-Mailer: git-send-email 2.46.2 In-Reply-To: <20241104175014.12317-1-dpenkler@gmail.com> References: <20241104175014.12317-1-dpenkler@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Remove bcm2837 table as the only difference is GPIO14 and GPIO15 which are not used with the current pin maps. Signed-off-by: Dave Penkler Reviewed-by: Dan Carpenter --- drivers/staging/gpib/gpio/gpib_bitbang.c | 33 ------------------------ 1 file changed, 33 deletions(-) diff --git a/drivers/staging/gpib/gpio/gpib_bitbang.c b/drivers/staging/gpi= b/gpio/gpib_bitbang.c index 8c03e91c01dc..fc8502379c28 100644 --- a/drivers/staging/gpib/gpio/gpib_bitbang.c +++ b/drivers/staging/gpib/gpio/gpib_bitbang.c @@ -234,38 +234,6 @@ static struct gpiod_lookup_table gpib_gpio_table_0 =3D= { }, }; =20 -static struct gpiod_lookup_table gpib_gpio_table_1 =3D { - .dev_id =3D "", // device id of board device - .table =3D { - // for bcm2837 based pis (3a+ 3b 3b+ ) - GPIO_LOOKUP_IDX("GPIO_GCLK", U16_MAX, NULL, 4, GPIO_ACTIVE_HIGH), - GPIO_LOOKUP_IDX("GPIO5", U16_MAX, NULL, 5, GPIO_ACTIVE_HIGH), - GPIO_LOOKUP_IDX("GPIO6", U16_MAX, NULL, 6, GPIO_ACTIVE_HIGH), - GPIO_LOOKUP_IDX("SPI_CE1_N", U16_MAX, NULL, 7, GPIO_ACTIVE_HIGH), - GPIO_LOOKUP_IDX("SPI_CE0_N", U16_MAX, NULL, 8, GPIO_ACTIVE_HIGH), - GPIO_LOOKUP_IDX("SPI_MISO", U16_MAX, NULL, 9, GPIO_ACTIVE_HIGH), - GPIO_LOOKUP_IDX("SPI_MOSI", U16_MAX, NULL, 10, GPIO_ACTIVE_HIGH), - GPIO_LOOKUP_IDX("SPI_SCLK", U16_MAX, NULL, 11, GPIO_ACTIVE_HIGH), - GPIO_LOOKUP_IDX("GPIO12", U16_MAX, NULL, 12, GPIO_ACTIVE_HIGH), - GPIO_LOOKUP_IDX("GPIO13", U16_MAX, NULL, 13, GPIO_ACTIVE_HIGH), - GPIO_LOOKUP_IDX("TXD1", U16_MAX, NULL, 14, GPIO_ACTIVE_HIGH), - GPIO_LOOKUP_IDX("RXD1", U16_MAX, NULL, 15, GPIO_ACTIVE_HIGH), - GPIO_LOOKUP_IDX("GPIO16", U16_MAX, NULL, 16, GPIO_ACTIVE_HIGH), - GPIO_LOOKUP_IDX("GPIO17", U16_MAX, NULL, 17, GPIO_ACTIVE_HIGH), - GPIO_LOOKUP_IDX("GPIO18", U16_MAX, NULL, 18, GPIO_ACTIVE_HIGH), - GPIO_LOOKUP_IDX("GPIO19", U16_MAX, NULL, 19, GPIO_ACTIVE_HIGH), - GPIO_LOOKUP_IDX("GPIO20", U16_MAX, NULL, 20, GPIO_ACTIVE_HIGH), - GPIO_LOOKUP_IDX("GPIO21", U16_MAX, NULL, 21, GPIO_ACTIVE_HIGH), - GPIO_LOOKUP_IDX("GPIO22", U16_MAX, NULL, 22, GPIO_ACTIVE_HIGH), - GPIO_LOOKUP_IDX("GPIO23", U16_MAX, NULL, 23, GPIO_ACTIVE_HIGH), - GPIO_LOOKUP_IDX("GPIO24", U16_MAX, NULL, 24, GPIO_ACTIVE_HIGH), - GPIO_LOOKUP_IDX("GPIO25", U16_MAX, NULL, 25, GPIO_ACTIVE_HIGH), - GPIO_LOOKUP_IDX("GPIO26", U16_MAX, NULL, 26, GPIO_ACTIVE_HIGH), - GPIO_LOOKUP_IDX("GPIO27", U16_MAX, NULL, 27, GPIO_ACTIVE_HIGH), - { } - }, -}; - static struct gpiod_lookup_table gpib_gpio_table_2 =3D { .dev_id =3D "", // device id of board device .table =3D { @@ -300,7 +268,6 @@ static struct gpiod_lookup_table gpib_gpio_table_2 =3D { =20 static struct gpiod_lookup_table *lookup_tables[] =3D { &gpib_gpio_table_0, - &gpib_gpio_table_1, &gpib_gpio_table_2, 0 }; --=20 2.46.2 From nobody Sun Nov 24 15:51:27 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 556D91CACD8 for ; Mon, 4 Nov 2024 17:50:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.42 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730742640; cv=none; b=dDvL4GCEL3P3sbsZOqN+2tRm6IxcCVIPl9x0D5pLKbM2LuPEeRaN1I242w8imbsQ6iX3zJ+AyOZ9bsZnfzs0GwAxRSRi+9vaweVAYatcW8DaYKkEag2s8QrTGwoEDcyfjShOqY8/Ed5MYQGXorUFartXYcOCBRUBqiN5KBx1Byo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730742640; c=relaxed/simple; bh=8gIEE5erXu36bvNvc+z4d5bEU5WInaaHUZh7cwyNQlM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=CHKgTEV7MZ6fFNxpniQ9TvHWRCP0D/sSPemZXeOgj93iwAulIkp2pFl4WjrVuLnD5pm7psz0eAk4TFiSnGJEiS7d5NAmdiKfYFYqWAwoL2bUCMtQavCb9lrf9GmAvfuvCDpV02OFUpsehCmPYzQlPrKfgDgS4yJ5d1+YPbM+yzk= 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=jfCf81qr; 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="jfCf81qr" Received: by mail-wm1-f42.google.com with SMTP id 5b1f17b1804b1-43161c0068bso37328095e9.1 for ; Mon, 04 Nov 2024 09:50:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1730742636; x=1731347436; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=wYNa6oziVbKvDXACDgmoC/if6wLv2o++lD6SKYvehsE=; b=jfCf81qrmdhncrkFJc6jbhsfsjiRdUGwYMtDgVxVRNqKWj4MOxb8czezULWAtbiBT8 imuaiMTMaBiXPgP+laX2/EPBdVSKjOXDPQjBVccOcA2lwnlLPbmDkCr7/NJnNMN1L7en C35JeXsVTxdB7eSODvKe9s5LQXcdpcnEWQWFgFStv5yZ1we8LkUqTZrMxFHjyZcT1cqt wNJoelxNWgiUr3AchioJdkzyzRnhqF3zW7oyF+sL3lVdnsKS+RL/7/D3gV1FvX12tP/B asykJ2arGj/W/lKGVoUhnDA6CiaY8nq6GLbnor6PVW5hMPsGpzaPGdZlxppcpGB+AVvQ EtfA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730742636; x=1731347436; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=wYNa6oziVbKvDXACDgmoC/if6wLv2o++lD6SKYvehsE=; b=nlc6v8BUAoJp2nf2+Z8fX8Y4aemovMmo67pfha2l+2BkkNr3DEU03wuiljuZDiVBNc ueRs0DIkHNHp7u5vsihXjrP19bqit9YLYHW0xMPN7QqgyYDaRPqy8oGV/go5PSijP2I2 JtU9P3CsKVzSo1Z7YjwF8+qPD8SE0ehalOkVioFteWEcfGT4dacowIIH2W4DKM1mKyEs 0LLeaEw38LbY2U+r1bmZQplr9p4Yfcz2vIeXNiJIK5JibjKbdOSscv7mLgE+vFb5FW8f /EC2a8Rldrq1yqyp6jA/l+DMbQP8rDj0HtXykc2nvTPyMdXgZOanPY/XaKTofbb4Pp/+ gfrg== X-Forwarded-Encrypted: i=1; AJvYcCVSEXawqPCdfxWRhisuGJm9KG/xuIlbjvFvwXCwhVYR3DWk4aiFJTVbln70g3mXRgOiSjzogfcC4tGgk1E=@vger.kernel.org X-Gm-Message-State: AOJu0YwOzH2e1HUBknZe5OKmRSdwKjE591+7XowWa/5D+rqpSr4nvIt+ 0YFxKCn9igzXSBrYPhMMgszTVA0B3NLuaLMHNHwpceZyi9C7gwRHAng+EOJ5 X-Google-Smtp-Source: AGHT+IGnVgxrx5ovonj/QGgF0+NBzmzt37wTCOqj6iqbkg5z7fiN4rOHRJNLIbNl8YLUTY1JcGmxVg== X-Received: by 2002:a05:6000:1fa1:b0:37c:c842:a16e with SMTP id ffacd0b85a97d-381c7a47818mr8476760f8f.5.1730742635646; Mon, 04 Nov 2024 09:50:35 -0800 (PST) Received: from localhost.localdomain (82-64-73-52.subs.proxad.net. [82.64.73.52]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-381c10b7f80sm13839821f8f.20.2024.11.04.09.50.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Nov 2024 09:50:34 -0800 (PST) From: Dave Penkler To: gregkh@linuxfoundation.org, linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org Cc: skhan@linuxfoundation.org, arnd@arndb.de, dan.carpenter@linaro.org, Dave Penkler Subject: [PATCH v3 10/12] staging: gpib: Remove GPIO14 and GPIO15 lines in lookup tables Date: Mon, 4 Nov 2024 18:50:11 +0100 Message-ID: <20241104175014.12317-11-dpenkler@gmail.com> X-Mailer: git-send-email 2.46.2 In-Reply-To: <20241104175014.12317-1-dpenkler@gmail.com> References: <20241104175014.12317-1-dpenkler@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" GPIO14 and GPIO15 are not used in the current pin maps Signed-off-by: Dave Penkler Reviewed-by: Dan Carpenter --- drivers/staging/gpib/gpio/gpib_bitbang.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/drivers/staging/gpib/gpio/gpib_bitbang.c b/drivers/staging/gpi= b/gpio/gpib_bitbang.c index fc8502379c28..78032af5061c 100644 --- a/drivers/staging/gpib/gpio/gpib_bitbang.c +++ b/drivers/staging/gpib/gpio/gpib_bitbang.c @@ -216,8 +216,6 @@ static struct gpiod_lookup_table gpib_gpio_table_0 =3D { GPIO_LOOKUP_IDX("SPI_SCLK", U16_MAX, NULL, 11, GPIO_ACTIVE_HIGH), GPIO_LOOKUP_IDX("GPIO12", U16_MAX, NULL, 12, GPIO_ACTIVE_HIGH), GPIO_LOOKUP_IDX("GPIO13", U16_MAX, NULL, 13, GPIO_ACTIVE_HIGH), - GPIO_LOOKUP_IDX("TXD0", U16_MAX, NULL, 14, GPIO_ACTIVE_HIGH), - GPIO_LOOKUP_IDX("RXD0", U16_MAX, NULL, 15, GPIO_ACTIVE_HIGH), GPIO_LOOKUP_IDX("GPIO16", U16_MAX, NULL, 16, GPIO_ACTIVE_HIGH), GPIO_LOOKUP_IDX("GPIO17", U16_MAX, NULL, 17, GPIO_ACTIVE_HIGH), GPIO_LOOKUP_IDX("GPIO18", U16_MAX, NULL, 18, GPIO_ACTIVE_HIGH), @@ -248,8 +246,6 @@ static struct gpiod_lookup_table gpib_gpio_table_2 =3D { GPIO_LOOKUP_IDX("GPIO11", U16_MAX, NULL, 11, GPIO_ACTIVE_HIGH), GPIO_LOOKUP_IDX("GPIO12", U16_MAX, NULL, 12, GPIO_ACTIVE_HIGH), GPIO_LOOKUP_IDX("GPIO13", U16_MAX, NULL, 13, GPIO_ACTIVE_HIGH), - GPIO_LOOKUP_IDX("GPIO14", U16_MAX, NULL, 14, GPIO_ACTIVE_HIGH), - GPIO_LOOKUP_IDX("GPIO15", U16_MAX, NULL, 15, GPIO_ACTIVE_HIGH), GPIO_LOOKUP_IDX("GPIO16", U16_MAX, NULL, 16, GPIO_ACTIVE_HIGH), GPIO_LOOKUP_IDX("GPIO17", U16_MAX, NULL, 17, GPIO_ACTIVE_HIGH), GPIO_LOOKUP_IDX("GPIO18", U16_MAX, NULL, 18, GPIO_ACTIVE_HIGH), --=20 2.46.2 From nobody Sun Nov 24 15:51:27 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 09BB51CACD9 for ; Mon, 4 Nov 2024 17:50:38 +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=1730742640; cv=none; b=n8omSZ7FyHcLgNmz4Dtt6XtLDSdubqBZPrGhpB2y4+uhefKWjzj+xEkJLjZf2Wqz95PbaCT9dl6NBlrQQxDd68gWMb7rQx84Ak+1y8s6Oa12q3hJ54TmPIgPOIwSHpC5EHL81BhAqliQKnd0exNw6rZo4wgl3tu95QwpjasO+f4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730742640; c=relaxed/simple; bh=23ngUTksLpTkGw0aoSlNw3ryYZyvaCsuu0KwcDUyKbQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=f5d7wgcdrJkkvQtwAfLVYZ9NI7j4JgnPOGeXG/ar1DNIIDXr1YOKHZRO2xndRvXwditjP9MZuA024orYmi7PmVB6SlVQhy5oD/WiIEnVx5IpSSDK9nqAXipyj0ovo8SJjML68ahzKVJhrMq8YbMwtY/nwF822IWFmoANxV+e36k= 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=BzQ9ndBM; 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="BzQ9ndBM" Received: by mail-wm1-f45.google.com with SMTP id 5b1f17b1804b1-43155afca99so33657585e9.1 for ; Mon, 04 Nov 2024 09:50:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1730742637; x=1731347437; 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=3bZW2vMqumbONmM6bkNUy1UefcqeQAO43C3ir03Pf+8=; b=BzQ9ndBMA91Ax5xAMyKb9ex8DGTuepbE4rqvN48vdikzEyPQZ1Ky1/Zr9zCPMQ0aPJ Q0CsB4EJgtn2hhyBoPPGGHpEXi9F2WOzFIdYW5RmZ5FA5c7+jsbll2gCCpqq0giax0M9 ZNH1Z98MHFeZ8Cj15VigahzEYb5yJ9s0DnOZ2WtXffHdqaeUWx1uNj2YwehrOgxXWT8c B/Ua3wuBf4JuzLaWo0h6RT9FPy33JNixGVUAmvPwaNVlxV5xtMwCsoG8HyQxMrWRUiAp DTQnaFL2U3nm+uyTdMhF652E6b9jKK6w9XrshYxbhIe5+71pAYZsgfo81E9cI4SGs3B4 E1Gg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730742637; x=1731347437; 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=3bZW2vMqumbONmM6bkNUy1UefcqeQAO43C3ir03Pf+8=; b=Jtn9bT/7+6tmvntron4msmGn3KdLHAW62+Jnj6++odDHVhTlL3gG4WofgOk1+blyy7 0S7VFx9jsb0dNs8qtIeLUaoklU76D1LrcxmdnPlrJCVpQRbQl6Hp4qOydxTb3bhfbedm 5oX5nm/rq7Ihm2k/LrIyYFBo3W7FHLd4zCNh3ElPn2mrEh25q+ncmTC7z4XeLhv85AQV pLFDdJsLdRWfSR0xWJKWScopcoiD6aO9Yv9AcCXGdcLsTeVN7zOnAtiXg4d1b8duHqpm bn6Fk7M2Sv/jSZEMKDHgj3fQdWzK5I2cRHikfPLRnZC9wc1ex+ngNnyUtqPmL974j2/a cvSQ== X-Forwarded-Encrypted: i=1; AJvYcCUHjmthoaX6PE0Ro88u7hc+xLtQo4fPZnGx8eqJ02+DICu7xWdMK1di8d+cnW9PTeZYbrDBttlNr2V7JTk=@vger.kernel.org X-Gm-Message-State: AOJu0YxG3I9DgqOBnMKYlTT5Gz/FPP+RTnkjbLZzhsL0wsfEVpKok4un cZYqYyfGWweDQX6yVTgiDFx8xUUXc6OWB7CGlwrJOxBdxe6qJvUO X-Google-Smtp-Source: AGHT+IED9koMHdtoigV1IUNLC0Lf8hQjcXzlL4YR2SQSl38kHBY6wovIRGamZetZgT8dKXARQicxow== X-Received: by 2002:a05:6000:178b:b0:37c:c9bc:1be6 with SMTP id ffacd0b85a97d-381c79bb817mr9913699f8f.16.1730742637254; Mon, 04 Nov 2024 09:50:37 -0800 (PST) Received: from localhost.localdomain (82-64-73-52.subs.proxad.net. [82.64.73.52]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-381c10b7f80sm13839821f8f.20.2024.11.04.09.50.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Nov 2024 09:50:36 -0800 (PST) From: Dave Penkler To: gregkh@linuxfoundation.org, linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org Cc: skhan@linuxfoundation.org, arnd@arndb.de, dan.carpenter@linaro.org, Dave Penkler Subject: [PATCH v3 11/12] staging: gpib: Re-order the lookup tables Date: Mon, 4 Nov 2024 18:50:12 +0100 Message-ID: <20241104175014.12317-12-dpenkler@gmail.com> X-Mailer: git-send-email 2.46.2 In-Reply-To: <20241104175014.12317-1-dpenkler@gmail.com> References: <20241104175014.12317-1-dpenkler@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Re-order the tables so that the bcm27xx table is used first as these devices are more popular and numerous than the older ones. This is slightly more efficient for the later pi3 and subsequent models but should not be noticable in practice for all users. Signed-off-by: Dave Penkler Reviewed-by: Dan Carpenter --- drivers/staging/gpib/gpio/gpib_bitbang.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/staging/gpib/gpio/gpib_bitbang.c b/drivers/staging/gpi= b/gpio/gpib_bitbang.c index 78032af5061c..a2d562cbd65b 100644 --- a/drivers/staging/gpib/gpio/gpib_bitbang.c +++ b/drivers/staging/gpib/gpio/gpib_bitbang.c @@ -202,7 +202,7 @@ int gpios_vector[] =3D { =20 /* Lookup table for general GPIOs */ =20 -static struct gpiod_lookup_table gpib_gpio_table_0 =3D { +static struct gpiod_lookup_table gpib_gpio_table_1 =3D { // for bcm2835/6 .dev_id =3D "", // device id of board device .table =3D { @@ -232,7 +232,7 @@ static struct gpiod_lookup_table gpib_gpio_table_0 =3D { }, }; =20 -static struct gpiod_lookup_table gpib_gpio_table_2 =3D { +static struct gpiod_lookup_table gpib_gpio_table_0 =3D { .dev_id =3D "", // device id of board device .table =3D { // for bcm27xx based pis (b b+ 2b 3b 3b+ 4 5) @@ -264,7 +264,7 @@ static struct gpiod_lookup_table gpib_gpio_table_2 =3D { =20 static struct gpiod_lookup_table *lookup_tables[] =3D { &gpib_gpio_table_0, - &gpib_gpio_table_2, + &gpib_gpio_table_1, 0 }; =20 --=20 2.46.2 From nobody Sun Nov 24 15:51:27 2024 Received: from mail-wm1-f51.google.com (mail-wm1-f51.google.com [209.85.128.51]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 520BA1CACDE for ; Mon, 4 Nov 2024 17:50:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.51 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730742642; cv=none; b=Rei2lfn1w7IJa13eYyghHdIHkEsVI6/clxE4sdndAjYnVYtfUgBz2QVywRRuQdwYcQR4VfszGwSq34Ize/i1fspbsh8Mvps+o1Coci1pfaTax0zKyrwE4KvyZDiE64UPT5OPpiuHeYz0DnwrNJWZBTs1i0IZr0GWsmVMxCffYPI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730742642; c=relaxed/simple; bh=r8oDawuzwrCTjMJNkuzF+kmtf/cLqFGhI9bi3b/8YqQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Xzp4phsYZsZawQ0CHw9anufl8Hp5+1hF26iKd1Fll5a24YZ+udzoWM+EIxWVHAt1Gi8Mt1ByKAuz14/DO2VXLgCxLprciUdsGGaVthvFnfcST6kwzXaHtDATMuLdPqHQeheFji6pcsBAhtAoUJOr5HS20/sIHmiyf909OLDb8wA= 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=gNlEqa+P; arc=none smtp.client-ip=209.85.128.51 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="gNlEqa+P" Received: by mail-wm1-f51.google.com with SMTP id 5b1f17b1804b1-4316a44d1bbso38513115e9.3 for ; Mon, 04 Nov 2024 09:50:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1730742639; x=1731347439; 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=OnCRniz6rwW4FxyVUqUDwT3HfYK1tMoSQehysVO/b1w=; b=gNlEqa+P5NOuKVN7sXJbQwKNfj/qQsZKODWyR0YQUQN5UnoX1YfevjDdMpGcpK+Wtg tHniFlskkquH5aELCAGiymKjG38WWyZVzczvCtZKA0IpKNzUBeSZzfh0d/hkDAjyeTTC l3UDzdqopC2SUWNyMRyH5xkPs0vt/Nt/qM2+9kgGxpT01N4esiKTFhFv3LZ8POKaSnb4 cJsRdWgwB+mzzAGGbSBhPaSDl49yVCrIFRWKcCU3sPbzs8ytWQm0+7mHWX+MyKUr3zMp +6tHmQlz5BjpxCMfpzvFlT66N1zw45qSIfRZtRjbpDy1boUZBAIPeqc4BWi8osRMBZEo pn3Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730742639; x=1731347439; 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=OnCRniz6rwW4FxyVUqUDwT3HfYK1tMoSQehysVO/b1w=; b=lD1MOj2Q+oT0hmCa3kfw42W3haIz1DdPBNdbXjWE7SwWXIlxCxceVhq0AmXa7uuQI6 46tPZVw7VKkZdkXrbDdaZXsyhlBkcnH5NTNhjCLQh4BjVCxGRBz4SLM6j0VjfXt5OMK+ VhYKtuMRtHV1vws0iT7FNLyeCtsSKU3OnvDkRFFbTHX64SOSaeMlHVflPiIBQMelMKXR 5oCWmphuoOtH+GHqxo2WJngz9rQJVAef09Dl3lmct5ZetMtnD38rF1DmbtEceZfUSKTs 9WrnXQaYeaUsXJUBrhRcnXpUfrPdQ+CAQnGqtlnM23D0E7tBfRMLRokFS7q3YRj8x+eH DMlg== X-Forwarded-Encrypted: i=1; AJvYcCVtQtdb1E0G3dP1//WeIZY8GwkEy5kxiJdquOCVd0GV0sOL8vYWu+Y78DNCbHO95nz/K+DQqMr3wMMf2JI=@vger.kernel.org X-Gm-Message-State: AOJu0YwroZ6mWl4T1zj2Yve4fFuyngzIXnfemiaJUIVrq6pKn2y8M0yt cwsTjCp82o/UOu+Dbs5LQzKQExgaKEYYm/fZU9phKqKfjmfdIKz3XVkRurf5 X-Google-Smtp-Source: AGHT+IGNRKQXMXIFktTsqSu5Cqzlhbz5LhgCV8zs8OBKycVfuNRvFw3mF9TjCqlV/c3pcFyFe6H3dw== X-Received: by 2002:a05:600c:3587:b0:42c:c401:6d67 with SMTP id 5b1f17b1804b1-4327b6f464amr133648605e9.6.1730742638570; Mon, 04 Nov 2024 09:50:38 -0800 (PST) Received: from localhost.localdomain (82-64-73-52.subs.proxad.net. [82.64.73.52]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-381c10b7f80sm13839821f8f.20.2024.11.04.09.50.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Nov 2024 09:50:37 -0800 (PST) From: Dave Penkler To: gregkh@linuxfoundation.org, linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org Cc: skhan@linuxfoundation.org, arnd@arndb.de, dan.carpenter@linaro.org, Dave Penkler Subject: [PATCH v3 12/12] staging: gpib: Correct check for max secondary address Date: Mon, 4 Nov 2024 18:50:13 +0100 Message-ID: <20241104175014.12317-13-dpenkler@gmail.com> X-Mailer: git-send-email 2.46.2 In-Reply-To: <20241104175014.12317-1-dpenkler@gmail.com> References: <20241104175014.12317-1-dpenkler@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" GPIB secondary addresses can be between 0 and 31 inclusive unlike primary addresses where address 31 is not a valid device address. When 31 is used as a primary talk address it forms the UNT (Untalk) command and when used as a listener address it forms the UNL (Unlisten) commmand. The library was incorrectly not allowing a secondary address with a value of 31 to be used. Fixes: 9dde4559e939 ("staging: gpib: Add GPIB common core driver") Signed-off-by: Dave Penkler Reviewed-by: Dan Carpenter --- drivers/staging/gpib/common/gpib_os.c | 4 +--- drivers/staging/gpib/common/iblib.c | 6 +++--- drivers/staging/gpib/common/ibsys.h | 3 +++ 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/drivers/staging/gpib/common/gpib_os.c b/drivers/staging/gpib/c= ommon/gpib_os.c index e84097ac8f69..0285180ae1f0 100644 --- a/drivers/staging/gpib/common/gpib_os.c +++ b/drivers/staging/gpib/common/gpib_os.c @@ -525,8 +525,6 @@ int serial_poll_all(gpib_board_t *board, unsigned int u= sec_timeout) * SPD and UNT are sent at the completion of the poll. */ =20 -static const int gpib_addr_max =3D 30; /* max address for primary/secondar= y gpib addresses */ - int dvrsp(gpib_board_t *board, unsigned int pad, int sad, unsigned int usec_timeout, uint8_t *result) { @@ -538,7 +536,7 @@ int dvrsp(gpib_board_t *board, unsigned int pad, int sa= d, return -1; } =20 - if (pad > gpib_addr_max || sad > gpib_addr_max) { + if (pad > MAX_GPIB_PRIMARY_ADDRESS || sad > MAX_GPIB_SECONDARY_ADDRESS) { pr_err("gpib: bad address for serial poll"); return -1; } diff --git a/drivers/staging/gpib/common/iblib.c b/drivers/staging/gpib/com= mon/iblib.c index fc57e760c144..db1911cc1b26 100644 --- a/drivers/staging/gpib/common/iblib.c +++ b/drivers/staging/gpib/common/iblib.c @@ -479,7 +479,7 @@ int ibsre(gpib_board_t *board, int enable) */ int ibpad(gpib_board_t *board, unsigned int addr) { - if (addr > 30) { + if (addr > MAX_GPIB_PRIMARY_ADDRESS) { pr_err("gpib: invalid primary address %u\n", addr); return -1; } @@ -498,8 +498,8 @@ int ibpad(gpib_board_t *board, unsigned int addr) */ int ibsad(gpib_board_t *board, int addr) { - if (addr > 30) { - pr_err("gpib: invalid secondary address %i, must be 0-30\n", addr); + if (addr > MAX_GPIB_SECONDARY_ADDRESS) { + pr_err("gpib: invalid secondary address %i\n", addr); return -1; } board->sad =3D addr; diff --git a/drivers/staging/gpib/common/ibsys.h b/drivers/staging/gpib/com= mon/ibsys.h index b78ca5ea4da1..da20971e9c7e 100644 --- a/drivers/staging/gpib/common/ibsys.h +++ b/drivers/staging/gpib/common/ibsys.h @@ -16,6 +16,9 @@ #include #include =20 +#define MAX_GPIB_PRIMARY_ADDRESS 30 +#define MAX_GPIB_SECONDARY_ADDRESS 31 + int gpib_allocate_board(gpib_board_t *board); void gpib_deallocate_board(gpib_board_t *board); =20 --=20 2.46.2