Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1723207 > unrolled thread
| Started by | Colin King <colin.king@canonical.com> |
|---|---|
| First post | 2017-08-30 13:20 +0200 |
| Last post | 2017-09-03 18:50 +0200 |
| Articles | 2 — 2 participants |
Back to article view | Back to linux.kernel
[PATCH] iio: imu: inv_mpu6050: make arrays hz and d static Colin King <colin.king@canonical.com> - 2017-08-30 13:20 +0200
Re: [PATCH] iio: imu: inv_mpu6050: make arrays hz and d static Jonathan Cameron <jic23@kernel.org> - 2017-09-03 18:50 +0200
| From | Colin King <colin.king@canonical.com> |
|---|---|
| Date | 2017-08-30 13:20 +0200 |
| Subject | [PATCH] iio: imu: inv_mpu6050: make arrays hz and d static |
| Message-ID | <uk9cm-7C1-7@gated-at.bofh.it> |
From: Colin Ian King <colin.king@canonical.com>
Don't populate the arrays on the stack, instead make them static.
Makes the object code smaller by 135 bytes:
Before:
text data bss dec hex filename
15135 4240 128 19503 4c2f inv_mpu_core.o
After:
text data bss dec hex filename
14840 4400 128 19368 4ba8 inv_mpu_core.o
Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
drivers/iio/imu/inv_mpu6050/inv_mpu_core.c | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c b/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c
index 44830bce13df..6692f5e08dc8 100644
--- a/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c
+++ b/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c
@@ -570,10 +570,12 @@ static int inv_mpu6050_write_raw(struct iio_dev *indio_dev,
*/
static int inv_mpu6050_set_lpf(struct inv_mpu6050_state *st, int rate)
{
- const int hz[] = {188, 98, 42, 20, 10, 5};
- const int d[] = {INV_MPU6050_FILTER_188HZ, INV_MPU6050_FILTER_98HZ,
- INV_MPU6050_FILTER_42HZ, INV_MPU6050_FILTER_20HZ,
- INV_MPU6050_FILTER_10HZ, INV_MPU6050_FILTER_5HZ};
+ static const int hz[] = {188, 98, 42, 20, 10, 5};
+ static const int d[] = {
+ INV_MPU6050_FILTER_188HZ, INV_MPU6050_FILTER_98HZ,
+ INV_MPU6050_FILTER_42HZ, INV_MPU6050_FILTER_20HZ,
+ INV_MPU6050_FILTER_10HZ, INV_MPU6050_FILTER_5HZ
+ };
int i, h, result;
u8 data;
--
2.14.1
[toc] | [next] | [standalone]
| From | Jonathan Cameron <jic23@kernel.org> |
|---|---|
| Date | 2017-09-03 18:50 +0200 |
| Message-ID | <ulGfT-2id-5@gated-at.bofh.it> |
| In reply to | #1723207 |
On Wed, 30 Aug 2017 12:16:16 +0100
Colin King <colin.king@canonical.com> wrote:
> From: Colin Ian King <colin.king@canonical.com>
>
> Don't populate the arrays on the stack, instead make them static.
> Makes the object code smaller by 135 bytes:
>
> Before:
> text data bss dec hex filename
> 15135 4240 128 19503 4c2f inv_mpu_core.o
>
> After:
> text data bss dec hex filename
> 14840 4400 128 19368 4ba8 inv_mpu_core.o
>
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
Applied to the togreg branch of iio.git and pushed out as
testing or the autobuilders to play with it.
Thanks,
Jonathan
> ---
> drivers/iio/imu/inv_mpu6050/inv_mpu_core.c | 10 ++++++----
> 1 file changed, 6 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c b/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c
> index 44830bce13df..6692f5e08dc8 100644
> --- a/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c
> +++ b/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c
> @@ -570,10 +570,12 @@ static int inv_mpu6050_write_raw(struct iio_dev *indio_dev,
> */
> static int inv_mpu6050_set_lpf(struct inv_mpu6050_state *st, int rate)
> {
> - const int hz[] = {188, 98, 42, 20, 10, 5};
> - const int d[] = {INV_MPU6050_FILTER_188HZ, INV_MPU6050_FILTER_98HZ,
> - INV_MPU6050_FILTER_42HZ, INV_MPU6050_FILTER_20HZ,
> - INV_MPU6050_FILTER_10HZ, INV_MPU6050_FILTER_5HZ};
> + static const int hz[] = {188, 98, 42, 20, 10, 5};
> + static const int d[] = {
> + INV_MPU6050_FILTER_188HZ, INV_MPU6050_FILTER_98HZ,
> + INV_MPU6050_FILTER_42HZ, INV_MPU6050_FILTER_20HZ,
> + INV_MPU6050_FILTER_10HZ, INV_MPU6050_FILTER_5HZ
> + };
> int i, h, result;
> u8 data;
>
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web