Remove redundant 'int' keyword from 'unsigned long long int' type cast.
'unsigned long long' and 'unsigned long long int' are identical types
in C. Prefer the shorter form as suggested by checkpatch.pl --strict.
Signed-off-by: Tomasz Unger <tomasz.unger(a)yahoo.pl>
---
drivers/staging/greybus/Documentation/firmware/authenticate.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/staging/greybus/Documentation/firmware/authenticate.c b/drivers/staging/greybus/Documentation/firmware/authenticate.c
index 3d2c6f88a138..0ef88b7d24de 100644
--- a/drivers/staging/greybus/Documentation/firmware/authenticate.c
+++ b/drivers/staging/greybus/Documentation/firmware/authenticate.c
@@ -58,7 +58,7 @@ int main(int argc, char *argv[])
goto close_fd;
}
- printf("UID received: 0x%llx\n", *(unsigned long long int *)(uid.uid));
+ printf("UID received: 0x%llx\n", *(unsigned long long *)(uid.uid));
/* Get certificate */
printf("Get IMS certificate\n");
---
base-commit: 6ae79e7736ee6a5f920867e5346d8a106cd1db74
change-id: 20260305-greybus-unsigned-long-long-e7465302d3fa
Best regards,
--
Tomasz Unger <tomasz.unger(a)yahoo.pl>
This patch fixes the checkpatch.pl warning:
WARNING: Argument 'conn' is not used in function-like macro
The gb_dev_loopback_ro_attr macro accepted a 'conn' argument which was
never used in its expansion. The argument was removed from the macro
definition and its invocation.
Signed-off-by: sluisr <contact(a)sluisr.com>
---
drivers/staging/greybus/loopback.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/staging/greybus/loopback.c b/drivers/staging/greybus/loopback.c
index aa9c73cb0..855d5051c 100644
--- a/drivers/staging/greybus/loopback.c
+++ b/drivers/staging/greybus/loopback.c
@@ -193,7 +193,7 @@ static ssize_t field##_store(struct device *dev, \
} \
static DEVICE_ATTR_RW(field)
-#define gb_dev_loopback_ro_attr(field, conn) \
+#define gb_dev_loopback_ro_attr(field) \
static ssize_t field##_show(struct device *dev, \
struct device_attribute *attr, \
char *buf) \
@@ -305,7 +305,7 @@ gb_dev_loopback_rw_attr(us_wait, d);
/* Maximum iterations for a given operation: 1-(2^32-1), 0 implies infinite */
gb_dev_loopback_rw_attr(iteration_max, u);
/* The current index of the for (i = 0; i < iteration_max; i++) loop */
-gb_dev_loopback_ro_attr(iteration_count, false);
+gb_dev_loopback_ro_attr(iteration_count);
/* A flag to indicate synchronous or asynchronous operations */
gb_dev_loopback_rw_attr(async, u);
/* Timeout of an individual asynchronous request */
--
2.53.0
Standardize code in the file:
drivers/staging/greybus/Documentation/firmware/authenticate.c
by making the following changes:
1. Remove redundant 'int' from 'unsigned long long int' as suggested by
checkpatch when printing the obtained device UID:
printf("UID received: 0x%llx\n", *(unsigned long long *)(uid.uid));
2. Fix alignment of multi-line printf statement to match opening
parentheses:
printf("Authenticated, result (%02x), sig-size (%02x)\n",
authenticate.result_code, authenticate.signature_size);
Signed-off-by: Prithvi Tambewagh <activprithvi(a)gmail.com>
---
drivers/staging/greybus/Documentation/firmware/authenticate.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/staging/greybus/Documentation/firmware/authenticate.c b/drivers/staging/greybus/Documentation/firmware/authenticate.c
index 3d2c6f88a138..ba4b16b04557 100644
--- a/drivers/staging/greybus/Documentation/firmware/authenticate.c
+++ b/drivers/staging/greybus/Documentation/firmware/authenticate.c
@@ -58,7 +58,7 @@ int main(int argc, char *argv[])
goto close_fd;
}
- printf("UID received: 0x%llx\n", *(unsigned long long int *)(uid.uid));
+ printf("UID received: 0x%llx\n", *(unsigned long long *)(uid.uid));
/* Get certificate */
printf("Get IMS certificate\n");
@@ -85,7 +85,7 @@ int main(int argc, char *argv[])
}
printf("Authenticated, result (%02x), sig-size (%02x)\n",
- authenticate.result_code, authenticate.signature_size);
+ authenticate.result_code, authenticate.signature_size);
close_fd:
close(fd);
base-commit: eb71ab2bf72260054677e348498ba995a057c463
--
2.34.1
This series fixes some of the checkpatch.pl checks
highlighted in greybus.
Changes in v4:
- As per the suggestions of Greg K.H., I am removing two patches
that added comments to mutex declarations, since it is hard to
verify them, without extensive analysis and documentation.
- The patches were sent out-of-order previously, so will
try sending them all together this time.
Changes in v3:
- Added cover letter detailing changes made in subsequent versions of
patch-sets.
- v2 patch-set was only emailed to maintainers. The email was forwarded
to the lists, but this rendered the patch-set corrupted. v3 hopes to
correct this.
Changes in v2:
- Split patch 1 into two individual patches 1/4 and 2/4 to keep logical
changes separate.
Rachit Dhar (2):
staging: greybus: fixed styling issue in fw-management.c
staging: greybus: resolved checkpatch checks for light.c
drivers/staging/greybus/fw-management.c | 3 ++-
drivers/staging/greybus/light.c | 4 ++--
2 files changed, 4 insertions(+), 3 deletions(-)
--
2.43.0
The Greybus specification defines the Vendor Specific bundle
class[1]. Using this class allows vendors to avoid defining a
custom generic class, simplifying driver development. Currently,
drivers can register to either match on a bundle class or a
Vendor & Product ID with `GREYBUS_CLASS` and `GREYBUS_DEVICE`
respectively.
However, when matching to a vendor specific driver, the current
implementation does not check the bundle's class. This has the
effect of matching the vendor specific driver to ANY bundle found
in the device's manifest, regardless of its class. This is
incorrect as only vendor class bundles should be considered.
For instance, a driver registered for `GREYBUS_DEVICE(0xCAFE, 0xBABE)`
would be matched to a Camera class bundle found on that device.
Instead, only a `GREYBUS_CLASS_VENDOR` class bundle should get
matched to the driver.
[1] https://github.com/projectara/greybus-spec/blob/149aa4a8f4422533475e0193ece…
Signed-off-by: Yacin Belmihoub-Martel <yacin.belmihoubmartel(a)gmail.com>
---
drivers/greybus/core.c | 12 ++++--------
include/linux/greybus.h | 10 +++-------
include/linux/greybus/greybus_id.h | 6 ------
3 files changed, 7 insertions(+), 21 deletions(-)
diff --git a/drivers/greybus/core.c b/drivers/greybus/core.c
index 313eb65cf..4cd218d29 100644
--- a/drivers/greybus/core.c
+++ b/drivers/greybus/core.c
@@ -60,16 +60,12 @@ static int is_gb_svc(const struct device *dev)
static bool greybus_match_one_id(struct gb_bundle *bundle,
const struct greybus_bundle_id *id)
{
- if ((id->match_flags & GREYBUS_ID_MATCH_VENDOR) &&
- (id->vendor != bundle->intf->vendor_id))
+ if (id->class != bundle->class)
return false;
- if ((id->match_flags & GREYBUS_ID_MATCH_PRODUCT) &&
- (id->product != bundle->intf->product_id))
- return false;
-
- if ((id->match_flags & GREYBUS_ID_MATCH_CLASS) &&
- (id->class != bundle->class))
+ if ((id->class == GREYBUS_CLASS_VENDOR) &&
+ (id->vendor != bundle->intf->vendor_id ||
+ id->product != bundle->intf->product_id))
return false;
return true;
diff --git a/include/linux/greybus.h b/include/linux/greybus.h
index 4d58e27ce..1f1b3cb5c 100644
--- a/include/linux/greybus.h
+++ b/include/linux/greybus.h
@@ -37,18 +37,14 @@
#define GREYBUS_VERSION_MAJOR 0x00
#define GREYBUS_VERSION_MINOR 0x01
-#define GREYBUS_ID_MATCH_DEVICE \
- (GREYBUS_ID_MATCH_VENDOR | GREYBUS_ID_MATCH_PRODUCT)
+#define GREYBUS_DEVICE_CLASS(c) \
+ .class = (c),
#define GREYBUS_DEVICE(v, p) \
- .match_flags = GREYBUS_ID_MATCH_DEVICE, \
+ GREYBUS_DEVICE_CLASS(GREYBUS_CLASS_VENDOR)\
.vendor = (v), \
.product = (p),
-#define GREYBUS_DEVICE_CLASS(c) \
- .match_flags = GREYBUS_ID_MATCH_CLASS, \
- .class = (c),
-
/* Maximum number of CPorts */
#define CPORT_ID_MAX 4095 /* UniPro max id is 4095 */
#define CPORT_ID_BAD U16_MAX
diff --git a/include/linux/greybus/greybus_id.h b/include/linux/greybus/greybus_id.h
index f4c844009..e33ed0061 100644
--- a/include/linux/greybus/greybus_id.h
+++ b/include/linux/greybus/greybus_id.h
@@ -11,7 +11,6 @@
struct greybus_bundle_id {
- __u16 match_flags;
__u32 vendor;
__u32 product;
__u8 class;
@@ -19,9 +18,4 @@ struct greybus_bundle_id {
kernel_ulong_t driver_info __aligned(sizeof(kernel_ulong_t));
};
-/* Used to match the greybus_bundle_id */
-#define GREYBUS_ID_MATCH_VENDOR BIT(0)
-#define GREYBUS_ID_MATCH_PRODUCT BIT(1)
-#define GREYBUS_ID_MATCH_CLASS BIT(2)
-
#endif /* __LINUX_GREYBUS_ID_H */
--
2.52.0
Driver core holds a reference to the USB interface and its parent USB
device while the interface is bound to a driver and there is no need to
take additional references unless the structures are needed after
disconnect.
Drop the redundant device reference to reduce cargo culting, make it
easier to spot drivers where an extra reference is needed, and reduce
the risk of memory leaks when drivers fail to release it.
Signed-off-by: Johan Hovold <johan(a)kernel.org>
---
Changes in v2
- drop temporary udev variable as reported by the kernel test robot
(W=1 warning)
drivers/greybus/es2.c | 6 +-----
1 file changed, 1 insertion(+), 5 deletions(-)
diff --git a/drivers/greybus/es2.c b/drivers/greybus/es2.c
index 6ae0ac828afa..a97868009191 100644
--- a/drivers/greybus/es2.c
+++ b/drivers/greybus/es2.c
@@ -772,7 +772,6 @@ static int check_urb_status(struct urb *urb)
static void es2_destroy(struct es2_ap_dev *es2)
{
- struct usb_device *udev;
struct urb *urb;
int i;
@@ -804,10 +803,7 @@ static void es2_destroy(struct es2_ap_dev *es2)
gb_hd_cport_release_reserved(es2->hd, ES2_CPORT_CDSI1);
gb_hd_cport_release_reserved(es2->hd, ES2_CPORT_CDSI0);
- udev = es2->usb_dev;
gb_hd_put(es2->hd);
-
- usb_put_dev(udev);
}
static void cport_in_callback(struct urb *urb)
@@ -1257,7 +1253,7 @@ static int ap_probe(struct usb_interface *interface,
bool bulk_in_found = false;
bool arpc_in_found = false;
- udev = usb_get_dev(interface_to_usbdev(interface));
+ udev = interface_to_usbdev(interface);
num_cports = apb_get_cport_count(udev);
if (num_cports < 0) {
--
2.52.0
Driver core holds a reference to the USB interface and its parent USB
device while the interface is bound to a driver and there is no need to
take additional references unless the structures are needed after
disconnect.
Drop the redundant device reference to reduce cargo culting, make it
easier to spot drivers where an extra reference is needed, and reduce
the risk of memory leaks when drivers fail to release it.
Signed-off-by: Johan Hovold <johan(a)kernel.org>
---
drivers/greybus/es2.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/drivers/greybus/es2.c b/drivers/greybus/es2.c
index 6ae0ac828afa..bb513ef7f7ff 100644
--- a/drivers/greybus/es2.c
+++ b/drivers/greybus/es2.c
@@ -806,8 +806,6 @@ static void es2_destroy(struct es2_ap_dev *es2)
udev = es2->usb_dev;
gb_hd_put(es2->hd);
-
- usb_put_dev(udev);
}
static void cport_in_callback(struct urb *urb)
@@ -1257,7 +1255,7 @@ static int ap_probe(struct usb_interface *interface,
bool bulk_in_found = false;
bool arpc_in_found = false;
- udev = usb_get_dev(interface_to_usbdev(interface));
+ udev = interface_to_usbdev(interface);
num_cports = apb_get_cport_count(udev);
if (num_cports < 0) {
--
2.52.0
Replace 'unsigned long long int' with 'unsigned long long' as the
'int' suffix is unnecessary and not preferred by kernel coding style.
Signed-off-by: Oskar Ray-Frayssinet <rayfraytech(a)gmail.com>
---
drivers/staging/greybus/Documentation/firmware/authenticate.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/staging/greybus/Documentation/firmware/authenticate.c b/drivers/staging/greybus/Documentation/firmware/authenticate.c
index 3d2c6f88a138..0ef88b7d24de 100644
--- a/drivers/staging/greybus/Documentation/firmware/authenticate.c
+++ b/drivers/staging/greybus/Documentation/firmware/authenticate.c
@@ -58,7 +58,7 @@ int main(int argc, char *argv[])
goto close_fd;
}
- printf("UID received: 0x%llx\n", *(unsigned long long int *)(uid.uid));
+ printf("UID received: 0x%llx\n", *(unsigned long long *)(uid.uid));
/* Get certificate */
printf("Get IMS certificate\n");
--
2.43.0